Wolframalpha find Fourier series

11.1k Views Asked by At

Is there a way to write down the following in Wolframalpha?

$$f(x)=\begin{cases}1-x,& 0\leqslant x\leqslant 1\\ 0,&1\lt x\leqslant2\end{cases}.$$

2

There are 2 best solutions below

0
On BEST ANSWER

Sure:

Piecewise[{{1-x, 0<=x<1}, {0, 1<x<=2}}]

enter image description here

0
On

you're Probably looking for:

ExptoTrig[FourierSeries[Piecewise[{{1-x/Pi,0<x<Pi},{0,-Pi<x<0}}],x,5]]
  • Piecewise gives your desired function as noted by Mark McClure, assuming you want the function that repeats the behavior on $[2,4]$ you have to adjust the function becaus wolfram takes $f$ on $[-\pi,\pi]$ and expands it (the result has to be rescaled again to fit on $[0,2]$ properly )
  • FourierSeries[.,x,5] gives you the series of degree 5
  • ExptoTrig gives you the result in trig-form (exp is default)