>
restart;
>
plots[setoptions](colour=BLACK);
>
FourierSineSeries3 := proc( f, x )
local k, z, F, fop, desc;
desc := sprintf( "Computes Fourier
Sine Series of %a", f );
fop := unapply(f,x);
F := 2*int( sin(k*Pi*z)*fop(z),
z=0..1 );
subs(DUMMY=desc,proc(n)
local j, s, tmp;
option Copyright;
description DUMMY;
s := 0;
for j to n do
try
tmp := eval( F, k=j );
catch "numeric exception: division
by zero":
tmp := limit( F, k=j );
finally
s := s + tmp*sin(j*Pi*x);
end try;
end do;
end proc);
end proc:
>
macro(
FSS3=FourierSineSeries3 );
>
f :=
FSS3( x^2*(1-x^2), x );