User:Egm4313.s12.team1.armanious/Level 2

Statement
'''K 2011 p. 491 pbs. 11 and 12 (see R6.2 Lect. 9 pgs. 26-27):''' Figure 1 Find the Fourier series expansion of f(x) as follows: Develop the Fourier series expansion of $$f(\bar{x}) \! $$ and plot for n=0,1,2,4,8. Observe this plot at points of discontinuities and the Gibbs phenomenon. Transform the variable to obtain the Fourier series expansion of $$f(x) \! $$. Do the same for $$f(\tilde{x}) \! $$ and compare to the results above.

Solution
'''Part 1: K 2011 p.491 pb. 11'''
 * {| style="width:100%" border="0"

$$  \displaystyle f(x)=x^2, (-1<x<1), p=2 $$     (2.0) The preceding function is an even function. Even functions are functions where $$f(-x)=f(x)\!$$. Odd functions on the other hand are functions where $$f(-x)=-f(x)\!$$. The Fourier series of even and odd functions can be found more easily than the Fourier series of a function that is neither even nor odd. Normal Fourier series contain both sine and cosine terms. Because of the nature of even functions, the coefficient of all sine terms in their series is zero. Likewise, all cosine terms in odd functions have a coefficient of zero. Therefore its Fourier series expansion will be of the form:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle f(x)=a_0+\sum_{n=1}^{\infty}a_n \cos \frac{n\pi}{L}x $$     (2.1) Where:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle a_0=\frac{1}{L} \int_0^Lf(x)dx $$     (2.2) And
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle a_n=\frac{2}{L} \int_0^Lf(x) \cos \frac{n\pi x}{L}dx $$     (2.3) To get the constant term of the expansion, equation (2.0) will be substituted into equation (2.2) with L=1:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle a_0=\frac{1}{1} \int_0^1x^2dx=\left [ \frac{x^3}{3} \right ]^1_0=\frac{1}{3} $$     (2.4) To get the coefficients of the rest of the terms in the expansion, equation (2.0) will be substituted into equation (2.3) with L=1:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle a_n=\frac{2}{1} \int_0^1x^2 \cos \frac{n\pi x}{1}dx=2\left [ \frac{(\pi^2n^2x^2-2)\sin (\pi n x)+2\pi n x \cos(\pi nx)}{\pi^3n^3} \right ]^1_0 $$     (2.5) Simplifying, this yields:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle a_n=\frac{4}{n^2 \pi^2} \cos n\pi $$     (2.6) Therefore, the Fourier expansion of f(x) is:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="1"

$$  \displaystyle x^2=\frac{1}{3}+\sum_{n=1}^{\infty}\left (\frac{4}{n^2 \pi^2} \cos n\pi \right ) \cos n\pi x $$ (2.7) '''Part 2: K 2011 p.491 pb. 11'''
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle f(x)=1-\frac{x^2}{4}, (-2
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle a_0=\frac{1}{2} \int_0^21-\frac{x^2}{4}dx= \frac{1}{2}\left[ x-\frac{x^3}{12} \right ]^2_0=\frac{4}{3} $$     (2.9) To get the coefficients of the rest of the terms in the expansion, equation (2.0) will be substituted into equation (2.3) with L=1:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle a_n=\frac{2}{2} \int_0^2\left (1-\frac{x^2}{4} \right ) \cos \frac{n\pi x}{2}dx=\left [ \frac{(8-\pi^2n^2(x^2-4))\sin\frac{n\pi x}{2}-4n\pi x\cos\frac{n\pi x}{2}}{2\pi^3n^3} \right ]^2_0 $$     (2.10) Simplifying, this yields:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle a_n=\frac{-4\cos(n\pi)}{n^2 \pi^2} $$     (2.11) Therefore, the Fourier expansion of f(x) is:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="1"

$$  \displaystyle 1-\frac{x^2}{4}=\frac{4}{3}+\sum_{n=1}^{\infty}\left (\frac{-4\cos(n\pi)}{n^2 \pi^2} \right ) \cos \frac{n\pi x}{2} $$     (2.12) Part 3 The Fourier series expansion of the function f(x) in Figure 1 can be found in one of two ways. The first way involves transforming x in the following way:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \bar x=x-\frac54 $$     (2.13) The resulting function is now an even function that alternates between the constant value A and zero and has period 4. Using the same methods used above, the Fourier series of the function can be found. The constant coefficient of the series is found by:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \bar a_0=\frac12 \int_0^2f(x)dx=\frac12 \int_0^1Adx+\frac12 \int_1^20dx=1/2\left [ Ax \right ]_0^1=\frac A2 $$ (2.14) Note that because the function is discontinuous at the midpoint, the integral must be split into two different integrals. The coefficients of the cosine terms of the series can be found by:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \bar a_n=\frac22 \int_0^2f(x)\cos \frac{n\pi x}{2}dx= \int_0^1A\cos \frac{n\pi x}{2}dxdx+\frac12 \int_1^20dx=\left [ \frac{2A}{n\pi}\sin\frac{n\pi x}{2} \right ]_0^1=\frac{2A}{n\pi}\sin \frac{n\pi}{2} $$     (2.15) Therefore, the Fourier series for the transformed function is:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="1"

$$  \displaystyle f(\bar x)=\frac A2 + \sum_{n=0}^{\infty} \left ( \frac{2A}{n\pi}\sin\frac{n\pi}{2} \right )\left ( \cos \frac{n\pi\bar x}{2} \right ) $$     (2.16) Through a change in variables, the Fourier series of the original function, f(x), can be found:
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="1"

$$  \displaystyle f(x)=\frac A2 + \sum_{n=0}^{\infty} \left ( \frac{2A}{n\pi}\sin\frac{n\pi}{2} \right )\left ( \cos \frac{n\pi(x-1.25)}{2} \right ) $$     (2.17) The following figure shows a plot of $$f(\bar x)\!$$ with its truncated Fourier series for n=0,1.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Figure 2 Figure 3 shows the same plot with more values of n:

Note that all plots assume that A=1. It should be noted that the accuracy of the expansion increases with an increase in the number of terms in the expansion. Also, there is strong fluctuation at points of discontinuity. These fluctuations are apparent even at high values of n, but they decrease in size and move closer to the points of discontinuity. This is a property of Fourier series known as the Gibbs phenomenon. The other method of developing the Fourier series is to transform the function into an odd function. This can be done by transforming both the independent variable and overall function as follows:
 * {| style="width:100%" border="0"

$$  \displaystyle \tilde x=x-\frac14 $$     (2.18)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle f(\hat x)=f(\tilde x)-\frac A2 $$ (2.19) An odd function has a Fourier series expansion of the form:
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle f(x)=\sum_{n=0}^{\infty}b_n\sin \frac{n\pi x}{L} $$     (2.20) Where:
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle b_n=\frac2L\int_{0}^{L}f(x)\sin \frac{n\pi x}{L}dx $$     (2.21) Applying this to the transformed function, with L=2:
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \hat b_n=\frac22\int_{0}^{2}f(x)\sin \frac{n\pi \hat x}{2}d\hat x=\int_{0}^{2}\frac A2\sin \frac{n\pi \hat x}{2}d\hat x=\left [ -\frac{A}{n\pi}\cos\frac{n\pi\hat x}{2} \right ]^2_0=\frac{A}{n\pi}(1-\cos n\pi) $$     (2.22) The Fourier series is therefore:
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle f(\hat x)=\sum_{n=0}^{\infty}\left (\frac{A}{n\pi}(1-\cos n\pi) \right )\left ( \sin\frac{n\pi\hat x}{2} \right ) $$     (2.23)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="1"

$$  \displaystyle f(\tilde x)=\frac A2+\sum_{n=0}^{\infty}\left (\frac{A}{n\pi}(1-\cos n\pi) \right )\left ( \sin\frac{n\pi\tilde x}{2} \right ) $$     (2.24)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="1"

$$  \displaystyle f(x)=\frac A2+\sum_{n=0}^{\infty}\left (\frac{A}{n\pi}(1-\cos n\pi) \right )\left ( \sin\frac{n\pi(x-0.25)}{2} \right ) $$     (2.25) The following figure shows a plot of $$f(\tilde x)\!$$ with its truncated Fourier series for n=0,1.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Figure 4 Note that all plots assume A=1. The accuracy of the expansion as shown on the plot is expected given the low number of terms used in the expansion. As Figure 3 shows, if the number of terms used to form the plot in Figure 4 is increased, the accuracy of the expansion will greatly increase (but more slowly at points of discontinuity because of the Gibbs phenomenon). This level of accuracy is shown in Figure 5, which contains the expansion to 100 and 200 terms.

Author
Solved and Typed By - Egm4313.s12.team1.armanious (talk) 14:53, 16 April 2012 (UTC) Reviewed By - Egm4313.s12.team1.armanious (talk) 14:53, 16 April 2012 (UTC)