HELP!!!
- To: mathgroup at smc.vnet.net
- Subject: [mg31128] HELP!!!
- From: "alfaomega" <che_dio_ve_furmini at hotmail.com>
- Date: Fri, 12 Oct 2001 03:36:45 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I'm writing this little program to approximate a function with the
FourierTrigSeries.
Everything's ok, but i can't calculate the maximum of each series term (I
need it to evaluate the error... what's wrong with the last "While"?
Thank you in advance,
alphaomega.
<<Calculus`FourierTransform`
y[t_]:= If[0<t<Pi, 1, 0]
funz=Plot[y[t], {t,0,2Pi}, PlotStyle->{Thickness[0.0065],RGBColor[1,0,0]}]
f[n_]=FourierTrigSeries[y[t],{t,0,2Pi},n]
FourierTrigSeries[If[0 < t < Pi, 1, 0], {t, 0, 2 Pi}, n]
Do [ i=0;
While [i<11,
gi=f[i];
ser=Plot[gi, {t,0,2Pi}, PlotStyle->{Thickness[0.0065],RGBColor[0,0,1]}];
Show [ser,funz];
i=i+2;];
]
i=0
rapp=1
While [rapp>0.1,
si=-f[i];
maxf=FindMinimum[si,{t,0.1,0,1}];
rapp=(maxf[[1]]-1);
i=i+1]