(*  chebyshev_w_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Chebyshev W polynomial *)
(*    at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  23 April 2012 *)
(*  Author:  John Burkardt *)

nvec = {};
xvec = {};
fvec = {};
Do [ { n = i - 1, 
x = 8/10, 
u = Sqrt [ (x+1)/2],
f = ChebyshevU[2*n,u ] ,
nvec = Append [ nvec, n ],
xvec = Append [ xvec, x ],
fvec = Append [ fvec, f ],
      Print["  ChebyshevW[",n,",",x,"]=",N[f,16]] },{i,1,13,1}]
num = Length [ xvec ]

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