(*  bell_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Bell numbers *)
(*    at selected indices fx(n), *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  02 December 2005 *)
(*  Author:  John Burkardt *)

nvec = {0,1,2,3,4,5,6,7,8,9,10}
num = Length [ nvec ];

fvec = {};
Do[{ n = nvec[[i]], 
f = Sum[StirlingS2[n,m],{m,1,n}],
fvec = Append[fvec, f],
Print["Bell[",n,"]=",f]
}, {i, 1, num,1}]

fileout=OpenWrite["/Users/burkardt/public_html/math_src/test_values/bell_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  bell_values.txt"];today=DateList[];Write[fileout,"#  Created on ",today];Write[fileout,"#"];
Write[fileout,"#  n  fn"];
Write[fileout,"#"];
Do[{n=nvec[[i]];f=fvec[[i]];Write[fileout,N[n,16],"  ",N[f,16]]},{i,1,num,1}];Close[fileout];