Quality Control : Dutch Match

You have met our factory. We produce wooden sticks and all sticks are produces in accordance with the wishes of our customers. Since we put out millions of sticks every day, the length of the sticks is a continuous distribution. Like you see in the above graph. This specific lot was produced for a customer requiring sticks with a nominal length of 40 mm and a 1.5 mm margin to either way. As you can see, we are spot on for the length. And the Cpk for this lot was 2.0. That's a TWELVE sigma margin!

Quality Control : Gauss distribution

Dutch Match produce wooden sticks. Their machinery is state of the art, yet not errorfree. Such a process produces a lot of differently sized sticks. In the range 39 to 41 mm every single value (in 0.1 mm steps) is present in the results. Yet, since the machines are well in control, the emphasis is on 40 mm and the close proximity.
This is typical for a 'normal' or 'Gaussian' distribution. Many industrial processes produce materials with a normal distributon in their parameters. This topic is about calculating the dataset for a perfect gaussian distribution.
The reason for doing this is not to enable forgery of your results. It's more in the interest of education and training. Suppose you are preparing a training for QC personnel and you need data for your training. You could re-use old data, but that gets boring. You can also perform a lot of measurements yourself but that takes a lot of time. It would be more convenient to have a tool to produce a set of data that enables you to make a data set that produces a normal distribution.

That is one of the reasons this program was made:

and the program determines how many datapoints there are required in each class width. Using a random number generator it then gets quite easy to construct a dataset.
Another application for the program is to be able to produce all kinds of Gauss curves for teaching purposes. No more sloppy hand drafted bell curves. With this program you stomp out perfectly looking curves.

Gauss : the source

Below is the source code for the 'gauss' program. It is written in Modula-2 and the target compiler is Mocka (for Linux). The executables and sources can be downloaded from this site as well. Here comes:

MODULE gauss;

IMPORT	Arguments, InOut, MathLib, NumConv, RealConv;

VAR	sigma, delta, mu, n, f	: REAL;
	buffer			: Arguments.ArgTable;
	count			: SHORTCARD;


PROCEDURE Gauss (x, mu, sigma : REAL) : REAL;

VAR	diff	: REAL;

BEGIN
  diff := x - mu;
  RETURN MathLib.exp ( -0.5 * (diff * diff) / ( sigma * sigma ) ) / (sigma * 2.506628)
END Gauss;


PROCEDURE Init;

VAR	ok	: BOOLEAN;

BEGIN
  Arguments.GetArgs (count, buffer);
  IF  count # 4  THEN
    InOut.WriteString ("Syntax : gauss mu sigma delta");
    InOut.WriteLn;
    HALT
  END;
  mu := RealConv.Str2Real (buffer^[1]^, ok);
  IF  NOT ok  THEN
    InOut.WriteString (buffer^[1]^);
    InOut.WriteString (" contains invalid tokens. Aborting.");
    InOut.WriteLn;
    HALT
  END;
  sigma := RealConv.Str2Real (buffer^[2]^, ok);
  IF  NOT ok  THEN
    InOut.WriteString (buffer^[2]^);
    InOut.WriteString (" contains invalid tokens. Aborting.");
    InOut.WriteLn;
    HALT
  END;
  delta := RealConv.Str2Real (buffer^[3]^, ok);
  IF  NOT ok  THEN
    InOut.WriteString (buffer^[3]^);
    InOut.WriteString (" contains invalid tokens. Aborting.");
    InOut.WriteLn;
    HALT
  END
END Init;


BEGIN
   Init;
   n := mu - 4.0 * sigma;
   REPEAT
     InOut.WriteReal (n, 5, 2);
     InOut.Write (11C);
     f := Gauss (n, mu, sigma);
     InOut.WriteReal (f, 20, 10);
     InOut.WriteLn;		
     n := n + delta
   UNTIL  n > mu + 4.0 * sigma;
END gauss.
   
The program requires three arguments to be specified on the command line: below is a typical command line:
   jan@Beryllium:~/modula/sampl$ gauss 40 0.25 0.1 >fileA 
   
It produces the frequency data for this dataset and stores the lot in a file called 'fileA'. This dataset is then plotted with gnuplot (freely available for all major operating systems, even for Windows Vista) like so:
jan@Beryllium:~/modula/sampl$ gnuplot

        G N U P L O T
	Version 4.2 patchlevel 3
	last modified Mar 2008
	System: Linux 2.6.27.7-smp
	
	Copyright (C) 1986 - 1993, 1998, 2004, 2007, 2008
	Thomas Williams, Colin Kelley and many others
	
	Type help to access the on-line reference manual.
	The gnuplot FAQ is available from http://www.gnuplot.info/faq/
	
	Send bug reports and suggestions to <http://sourceforge.net/projects/gnuplot>
	

Terminal type set to 'x11'
gnuplot> plot "fileA"
gnuplot> exit
jan@Beryllium:~/modula/sampl$
Below you see some sample outputs of gnuplotted datasets:






Page created on 15 September 2009 and

Page equipped with FroogleBuster technology