Obtain Fourier Series approximation of \(f(x)=e^{-|x|}\) for \(-1
\[ 1-{\mathrm e}^{-1}+\sum _{n=1}^{\infty } \left (-\frac {2 \left (\left (-1\right )^{n} {\mathrm e}^{-1}-1\right ) \cos \! \left (\pi n x \right )}{\pi ^{2} n^{2}+1}\right ) \]
Mathematica does not have a buildin function to give general series expression
as the above with Maple. There is a user written package and answer here
https://mathematica.stackexchange.com/questions/149468/a-more-convenient-fourier-series
which provides this.
In Mathematica it is possible to obtain the terms using the command \[ \frac {(1+e) e^{-i \pi x}}{e+e \pi ^2}+\frac {(1+e) e^{i \pi x}}{e+e \pi ^2}+\frac {e-1}{e} \]
see https://reference.wolfram.com/language/ref/FourierSeries.html for deļ¬nitions
of
Obtain Fourier Series approximation of \[ f\left ( x\right ) =\left \{ \begin {array} [c]{ccc}\frac {2xh}{L} & & 0\leq x\leq \frac {L}{2}\\ \frac {2h\left ( L-x\right ) }{L} & & \frac {L}{2}\leq x\leq L \end {array} \right . \]
For \(0
\[ 2 \left (\sum _{n=1}^{\infty } \frac {h \left (\left (-1\right )^{n}-1\right ) \cos \left (\frac {2 \pi n x}{L}\right )}{\pi ^{2} n^{2}}\right )+\frac {h}{2} \]
Obtain Fourier Series approximation of \(\cosh x\) for \(-1
\[ \sinh \left (1\right )+\left (\sum _{n=1}^{\infty } \frac {2 \sinh \left (1\right ) \left (-1\right )^{n} \cos \left (\pi n x \right )}{\pi ^{2} n^{2}+1}\right ) \]
3.6.1.1 Maple
restart;
f:=x->exp(-abs(x));
f_approx:=OrthogonalExpansions:-FourierSeries(f(x),x=-1..1,infinity ):
f_approx:=subs(i=n,f_approx);
3.6.1.2 Mathematica
FourierSeries
. For
example the terms \(n=0,n=-1,n=1\) can be obtained using
expr = Exp[-Abs[x]];
FourierSeries[expr, x, 1, FourierParameters -> {1, Pi}]
FourierParameters
used above.
3.6.2 Example 2
3.6.2.1 Maple
restart;
f:=x->piecewise(0<x and x<L/2,2*x*h/L, L/2<x and x<L, 2*h*(L-x)/L);
f_approx:=OrthogonalExpansions:-FourierSeries(f(x),x=0..L,infinity ):
f_approx:=subs(i=n,f_approx):
simplify(%) assuming L>0
3.6.3 Example 3
3.6.3.1 Maple
restart;
f:=x->cosh(x);
f_approx:=OrthogonalExpansions:-FourierSeries(f(x),x=-1..1,infinity ):
f_approx:=subs(i=n,f_approx);
convert(%,trig);