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(): |
![[decompose, fs, rept]](/view.aspx?SI=4857/FS_Examples_2.gif) |
(1.1) |
> |
f:=piecewise(t<1,t/2+1/2,t>=1,-t+2); |
 |
(1.2) |
> |
plot(rept(f,t=-1..2),t=-4..5,thickness=2,tickmarks=[10,2]); |
Fig.1
![1/2*a[0]+(Sum(b[n]*sin(2*Pi*n*t/3)+a[n]*cos(2*Pi*n*t/3), n = 1 .. infinity))](/view.aspx?SI=4857/FS_Examples_6.gif) |
(1.3) |

 |
(1.3) |
 |
(1.4) |
 |
(1.5) |
 |
(1.6) |
> |
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]); |
![Sum(c[n]*exp(2*Pi*n*t/3), n = -infinity .. infinity)](/view.aspx?SI=4857/FS_Examples_13.gif) |
(1.7) |
 |
(1.7) |
 |
(1.8) |
 |
(1.9) |
Example2: Demostration of Gibb's Phenomenon
> |
rect:=t->u(t+1/2)-u(t-1/2): |
> |
plot(rect(t),t=-3..3,thickness=2); |
> |
plot(rept(rect(t),t=-1..1),t=-3..3,thickness=2); |
> |
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))](/view.aspx?SI=4857/FS_Examples_19.gif) |
(2.1) |
 |
(2.1) |
> |
GP:=N->plot([g(N),rept(rect(t),t=-1..1)],t=-3..3,color=[blue,green],numpoints=10*N): |
Example3
> |
plot(rept(exp(t),t=-1..1),t=-5..5,0..3,color=blue,discont=true); |
> |
fs(exp(t),t=-1..1,exp); |
![Sum(c[n]*exp(Pi*n*t), n = -infinity .. infinity)](/view.aspx?SI=4857/FS_Examples_26.gif) |
(3.1) |
![c[n] = 1/2*(-1)^(1+n)*(-1+exp(2))*exp(-1)/(-1+Pi*n*I)](/view.aspx?SI=4857/FS_Examples_27.gif) |
(3.1) |
 |
(3.2) |
 |
(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))](/view.aspx?SI=4857/FS_Examples_30.gif) |
(4.1) |
 |
(4.1) |
> |
cos(t)^4=combine(cos(t)^4); |
 |
(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.