List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Fourier series
| [MUG] Fourier series |
|
Author: David Garcia Cervetti
Posted: 13/08/1999 20:03:56 GDT
|
>> From: David Garcia Cervetti "david"
Hi you all,
I am trying to create an animation of rational functions using series. I
have done it fine with Taylor command and series command.
Can somebody tell me how to get the Fourier series of a rational
function and plot it?
Thanks and best regards,
--
David Garcia Cervetti
Programmer
Vizooal, Inc.
22 w 21st Street, Suite 402
New York, NY 10010
Tel: 212.627.1085
www.vizooal.com
Email: "david"
|
| [MUG] Re: Fourier series |
|
Author: Maple Group
Posted: 23/08/1999 19:37:40 GDT
|
>> From: Maple Group "maple_gr"
| I am trying to create an animation of rational functions using series. I
| have done it fine with Taylor command and series command.
| Can somebody tell me how to get the Fourier series of a rational
| function and plot it?
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 20 Aug 1999 15:02:04 -0500 (CDT)
From: Mike May "maymk"
To: "maple-list"
Subject: Fourier series
I did a worksheet for my linear algebra class that does precisely that.
(Atually it is part of a series of worksheets. Others deal with
orthogonal polynomials.)
The files are available via anonymous ftp at euler.slu.edu
changing directories to Courseware and then to LinearAlgebra
the file OnLine4-3-FourierApprox.mws is what you are looking for.
You also can get to the files over the web
Go to euler.slu.edu, follow the buttons through Teaching,
Courseware, and Linear Algebra to
http://euler.slu.edu/courseware/LinearAlgebra/LinAlgMaster.html
Mike May
"maymk"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "cassco"
Date: Fri, 20 Aug 1999 18:48:39 -0700
To: "maple-list"
Subject: Fourier series
I compute the coefficients of the Fourier series as follows;
Given F(t),
a0=(1/T)*int(F,t=0..infinity)
an=(1/T)*int(F*sin(n*omega*t),t=0..infinity)
bn=(1/T)*int(F*cos(n*omega*t),t=0..infinity)
where T= period, and omega=2*Pi/T
Tom Casselman
"cassco"
|
| [MUG] Fourier series |
|
Author: Chuck Baker
Posted: 23/11/2000 21:43:55 GMT
|
>> From: Chuck Baker "geogra4"
Greetings all,
I have developed a Fourier series of the following function with a period of
2pie.
0, -pie < x < -pie/2
f(x) = 1, -pie/2 < x < pie/2
0, pie/2 < x < pie
I derived the following answer by hand:
F(x) = 1/2 + 2/pie(cos x - 1/3 cos3x + 1/5 cos5x +....)
How can I derive the same answer using Maple?
Thanks,
Chuck
|
| [MUG] Re: Fourier series |
|
Author: Maple Group
Posted: 29/11/2000 14:23:03 GMT
|
>> From: Maple Group "maple_gr"
>> From: Chuck Baker "geogra4"
| I have developed a Fourier series of the following function with a period
| of 2pie.
|
| 0, -pie < x < -pie/2
| f(x) = 1, -pie/2 < x < pie/2
| 0, pie/2 < x < pie
|
| I derived the following answer by hand:
| F(x) = 1/2 + 2/pie(cos x - 1/3 cos3x + 1/5 cos5x +....)
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Sun, 26 Nov 2000 17:39:20 +0100
From: Backes "backes"
To: "maple-list"
Subject: Fourier series
The following scheme works nicely for all piecewhise defined functions:
> ch:= (a,b)->Heaviside(t-a)*Heaviside(-t+b):
> T:=2*Pi; omega:=2*Pi/T; N:=5;
T := 2 Pi
omega := 1
N := 5
> f:=ch(-Pi/2,Pi/2);
f := Heaviside(t + 1/2 Pi) Heaviside(-t + 1/2 Pi)
> a:=array(0..0); b:=array(1..N);
a := array(0 .. 5, [])
b := array(1 .. 5, [])
> a[0]:=evalf(2/T*int(f, t=0..T));
> for i from 1 to N do
> b[i]:=eval(2/T*int(f*sin(i*omega*t), t=0..T) );
> od;
a[0] := .5000000000
1
b[1] := ----
Pi
1
b[2] := ----
Pi
1
b[3] := 1/3 ----
Pi
b[4] := 0
1
b[5] := 1/5 ----
Pi
Greetings from merry old Europe.
Backes
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Wed, 29 Nov 2000 13:24:19 +0100
From: Barsuhn "barsuhn"
Subject: Fourier series
To: "maple-list"
Dear Chuck,
use the following piece of Maple code
> restart;
> f:=x->piecewise(x<-Pi/2,0,x<Pi/2,1,0);# define the function
> f(x);# inspect the function f
> plot(f,-Pi..Pi,-1..2,axes=boxed,scaling=constrained);# get the plot of f
> a:=1/Pi*int(f(x)*cos(n*x),x=-Pi..Pi);a:=unapply(a,n);
> b:=2/Pi*int(f(x)*sin(n*x),x=-Pi..Pi);b:=unapply(b,n);
> number:=10;#as an example
> a(0):=1/Pi*int(f(x),x=-Pi..Pi);# a0 in the remember table
> Summe:=a(0)/2+sum(a(k)*cos(k*x)+b(k)*sin(k*x),k=1..number);
>
plot([f(x),Summe],x=-Pi..Pi,-1..2,axes=boxed,scaling=constrained,color=[red,blue
]);#
get a picture of f(x) and its partial Fourier sum
>
This will work for many other functions (period 2*Pi assumed), that you
may define using piecewise. You obtain the exact Fourier coefficients.
In more complicated cases, however, you will have to replace a(0), a(k),
b(k) by evalf(a(0)) etc. in the assignment to Summe.
All the best Jurgen
--
-------------------
Prof. Dr. Jurgen Barsuhn
Fachhochschule Bielefeld
University of Applied Sciences
Fachbereich Elektrotechnik und Informationstechnik
Wilhelm-Bertelsmann-Str. 10
D-33602 Bielefeld
-----------
|
| [MUG] Re: Fourier series |
|
Author: Doc RNDr Pavel Hruka CSc
Posted: 30/11/2000 16:17:58 GMT
|
>> From: "Doc. RNDr. Pavel Hruka CSc." "hruskap"
>> From: Chuck Baker "geogra4"
| I have developed a Fourier series of the following function with a period
| of 2pie.
|
| 0, -pie < x < -pie/2
| f(x) = 1, -pie/2 < x < pie/2
| 0, pie/2 < x < pie
|
| I derived the following answer by hand:
| F(x) = 1/2 + 2/pie(cos x - 1/3 cos3x + 1/5 cos5x +....)
The following procedure evaluates the Fourier series up to n*x term:
> Fourier_series:=proc(func,xrange::name=range,n::posint)
> local x,a,b,l,k,j,p,q,partsum;
> a:=lhs(rhs(xrange));
> b:=rhs(rhs(xrange));
> l:=b-a;
> x:=2*Pi*lhs(xrange)/l;
> partsum:=1/l*int(func,xrange);
> for k to n do
# terms of Fourier series:
>
partsum:=partsum+2/l*int(func*sin(k*x),xrange)*sin(k*x)+2/l*int(func*cos(k*x),xr
ange)*cos(k*x);
> end do;
> partsum;
> end proc:
#Your function:
> f:= x->piecewise(x<-Pi/2,0,x<Pi/2,1,x<Pi,0):
# Result:
> Fourier_series(f(x),x=-Pi..Pi,6);
2 cos(x) cos(3 x) 2/5 cos(5 x)
1/2 + -------- - 2/3 -------- + ------------
Pi Pi Pi
All the best
---------------------------------------------------------
Doc. RNDr. Pavel Hruka, CSc. Tel. 5/4114 3257
Ustav Fyziky FEI VUT Fax. 5/4114 3133
Technicka 8, 616 00 Brno Zazn.5/4114 3391
---------------------------------------------------------
|
| [MUG] Re: Fourier series |
|
Author: Maple Group
Posted: 11/12/2000 14:51:13 GMT
|
>> From: Maple Group "maple_gr"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Bastero de Eleizalde, Carlos" "cbastero"
To: "''" "maple-list"
Subject: Fourier series
Date: Tue, 5 Dec 2000 16:44:13 +0100
Hi,
This is my way of doing it
> restart:
> f:=x->piecewise(-Pi<x and x<-Pi/2,0,-Pi/2<x and x<Pi/2,1,Pi/2<x and
x<Pi,0); # your function defined on [-T/2,T/2]
> T:=2*Pi;
> a:=n->simplify(2/(T)*int(f(x)*cos(2*n*Pi*x/T),x=-T/2..T/2));
> b:=n->simplify(2/(T)*int(f(x)*sin(2*n*Pi*x/T),x=-T/2..T/2));
> for k from 0 to 20 do a(k) od; # to get some values of a(n)
> for k from 0 to 20 do a(k) od; # to get some values of b(n)
Cheers
Carlos
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Willard, Daniel Dr DUSA-OR" "Daniel.Willard"
To: "''" "maple-list"
Subject: Fourier series
Date: Thu, 7 Dec 2000 15:51:38 -0500
Here's an answer to your fourier transform question:
> f:=x->Heaviside(x+Pi/2)-Heaviside(x-Pi/2);
> with(inttrans);
> fourier(f(t),t,w);
> simplify(%,exp);
>
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Doc. RNDr. Pavel Hruka CSc." "hruskap"
To: Maple Group "maple_gr"
Date: Wed, 6 Dec 2000 12:45:05 +0100 (CET)
Subject: Fourier series
| Can the same principle be applied to a problem that is described by:
|
| -1, -1 < x < 0
| f(x) =
| 1, 0 < x < 1
|
| Assuming f(x) is continuous periodically?
|
Chuck,
your function can be written as
> f2(x):=piecewise(x<0, -1,x < 1,1);
{ -1 x < 0
f2(x) := {
{ 1 x < 1
#Fourier series ( to the term 6x - not present in odd functions) is:
> Fourier_series(f2(x),x=-1..1,6);
sin(x) 4/3 sin(3 x) 4/5 sin(5 x)
4 ------ + ------------ + ------------
Pi Pi Pi
#This is the result.
The period in the series evaluation is determined by the interval
(x=-1..1) , which is the second parameter of the procedure
Fourier_series. Of course, f2(x) is NOT periodic, as you can easily
verify by plotting it:
> plot(f2(x),x=-10..10);
More information on functions with discontinuities are in
> ?piecewise
In my previous e-mail I used a 'procedure definition' of your
function, with an arrow. It can be used here, too, with the same
result:
> f2:=x->piecewise(x<0, -1,x < 1,1);
In that e-mail I used a modified procedure for displaying the
n-th partial Fourier series, which requires more local parameters to
be declared. I realized later, that three of them are not necessary in
your problem. Here is a simpler version of the procedure (MAPLE6.01):
> Fourier_series:=proc(func,xrange::name=range,n::posint)
> local a,b,l,k,t,partsum;
> a:=lhs(rhs(xrange));
> b:=rhs(rhs(xrange));
> l:=b-a;
> t:=2*Pi*lhs(xrange)/l;
> partsum:=1/l*int(func,xrange);
> for k to n do
> partsum:=partsum+2/l*int(func*sin(k*t),xrange)*sin(k*x)+2/l*int(func
> *cos(k*t),xrange)*cos(k*x); end do; partsum; end proc:
All the best
Pavel
| >> From: "Doc. RNDr. Pavel Hruka CSc." "hruskap"
|
| >> From: Chuck Baker "geogra4"
| | I have developed a Fourier series of the following function with a period
| | of 2pie.
| |
| | 0, -pie < x < -pie/2
| | f(x) = 1, -pie/2 < x < pie/2
| | 0, pie/2 < x < pie
| |
| | I derived the following answer by hand:
| | F(x) = 1/2 + 2/pie(cos x - 1/3 cos3x + 1/5 cos5x +....)
|
|
| The following procedure evaluates the Fourier series up to n*x term:
|
| > Fourier_series:=proc(func,xrange::name=range,n::posint)
| > local x,a,b,l,k,j,p,q,partsum;
| > a:=lhs(rhs(xrange));
| > b:=rhs(rhs(xrange));
| > l:=b-a;
| > x:=2*Pi*lhs(xrange)/l;
| > partsum:=1/l*int(func,xrange);
| > for k to n do
| # terms of Fourier series:
| >
partsum:=partsum+2/l*int(func*sin(k*x),xrange)*sin(k*x)+2/l*int(func*cos(k*x),xr
ange)*cos(k*x);
| > end do;
| > partsum;
| > end proc:
| #Your function:
| > f:= x->piecewise(x<-Pi/2,0,x<Pi/2,1,x<Pi,0):
| # Result:
| > Fourier_series(f(x),x=-Pi..Pi,6);
|
| 2 cos(x) cos(3 x) 2/5 cos(5 x)
| 1/2 + -------- - 2/3 -------- + ------------
| Pi Pi Pi
|
| All the best
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Pavel Hruska
Department of Physics
Faculty of Electrical Engineering and Computer Science
Brno University of Technology
Technicka 8, 616 00 Brno, CZECH REPUBLIC
Tel.: +420-5-4114 3257
+420-5-4114 3391 (secretary)
Fax : +420-5-4114 3133
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| [MUG] Re: Fourier series |
|
Author: Wilhelm Werner
Posted: 14/12/2000 08:47:31 GMT
|
>> From: Wilhelm Werner "werner"
Hi MUG members.
The numerous contributions to the Fourier series question show that many
people are interested in that subject. Maybe my contribution to the Maple
Application Center "Symbolic Computation of Fourier Series" is worth
mentioning in that context.
Regards
W.Werner
----------------------------------------------------------------------
Wilhelm Werner Phone: +49-(0)7940-1306-96
FH Heilbronn/Standort Kuenzelsau Fax : +49-(0)7940-1306-20
Daimlerstr. 35
D-74653 Kuenzelsau
e-mail: "werner"
----------------------------------------------------------------------
|
| [MUG] Fourier series |
|
Author: Anders Ekdahl
Posted: Mon, 04 Feb 2002 15:34:39 +0100
|
>> From: Anders Ekdahl "andek565"
Is there an easy way to get the Fourier series of a periodic function
in Maple V? If I have eg f(x)=cos(x)^2 if want expand it to f(x)
=1/2+1/2*cos(2x).
|
| [MUG] Re: Fourier series |
|
Author: Maple User Group
Posted: Thu, 14 Feb 2002 09:00:32 -0500
|
>> From: Maple User Group "maple_gr"
| >> From: Anders Ekdahl "andek565"
| Is there an easy way to get the Fourier series of a periodic function
| in Maple V? If I have eg f(x)=cos(x)^2 if want expand it to f(x)
| =1/2+1/2*cos(2x).
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Alec Mihailovs" "mihailovs"
To: "maple-list"
Subject: Fourier series
Date: Fri, 8 Feb 2002 23:40:42 -0500
For trigonometric polynomials, "combine" will do,
> combine(cos(x)^2);
1/2 cos(2 x) + 1/2
In general, there is a module, FourierSeries,
developed by Wilhelm Werner, see
http://www.mapleapps.com/categories/engineering/engmathematics/html/fouriers
ymbol.html
Best wishes,
Alec Mihailovs
http://webpages.shepherd.edu/amihailo
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Bastero de Eleizalde, Carlos" "cbastero"
To: "''"
Subject: Fourier series
Date: Sat, 9 Feb 2002 20:04:51 +0100
Hi Anders,
Try this one:
T:=evalf(2*Pi);
> alpha:=0.;
> beta:=alpha+T;
> F:=x-> cos(x)^2;
> for n from 0 to 10 do a||n:=2*int(F(x)*cos(2*n*Pi*x/T), x=alpha..beta)/T
od;
> for n from 1 to 10 do b||n:=2*int(F(x)*sin(2*n*Pi*x/T), x=alpha..beta)/T
od;
Yours
Carlos Bastero
Universidad de Navarra
Spain
|
Previous by date: [MUG] Imaginary Blues, RossAllan McKenna
Next by date: [MUG] sum(Psi(n)/n^2,n=1..infinity), etc., Marek Karliner
Previous thread: [MUG] Re: Linking Maple and Java, Bruce Char
Next thread: [MUG] sum(Psi(n)/n^2,n=1..infinity), etc., Marek Karliner
|