Message Boards Message Boards

0
|
5242 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to find a fourier series of a sawtooth function?

Posted 9 years ago

I want to check my solution to this, the problem is

f(x) =\left{ -\frac{1}{2} (\pi+x), -\pi \le x < 0 , and \frac{1}{2} (\pi-x),0 < x \le \pi \right}

I have no idea how to write this so I can solve it in Mathematica?

I can't even write it here - it always looks OK in preview, but looses part of the eqtn when posted, which is why I took the $'s out

Thanks

POSTED BY: Alan Smith
5 Replies
Posted 9 years ago

Thanks SM, that's much closer. Should I conclude that there is nothing in Wolfram that would return a simplified/rationalised solution? In this case I was checking a result that I knew was at least close, but - for example - if I wanted a simple function out of a Fourier expansion rather than doing it analytically, I probably wouldn't know anything about it's likely form ....

POSTED BY: Alan Smith

You could try

In[7]:= FourierSinSeries[f[x], x, 5]

Out[7]= Sin[x] + 1/2 Sin[2 x] + 1/3 Sin[3 x] + 1/4 Sin[4 x] + 
 1/5 Sin[5 x]

This implies that f(x)=Sum(n=1 to infinity) sin(nx)/n

POSTED BY: S M Blinder

Thanks, that specifies the function, but I want the output in the form: Sum (n=0 t inf) (sin x)/n ?

POSTED BY: S M Blinder
Posted 9 years ago

Thanks, that specifies the function, but I want the output in the form: Sum (n=0 t inf) (sin x)/n ?

POSTED BY: Alan Smith

You are using Latex coding, which doesn't work in Mathematica.

Here is the way to define your function in Mathematica:

f[x_]:=Which[-Pi<=x<0,-1/2 (Pi+x), 0<x<=Pi,1/2 (Pi-x)]

You can plot this to see your sawtooth function. Plot[f[x], {x, -Pi, Pi}]

and you can find the Fourier transform

In[3]:= FourierTransform[f[x], x, k]

Out[3]= (E^(-I k \[Pi]) - E^(I k \[Pi]) + 2 I k \[Pi])/(2 k^2 Sqrt[
 2 \[Pi]])

Or if you want the complex Fourier series up to n=3

In[6]:= FourierSeries[f[x], x, 3]

Out[6]= 1/2 I E^(-I x) - 1/2 I E^(I x) + 1/4 I E^(-2 I x) - 
 1/4 I E^(2 I x) + 1/6 I E^(-3 I x) - 1/6 I E^(3 I x)
POSTED BY: S M Blinder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract