Fourier series with Maxima
If we want to compute the fourier series expansion of
, then our coefficients are readily computed on paper as:



and

Now we are going to call the functions fourier, foursimp and
fourexpand, which obviously calculates the coefficients, simplifies
it and expands them into a series. Alternatively, you could call
totalfourier which is just the composition of the three
functions.
foursimp(fourier(x^2,x,%pi));

This will spit out the coefficients
,
and
. We can now use fourexpand to expand this into a
finite series (four terms here).
fourexpand(%o7,x,%pi,4);

Now plot the series approximation along with the original to compare:
plot ([x^2,%o8],[x,-3,3]);
That is all.
