(*  bernoulli_poly_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Bernoulli polynomials *)
(*    of selected orders and arguments p(n)(x), *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  07 December 2005 *)
(*  Author:  John Burkardt *)

nvec = {};
xvec = {};
fvec = {};
num = 0;
x = 2 / 10
Do [ { 
num = num + 1;
nvec = Append [ nvec, n],
xvec = Append[xvec,x],
f = BernoulliB[n,x] ,
fvec = Append[fvec,f],
      Print["p(",n,")(",x,")=",N[f,16]] },{n,0,10,1}]

n = 5
Do [ {
x = i / 10,
num = num + 1;
nvec = Append [ nvec, n],
xvec = Append[xvec,x],
f = BernoulliB[n,x] ,
fvec = Append[fvec,f],
      Print["p(",n,")(",x,")=",N[f,16]] },
      {i,-5,10,1}]

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