1

I got

$$ f(x)=\begin{cases}-\dfrac{\pi}{2},& -\pi<x\le-\dfrac{\pi}{2}\\[1ex] \phantom{-} x,&-\dfrac{\pi}{2}<x\le\dfrac{\pi}{2} \\[1ex] \phantom{-}\dfrac\pi2,&\phantom{-}\dfrac{\pi}{2}<x\le\pi\end{cases}$$

Period is $2\pi$, which means $L$ is $\pi.$

Since this is an odd function, I need to find $b_n$, multiply that with $\sin\left(\frac{n\pi x}L\right)$ and that should be my series.

But I'm not sure if what I got is correct. I can't seem to be able to paste it into WolframAlpha with more than a few terms, either. The function itself is pretty straight forward, so you guys can probably see where I've gone wrong if I have!

Fourier series for an odd function should be $\sum\limits_{n=1}^\infty b_n \sin\left(\frac{n\pi x}L\right)$.

$$\sum_{n=1}^\infty \left(\frac{\sin\left(\frac{n\pi}2\right)}{n^2}-\frac{\pi\cos\left(\frac{n\pi}{2}\right)}{2n}+\frac{(-1)^n \pi}{2n}-\frac{\pi\cos\left(\frac{n\pi}{2}\right)}{2n} \right) \sin\left(\frac{n\pi x}\pi\right)$$

So, any fast math guys that can tell me where I should end up?

user170231
  • 19,334
Jakke
  • 99
  • First, $;\frac{n\pi x}\pi=nx;$ , so simply write $;\sin nx;$ . This will make things clearer. Then, show your integral evaluating $;b_n;$ ...It depends on what orthonormal basis you choose that will have this or that constant factor multiplying the integral defining $;b_n;$ .Many times it is just $;\frac1L=\frac1\pi;$ ... – DonAntonio Mar 08 '21 at 16:24

1 Answers1

2

$$\begin{align} b_n&=\frac1\pi\int_{-\pi}^\pi f(x)\sin(nx)\,\mathrm dx\\[1ex] &=-\frac12\int_{-\pi}^{-\frac\pi2}\sin(nx)\,\mathrm dx+\frac1\pi\int_{-\frac\pi2}^{\frac\pi2}x\sin(nx)\,\mathrm dx+\frac12\int_{\frac\pi2}^\pi\sin(nx)\,\mathrm dx\\[1ex] &=\frac1\pi\int_{-\frac\pi2}^{\frac\pi2}x\sin(nx)\,\mathrm dx+\int_{\frac\pi2}^\pi\sin(nx)\,\mathrm dx\\[1ex] &=\frac{2\sin\left(\frac{n\pi}2\right)-n\pi \cos\left(\frac{n\pi}2\right)}{n^2\pi}+\frac{\cos\left(\frac{n\pi}2\right)-\cos(n\pi)}n\\[1ex] &=\frac{2\sin\left(\frac{n\pi}2\right)}{n^2\pi}-\frac{\cos(n\pi)}n\\[1ex] &=\frac{2\sin\left(\frac{n\pi}2\right)}{n^2\pi}-\frac{(-1)^n}n\\[1ex] &=\begin{cases}\dfrac{2\sin\left(\frac{2k\pi}2\right)}{(2k)^2\pi}-\dfrac{(-1)^{2k}}{2k}&n=2k\\[1ex] \dfrac{2\sin\left(\frac{(2k-1)\pi}2\right)}{(2k-1)^2\pi}-\dfrac{(-1)^{2k-1}}{2k-1}&n=2k-1\end{cases}\\[1ex] &=\begin{cases}-\dfrac1{2k}&n=2k\\[1ex] \dfrac{2(-1)^{k+1}}{(2k-1)^2\pi}+\dfrac1{2k-1}&n=2k-1\end{cases} \end{align}$$

where $k\ge1$ is a positive integer.

user170231
  • 19,334
  • 1
    and also $\sin\cfrac{n\pi}2=(-1)^k;$, where $;n=2k-1;,;;k\in\Bbb Z$ , or what is the same $$;\sin\cfrac{n\pi}2=\begin{cases}(-1)^{(n+1)2},&\text{if};\frac{n+1}2\in\Bbb Z\{}\0,&\text{otherwise}\end{cases};$$ – DonAntonio Mar 08 '21 at 17:13
  • We were taught to use $b_n \frac{2}{L}$ and integrate from 0 to L instead of -L to L, as the function would be identical just opposite (going negative in both X and Y), any reason not to do that, or is just personal preference? – Jakke Mar 08 '21 at 18:18
  • Sure, you can do that. $f(x)\sin(nx)$ is even for any integer $n$, so the integral to the left of $x=0$ is equal to the one to the right. – user170231 Mar 08 '21 at 20:31
  • I might be to stupid for this math level, but if we've only learned to replace $n$ with $m$ to get $2m+1$ (for example), this seems way above anything we've been taught to do. Can you simplify this a tad for dumb me? :D If we take $\frac{2sin(\frac{πn}{2})}{n^2π}-\frac{(-1)^n}{n}$ as our starting point as $b_n$. – Jakke Mar 09 '21 at 16:58
  • 1
    It's just a matter of splitting $b_n$ into cases of even and odd $n$. If $n$ is even, then it is a multiple of $2$, so $n=2k$ for some integer $k$. Odd numbers occur in between, so are captured by $n=2k-1$. The point of this is to simplify $\sin\left(\frac{n\pi}2\right)$, which follows the pattern ${1,0,-1,0,1,0,-1,0,\ldots}$ and while you could come up with a rule for this sequence, it's easier to do so if you split up into cases first. – user170231 Mar 09 '21 at 17:14
  • 1
    You could finish with$$b_n=\frac{2\sin\left(\frac{n\pi}2\right)}{n^2\pi}-\frac{(-1)^n}n$$and$$f(x)=\sum_{n\ge1}b_n\sin(nx)$$Or, after splitting up into the cases above,$$f(x)=\sum_{k\ge1}\left(b_{2k}\sin(2kx)+b_{2k-1}\sin((2k-1)x\right)$$ – user170231 Mar 09 '21 at 17:17
  • I tried to just enter the whole series with n=1 to 12 into WolframAlpha, and that looks very similar to what I'm after, that is $b_n sin(nx)$. Since we haven't learned how to split it up, I'll go for that! Cheers for the help, not sure I understand this well enough, but that's an issue for the future! – Jakke Mar 09 '21 at 20:09