Application Center - Maplesoft

App Preview:

The Fourier Series package for Maple

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

The FourierSeries Package : Examples of Usage 

 

Amir H. Khanshan 

E-mail: khanshan@yahoo.com 

 

 

Example 1 

Find the fourier series coefficient of the following function(Fig.1). 

> restart;
libname:=libname, currentdir():
 

> with(FourierSeries);
 

[decompose, fs, rept] (1.1)
 

>
 

> f:=piecewise(t<1,t/2+1/2,t>=1,-t+2);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi( (1.2)
 

> plot(f,t=-5..5);
 

Plot
 

> plot(rept(f,t=-1..2),t=-4..5,thickness=2,tickmarks=[10,2]);
 

Plot
 

Fig.1 

> fs(f,t=-1..2,trig);
 

1/2*a[0]+(Sum(b[n]*sin(2*Pi*n*t/3)+a[n]*cos(2*Pi*n*t/3), n = 1 .. infinity)) (1.3)
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi(
(1.3)
 

> decompose(a,3);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mo( (1.4)
 

> decompose(b,3);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mo( (1.5)
 

> b(5);
 

-9*3^(1/2)/(100*Pi^2) (1.6)
 

>
 

exponential form:
 

> f:=piecewise(t<1,t/2+1/2,t>=1,-t+2):
 

> plot(rept(f,t=-1..2),t=-4..5,thickness=2,tickmarks=[10,2]);
 

Plot
 

> fs(f,t=-1..2,exp);
 

Sum(c[n]*exp(2*Pi*n*t/3), n = -infinity .. infinity) (1.7)
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi( (1.7)
 

> decompose(c,3);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mo( (1.8)
 

> evalc(%);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mo( (1.9)
 

Example2: Demostration of Gibb's Phenomenon 

> u:=Heaviside:
 

> rect:=t->u(t+1/2)-u(t-1/2):
 

> plot(rect(t),t=-3..3,thickness=2);
 

Plot
 

> plot(rept(rect(t),t=-1..1),t=-3..3,thickness=2);
 

Plot
 

> fs(rect(t),t=-1..1,trig,'g'):
 

1/2*a[0]+(Sum(b[n]*sin(Pi*n*t)+a[n]*cos(Pi*n*t), n = 1 .. infinity)) (2.1)
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi( (2.1)
 

> GP:=N->plot([g(N),rept(rect(t),t=-1..1)],t=-3..3,color=[blue,green],numpoints=10*N):
 

> GP(3);
 

Plot
 

> GP(5);
 

Plot
 

> GP(10);
 

Plot
 

>
 

> GP(70);
 

Plot
 

 

Example3 

> plot(rept(exp(t),t=-1..1),t=-5..5,0..3,color=blue,discont=true);
 

Plot
 

> fs(exp(t),t=-1..1,exp);
 

Sum(c[n]*exp(Pi*n*t), n = -infinity .. infinity) (3.1)
 

c[n] = 1/2*(-1)^(1+n)*(-1+exp(2))*exp(-1)/(-1+Pi*n*I) (3.1)
 

> convert(c(n),trig):
 

> combine(%);
 

-(-1)^n*sinh(1)/(-1+Pi*n*I) (3.2)
 

> c(0);
 

1/2*(-1+exp(2))*exp(-1) (3.3)
 

Example4 

> fs(cos(t)^4,t=0..Pi,trig);
 

1/2*a[0]+(Sum(b[n]*sin(2*n*t)+a[n]*cos(2*n*t), n = 1 .. infinity)) (4.1)
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi( (4.1)
 

> cos(t)^4=combine(cos(t)^4);
 

cos(t)^4 = 1/8*cos(4*t)+1/2*cos(2*t)+3/8 (4.2)
 

 

 

Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.
 

Image