User:Egm4313.s12.team8.koester/R6.3

Problem
K 2011 p. 491 numbers 15 and 17

-State whether the function is even, odd, or neither

-Find it's Fourier series

-Plot the truncated Fourier series for n = 2, 4, and 8

Solution to #15
$$ \displaystyle f(x)=-x-\pi $$ on $$ \displaystyle (-\pi,-\pi/2) $$

$$ \displaystyle f(x)=x $$ on $$ \displaystyle (-\pi/2,\pi/2) $$

$$ \displaystyle f(x)=-x+\pi $$ on $$ \displaystyle (\pi/2,\pi) $$

This function is an odd function.

This is proven by the fact that $$ \displaystyle f(-x)=-f(x) $$

Since this is an odd function and of period $$ \displaystyle 2\pi $$ its Fourier series reduces to the Fourier sine series shown here:

$$ \displaystyle f(x)=\sum_{n = 1}^{\infty} b_n\sin(nx) $$

Where the coefficient equals:

$$ \displaystyle b_n=\frac{2}{\pi}\int_{0}^{\pi}f(x)\sin(nx)dx $$

$$ \displaystyle b_n=\frac{2}{\pi}(\int_{0}^{\pi/2}x\sin(nx)dx + \int_{\pi/2}^{\pi}(-x+\pi)\sin(nx)dx) $$

$$ \displaystyle b_n=\frac{2}{\pi}(\int_{0}^{\pi/2}x\sin(nx)dx - \int_{\pi/2}^{\pi}x\sin(nx)dx + \int_{\pi/2}^{\pi}\pi\sin(nx)dx) $$

Using integration by parts and then cancelling like terms:

$$ \displaystyle b_n=\frac{2}{\pi}(\frac{2\sin(\frac{\pi}{2}n)}{n^2}) $$

Plugging this back into the function equation:

$$ \displaystyle f(x)=\sum_{n = 1}^{\infty}(\frac{4\sin(\frac{\pi}{2}n)}{\pi n^2})\sin(nx) $$

Expanding this, one obtains:

$$ \displaystyle f(x)=\frac{4}{\pi}(\sin x-\frac{1}{9}\sin3x+\frac{1}{25}\sin5x-...) $$

If n=2

$$ \displaystyle f(x)=\frac{4}{\pi}(\sin x) $$

If n=4

$$ \displaystyle f(x)=\frac{4}{\pi}(\sin x-\frac{1}{9}\sin3x) $$

If n=8

$$ \displaystyle f(x)=\frac{4}{\pi}(\sin x-\frac{1}{9}\sin3x+\frac{1}{25}\sin5x-\frac{1}{49}\sin7x) $$

Solution to #17
$$ \displaystyle f(x)=x+1 $$ on $$ \displaystyle (-1,0) $$

$$ \displaystyle f(x)=-x+1 $$ on $$ \displaystyle (0,1) $$

This function is an even function.

This is proven by the fact that $$ \displaystyle f(-x)=f(x) $$

Since this is an even function and of period 2 its Fourier series reduces to the Fourier cosine series shown here:

$$ \displaystyle f(x)=a_0 + \sum_{n = 1}^{\infty} a_n\cos(n\pi x) $$

Where the coefficients are equal to:

$$ \displaystyle a_0=\int_{0}^{1}f(x)dx $$

$$ \displaystyle a_n=2\int_{0}^{1}f(x)\cos(n\pi x)dx $$

$$ \displaystyle a_0=\int_{0}^{1}(1-x) $$

$$ \displaystyle a_0=\frac{1}{2} $$

$$ \displaystyle a_n=2\int_{0}^{1}(1-x)\cos(n\pi x)dx $$

$$ \displaystyle a_n=2(\int_{0}^{1}\cos(n\pi x)dx - \int_{0}^{1}x\cos(n\pi x)dx ) $$

Using integration by parts and evaluating on the interval:

$$ \displaystyle a_n=2(\frac{1-\cos(n\pi)}{n^{2} \pi^{2}}) $$

Plugging this back into the function equation:

$$ \displaystyle f(x)=\frac{1}{2} + \sum_{n = 1}^{\infty} \frac{2-2\cos(n\pi)}{n^{2} \pi^{2}} \cos(n\pi x) $$

Expanding this, one obtains:

$$ \displaystyle f(x)=\frac{1}{2} + \frac{4}{\pi^2}(\cos \pi x+ \frac{1}{9}\cos3 \pi x+ \frac{1}{25}\cos5\pi x+...) $$

If n=2

$$ \displaystyle f(x)=\frac{1}{2} + \frac{4}{\pi^2}(\cos \pi x) $$

If n=4

$$ \displaystyle f(x)=\frac{1}{2} + \frac{4}{\pi^2}(\cos \pi x+ \frac{1}{9}\cos3 \pi x) $$

If n=8

$$ \displaystyle f(x)=\frac{1}{2} + \frac{4}{\pi^2}(\cos \pi x+ \frac{1}{9}\cos3 \pi x+ \frac{1}{25}\cos5\pi x+ \frac{1}{49}\cos7\pi x) $$

Plots
15. Matlab Code

>> x=linspace(-pi,pi)

>> y2=(4/pi)*sin(x)

>> y4=(4/pi)*(sin(x)-(1/9)*sin(3*x))

>> y8=(4/pi)*(sin(x)-(1/9)*sin(3*x)+(1/25)*sin(5*x)-(1/49)*sin(7*x))

>> plot(x,y2,x,y4,x,y8)

Where y2 is blue, y4 is green and y8 is red



17. Matlab Code

>> x=linspace(-1,1)

>> f2=.5+(4/pi^2)*cos(pi*x)

>> f4=.5+(4/pi^2)*(cos(pi*x)+(1/9)*cos(3*pi*x))

>> f8=.5+(4/pi^2)*(cos(pi*x)+(1/9)*cos(3*pi*x)+(1/25)*cos(5*pi*x)+(1/49)*cos(7*pi*x))

>> plot(x,f2,x,f4,x,f8)

Where f2 is blue, f4 is green and f8 is red