Fourier Series 

Function: calc[FourierAnim] - Fourier series animation 

Calling Sequence:  

FourierAnim(f, p, N, r, F) 

Parameters: 

f -  periodic function with period `+`(`*`(2, `*`(p)))  

N - number of Fourier coefficients 

r - range of the independent variable, for instance x = x[1] .. x[2] or t = t[1] .. t[2] 

F - name of the Fourier series 

Description: 

  • Fourieranim animates the Fourier series of f given by
 

F(x) = `+`(Sum(`/`(`*`(a(n), `*`(cos, `*`(n, `*`(Pi, `*`(x))))), `*`(L)), n = 1 .. infinity), `/`(`*`(b(n), `*`(sin, `*`(n, `*`(Pi, `*`(x))))), `*`(L))) 

Type F to get the output of the partial sums. 

Note! Use `+`(`-`(p)) as parameter if f  is defined in the interval from -p to  p.
Use
p if  f is defined in the interval from 0 to `+`(`*`(2, `*`(p))).
 

Examples: 

> restart: with(calc):
 

> f:= t -> piecewise(t<-Pi, 0,t<0, -1,t<Pi,1,0):
 

> 'f(t)'=simplify(f(t));
 

f(t) = piecewise(`<`(t, `+`(`-`(Pi))), 0, `<`(t, 0), -1, `<`(t, Pi), 1, `<=`(Pi, t), 0)
 

> FourierAnim(f,Pi,20,t=-6..6,F1);
 

 

F(t) = `+`(`/`(1, 2), Sum(`+`(`/`(`*`(sin(`*`(Pi, `*`(n))), `*`(cos(`*`(n, `*`(t))))), `*`(Pi, `*`(n))), `-`(`/`(`*`(`+`(`-`(1), cos(`*`(Pi, `*`(n)))), `*`(sin(`*`(n, `*`(t))))), `*`(Pi, `*`(n))))), n...
Plot_2d
 

> F(t)=F1+`...`;
 

F(t) = `+`(`/`(1, 2), `/`(`*`(2, `*`(sin(t))), `*`(Pi)), `/`(`*`(`/`(2, 3), `*`(sin(`+`(`*`(3, `*`(t)))))), `*`(Pi)), `/`(`*`(`/`(2, 5), `*`(sin(`+`(`*`(5, `*`(t)))))), `*`(Pi)), `/`(`*`(`/`(2, 7), `*...
F(t) = `+`(`/`(1, 2), `/`(`*`(2, `*`(sin(t))), `*`(Pi)), `/`(`*`(`/`(2, 3), `*`(sin(`+`(`*`(3, `*`(t)))))), `*`(Pi)), `/`(`*`(`/`(2, 5), `*`(sin(`+`(`*`(5, `*`(t)))))), `*`(Pi)), `/`(`*`(`/`(2, 7), `*...
F(t) = `+`(`/`(1, 2), `/`(`*`(2, `*`(sin(t))), `*`(Pi)), `/`(`*`(`/`(2, 3), `*`(sin(`+`(`*`(3, `*`(t)))))), `*`(Pi)), `/`(`*`(`/`(2, 5), `*`(sin(`+`(`*`(5, `*`(t)))))), `*`(Pi)), `/`(`*`(`/`(2, 7), `*...