alan
(Alan Smith)
October 9, 2015, 12:14am
1
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
sblinder
(S M Blinder)
October 9, 2015, 4:32am
2
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)
alan
(Alan Smith)
October 9, 2015, 4:45am
3
Thanks, that specifies the function, but I want the output in the form: Sum (n=0 t inf) (sin x)/n ?
sblinder
(S M Blinder)
October 9, 2015, 4:54am
4
Thanks, that specifies the function, but I want the output in the form: Sum (n=0 t inf) (sin x)/n ?
sblinder
(S M Blinder)
October 9, 2015, 4:58am
5
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
alan
(Alan Smith)
October 9, 2015, 7:20am
6
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 …