In[1]:=

<< Statistics`NormalDistribution`

In[2]:=

a = {5.5, 5.7, 5.8, 6, 6.1, 6.3} ; b = {4.8616, 8} ; m = Mean [a]

Out[4]=

5.8999999999999995`

In[5]:=

s = StandardDeviation[a]

Out[5]=

0.28982753492378865`

In[6]:=

c = Min[Abs[b - Mean[a]]]

Out[6]=

1.0383999999999993`

In[7]:=

g = c/(3 s)

Out[7]=

1.1942734613685009`

In[8]:=

Z = c/s

Out[8]=

3.5828203841055024`

In[9]:=

u = Z + 1.5

Out[9]=

5.082820384105503`

In[10]:=

ndist = NormalDistribution[0, 1] ; f[x_] := (1 - CDF[ndist, x]) * 1000000 f[(Z)]

Out[12]=

169.95216833914918`

In[13]:=

e = %

Out[13]=

169.95216833914918`

In[14]:=

1 - (Table[(1/Sqrt[2 * Pi]) *  NIntegrate[E^(-(t^2/2)),  {t, -Infinity, (Z)}]])

Out[14]=

0.00016995216825088644`

In[15]:=

% * 10^6

Out[15]=

169.95216825088644`

In[16]:=

 bellPlot[lis_List, {var_, varmin_, varmax_}, opts___] := Module[{mn, sd},  mn = Mean[lis] ;  sd = StandardDeviation[lis] ;  pts = Map[ {PointSize[.02], Hue[0], Point[{#, 0.02}]} &, lis] ;  plt = Plot[PDF[NormalDistribution[mn, sd], var], {var, varmin, varmax}, Epilog -> pts, opts]]

In[17]:=

q = bellPlot[a, {x, 4, 8}, PlotStyle -> Hue[2/3],  Frame -> True, GridLines -> Automatic,  Prolog -> ({PointSize[.04], Hue[1/3], Point[{#1, .02}]} &) /@ b]

[Graphics:HTMLFiles/bell2_24.gif]

Out[17]=

-Graphics -

In[18]:=

Export["c:\\web\\bell.gif", q,  ImageResolution -> 138]

Out[18]=

c:\\web\\bell.gif

In[19]:=

Export["c:\\web\\numbers2.txt",  MapThread[StringJoin, {{"Defective parts per million = ", "Closest limit/sigma ratio = ", "Cpk = ", "Bell curve mean = ", "Sigma (standard deviation) = ", "Minimum distance from the mean to a tolerance limit = "},  Map[ToString, {NumberForm[e, 9], NumberForm[u, 9], NumberForm[g, 9], NumberForm[m, 9], NumberForm[s, 9], NumberForm[c, 9]}]}], "List"]

Out[19]=

c:\\web\\numbers2.txt


Converted by Mathematica  (October 22, 2002)