Egm4313.s12.team11.R7

From Wikiversity
Jump to: navigation, search

Contents

Report 7 [edit]

Intermediate Engineering Analysis
Section 7566
Team 11
Due date: April 25, 2012.

R7.1 [edit]

Solved by Andrea Vargas

Problem Statement [edit]

Verify (4)-(5) pg 19-9:
(4) \langle \phi_i, \phi_j \rangle = 0\! for i \ne j\!
(5) \langle \phi_j, \phi_j \rangle =\frac{L}{2}\! for i = j\!

Solution [edit]

From the lecture notes on p.19-9 we know that:
(2) \phi_i=\sin(\omega_i x)\!
(3) \langle \phi_i, \phi_j \rangle =\int_0^L \phi_i(x) \phi_j(x) dx\!

Then, we have
\langle \phi_i, \phi_j \rangle =\int_0^L \phi_i(x) \phi_j(x) dx=\int_0^L sin(\omega_i x) \sin(\omega_j x)dx\!

Since the period of \sin(x)\! is  2\pi\! and we know that p=2L\!, we can assume that L=\pi\! for simplicity.

We can compute the result of the previous integral using Wolfram ALpha (Mathematica software). The following is the input given to the software:
int from 0 to pi sin(ax)sin(bx)

where a is \omega_i\! and b is \omega_j\!. The software generates the following answer:

\int_0^L \sin(ax)sin(bx)= \frac{b \sin(\pi a)\cos(\pi b)-a \cos(\pi a)\sin(\pi b)}{a^2-b^2}\!

Substituting for  \omega_i \! and  \omega_j\!:
\int_0^L \sin(ax)sin(bx)= \frac{\omega_j \sin(\pi \omega_i)\cos(\pi \omega_j)-\omega_i \cos(\pi \omega_i)\sin(\pi \omega_j)}{\omega_i^2-\omega_j^2}\!
We also know that \sin(c\pi)=0\! where c is any integer. We can cancel any terms with \sin(\pi \omega_i)\! or \sin(\pi \omega_j)\! as they are equal to zero.
Then, we can verify:

                         (4)  \langle \phi_i, \phi_j \rangle = 0\! for i \ne j\!

Similarly we can verify (5).
We have
\langle \phi_j, \phi_j \rangle =\int_0^L \phi_j(x) \phi_j(x) dx=\int_0^L sin(\omega_j x) \sin(\omega_j x)dx\!

Here, we will keep the integration boundaries as 0\rightarrow L\! to be consistent with the problem statement.

We can compute the result of the previous integral using Wolfram ALpha (Mathematica software). The following is the input given to the software:
int 0 to L (sin(ax))^2

where a is \omega_j\!. The software generates the following answer:

\int_0^L \sin(ax)^2=\frac{L}{2} - \frac{\sin(2aL)}{4a}\!

Substituting for  \omega_j \!:
\int_0^L \sin(ax)^2=\frac{L}{2} - \frac{\sin(2L\omega_j)}{4\omega_j}\!

We know from the previous explanation that L=\pi\!.So,we can apply the same assumption as before that \sin(c\pi)=0\! where c is any integer. This allows us to cancel any terms with sin(2L\omega_j)\! as they are equal to zero.
Then, we can verify:

                         (5)  \langle \phi_j, \phi_j \rangle = \frac{L}{2}\! for i = j\!

R7.2 [edit]

Solved by Francisco Arrieta

Problem Statement [edit]

Plot the truncated series  u(x,t)=\sum_{j=1}^{n}a_j\cos C\omega_j t \sin \omega_j x \! with  n=5 \! and for:

 t=\alpha P_1=\alpha \frac{2\pi}{C\omega_1}=\alpha \frac{2L}{C} \!

 \alpha=0.5, 1, 1.5, 2 \!

Solution [edit]

Using:

 
\left\{\begin{matrix} f(x)=x(x-2)
\\ g(x)=0
\\ C=3
\\ L=4 

\end{matrix}\right.
\!


Then:

 a_j=\frac{2}{L}\int_{0}^{L}f(x)\sin \omega_j x dx \!

 =2\left [ \frac{(-1)^j-1}{\pi^3j^3} \right ] \!

 \therefore a_j=0 \! for all even values of j


Plugging back to the truncated series:

 u(x,t)=\sum_{j=1}^{n}2\left [ \frac{(-1)^j-1}{\pi^3j^3} \right ]\cos [C \frac{j\pi}{L} \alpha \frac{2L}{C}] \sin[\frac{j\pi}{L}x] \!

 =\sum_{j=1}^{n}2\left [ \frac{(-1)^j-1}{\pi^3j^3} \right ]\cos (\alpha j2\pi) \sin(\frac{j\pi}{2}x) \!


For  n=5 \! :

 u(x,t)=[\frac{-4}{\pi^3}\cos (2\pi \alpha) \sin(\frac{\pi x}{2})]+[\frac{-4}{27\pi^3}\cos (6\pi \alpha) \sin(\frac{3\pi x}{2})]+[\frac{-4}{125\pi^3}\cos (10\pi \alpha) \sin(\frac{5\pi x}{2})] \!

When  \alpha=0.5 \! :

Ahalf.jpg

When  \alpha=1 \! :

Aone.jpg

When  \alpha=1.5 \! :

Aonehalf.jpg

When  \alpha=2 \! :

Atwo.jpg

--Egm4313.s12.team11.arrieta (talk) 06:20, 22 April 2012 (UTC)

R7.3 [edit]

Problem Statement [edit]

Find (a) the scalar product, (b) the magnitude of f\! and g\! ,(c) the angle between f\! and g\! for:

1) f(x)=cos(x), \ g(x)=x \ for -2 \le x \le 10\!

2) f(x)=\frac{1}{2}(3x^2-1), \ g(x)=\frac{1}{2}(5x^3-3x) \ for -1 \le x \le 1\!

Part 1 [edit]

solved by Kyle Gooding

Scalar Product [edit]

<f,g>=\int_a^bf(x)g(x) \ dx\!

<f,g>=\int_{-2}^{10}x\cos(x) \ dx\!

Using integration by parts;

<f,g>=[x\sin(x)+\cos(x)]_{-2}^{10}

                      <f,g>=-7.68\!
Magnitude [edit]

\| f \|=<f,f>^{1/2}=\int_{a}^{b} f^2(x) \ dx\!

=\int_{-2}^{10} [\cos(x)]^2 \ dx\!

=[.5(x+\sin(x)\cos(x)|_{-2}^{10}]^{1/2}

                       \| f \| =2.457\!

\| g \|=\int_{a}^{b} g^2(x) \ dx\!

=\int_{-2}^{10}x^2 \ dx
=[x^{3}/3]_{-2}^{10}

                       \| g \| =\frac{1008}{3}\!
Angle Between Functions [edit]

cos(\theta)=\frac{<f,g>}{\| f \| \| g \|}\!

cos(\theta)=\frac{-7.68}{\frac{1008}{3}(2.457)}

                      \theta=89.47
The two functions are nearly orthogonal.

Part 2 [edit]

solved by Luca Imponenti

Scalar Product [edit]

<f,g>=\int_a^bf(x)g(x) \ dx\!

<f,g>=\int_{-1}^{1}[\frac{1}{2}(3x^2-1)][\frac{1}{2}(5x^3-3x)] \ dx\!

=\int_{-1}^{1}\frac{1}{4}(15x^5-4x^3+3x) \ dx\!
=\left. \frac{1}{4}(\frac{15}{6}x^6-x^4+\frac{3}{2}x^2)\right|_{-1}^{1}\!
=\frac{1}{4}[(\frac{15}{6}1^6-1^4+\frac{3}{2}1^2)-(\frac{15}{6}(-1)^6-(-1)^4+\frac{3}{2}(-1)^2)]\!

Since all exponents are even, everything in brackets cancels out

                      <f,g>=0\!
Magnitude [edit]

\| f \|=<f,f>^{1/2}=\int_{a}^{b} f^2(x) \ dx\!

=\int_{-1}^{1} [\frac{1}{2}(3x^2-1)]^2 \ dx\!
=\int_{-1}^{1} \frac{1}{4}(9x^4-6x^2+1) \ dx\!
=\left. \frac{1}{4}(\frac{9}{5}x^5-2x^3+x)\right|_{-1}^{1}\!
=\frac{1}{4}[(\frac{9}{5}1^5-2(1)^3+1)-(\frac{9}{5}(-1)^5-2(-1)^3+(-1))]\!
=\frac{1}{4}[\frac{4}{5}-(-\frac{4}{5})]\!
                       \| f \| =\frac{2}{5}\!

\| g \|=\int_{a}^{b} g^2(x) \ dx\!

=\int_{-1}^{1} [\frac{1}{2}(5x^3-3x)]^2 \ dx\!
=\int_{-1}^{1} \frac{1}{4}(25x^6-30x^4+9x^2) \ dx\!
=\left. \frac{1}{4}(\frac{25}{7}x^7-6x^5+3x^3)\right|_{-1}^{1}\!
=\frac{1}{4}[(\frac{25}{7}1^7-6(1)^5+3(1)^3)-(\frac{25}{7}(-1)^7-6(-1)^5+3(-1)^3)]\!
=\frac{1}{4}[\frac{4}{7}-(-\frac{4}{7})]\!
                       \| g \| =\frac{2}{7}\!
Angle Between Functions [edit]

cos(\theta)=\frac{<f,g>}{\| f \| \| g \|}\!

Since <f,g>=0\! the two functions are orthogonal

                         \theta=90\!

R7.4 [edit]

Solved by Gonzalo Perez

K 2011 pg.482 pb. 6 [edit]

Problem Statement [edit]

Sketch or graph  f(x) \! which for  -\pi < x < \pi \! is given as follows:

 f(x) = \left | x \right | \!

Solution [edit]

The MATLAB code shown below was used to developed the graph of  f(x) = \left | x \right | \! :

File:Problem6.jpg

File:Problem6graph.jpg

K 2011 pg.482 pb. 9 [edit]

Problem Statement [edit]

Sketch or graph  f(x) \! which for  -\pi < x < \pi \! is given as follows:

 f(x)=\left\{\begin{matrix}
x, if: -\pi<x<0\\ 

\pi - x, if: 0<x<\pi
\end{matrix}\right. \!

Solution [edit]

The MATLAB code shown below was used to developed the graph of the piecewise function  f(x)=\left\{\begin{matrix}
x, if: -\pi<x<0\\ 

\pi - x, if: 0<x<\pi
\end{matrix}\right. \! :

File:Problem9.jpg

File:Problem9graph.jpg



Solved by Jonathan Sheider

K 2011 p.482 pb. 12 [edit]

Problem Statement [edit]

Find the Fourier series of the given function which is assumed to have a period of  2 \pi \!. Show the details of your work.
Sketch or graph the partial sums up to that including  cos(5x) \! and  sin(5x) \!

Given:

f(x) = |x| \!

Solution [edit]

The Fourier series of a function with a period of  p = 2\pi \! is defined:

 f(x) = a_{0} + \sum_{n=1}^{\infty } (a_{n}cos(nx) + b_{n}sin(nx))\!

Where:

 a_{0} = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x) dx \!
 a_{n} = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) cos(nx) dx \!
 b_{n} = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) sin(nx) dx \!

This particular function given in the problem can be also defined in a piecewise manner over this interval, namely:

 f(x) = \left\{\begin{matrix} 
-x \text{ if } -\pi \leq x \leq 0\\x \text{ if } 0 \leq x \leq \pi 
\end{matrix}\right.
\!

Calculating the first term  a_{0} \!:

 a_{0} = \frac{1}{2\pi} \left ( \int_{-\pi}^{0} -x dx + \int_{0}^{\pi} x dx \right) \!
 a_{0} = \frac{1}{2\pi} \left ( \left [\frac{-x^2}{2} \right ]_{-\pi}^{0} + \left [\frac{x^2}{2} \right ]_{0}^{\pi} \right)\!
 a_{0} = \frac{1}{2\pi} \left ( - \left(\frac{-\pi^2}{2}\right ) + \left (\frac{\pi^2}{2}\right)\right) \!
 a_{0} = \frac{1}{2\pi} (\pi^2) \!

                                                          a_{0} = \frac{\pi}{2} \!


Calculating the coefficient  a_{n} \!:

 a_{n} = \frac{1}{\pi} \left( \int_{-\pi}^{0} -x cos(nx) dx + \int_{0}^{\pi} x cos(nx) dx \right ) \!
 a_{n} = \frac{1}{\pi} \left( - \int_{-\pi}^{0} x cos(nx) dx + \int_{0}^{\pi} x cos(nx) dx \right ) \!

Using integration by parts with the following substitutions:

 u = x \! and therefore  du = dx \!
 dv = cos(nx)dx \! and therefore  v = \frac{1}{n}sin(nx) \!

This yields for the integral:

 a_{n} = \frac{1}{\pi} \left( -\left[\frac{1}{n} x sin(nx) - \int \frac{1}{n}sin(nx)dx \right]_{-\pi}^{0} + \left[\frac{1}{n} x sin(nx) - \int \frac{1}{n}sin(nx)dx \right]_{0}^{\pi} \right ) \!
 a_{n} = \frac{1}{\pi} \left( -\left[\frac{1}{n} x sin(nx) + \frac{1}{n^2}cos(nx) \right]_{-\pi}^{0} + \left[\frac{1}{n} x sin(nx) + \frac{1}{n^2}cos(nx) \right]_{0}^{\pi} \right ) \!
 a_{n} = \frac{1}{\pi} \left( -\left[\frac{1}{n^2} - \left (\frac{1}{n} (-\pi) sin(-n\pi) + \frac{1}{n^2}cos(-n \pi) \right) \right] + \left[\frac{1}{n} \pi sin(n\pi) + \frac{1}{n^2}cos(n\pi) - \frac{1}{n^2} \right] \right ) \!

Note that for all n = 1,2,3... :  sin(n\pi) = 0 \! as  sin(\pi) = sin(2\pi) = sin(3\pi) ... = 0 \! therefore these terms are evaluated as zero, which yields:

 a_{n} = \frac{1}{\pi} \left( -\left[\frac{1}{n^2} - \left (0 + \frac{1}{n^2}cos(-n \pi) \right) \right] + \left[0 + \frac{1}{n^2}cos(n\pi) - \frac{1}{n^2} \right] \right ) \!
 a_{n} = \frac{1}{\pi} \left( -\frac{1}{n^2} + \frac{1}{n^2}cos(-n \pi)  +  \frac{1}{n^2}cos(n\pi) - \frac{1}{n^2} \right ) \!

Note that  cos(-x) = cos(x) \! therefore:

 a_{n} = \frac{1}{\pi} \left( -\frac{1}{n^2} + \frac{1}{n^2}cos(n \pi)  +  \frac{1}{n^2}cos(n\pi) - \frac{1}{n^2} \right ) \!
 a_{n} = \frac{1}{\pi} \left( -\frac{2}{n^2} + \frac{2}{n^2}cos(n \pi) \right ) \!
 a_{n} = \frac{1}{\pi} \left (\left ( -\frac{2}{n^2} \right )(1 - cos(n \pi) \right )\!
 a_{n} = -\frac{2}{n^2\pi} \left (1 - cos(n \pi) \right )\!

To evaluate the term  (1-cos(n\pi)) \!:

Note that  cos(n\pi) = -1 \! for odd n values as  cos(\pi) = cos(3\pi) = cos(5\pi) ... = -1 \!

And that  cos(n\pi) = 1 \! for even n values as  cos(2\pi) = cos(4\pi) = cos(6\pi) ... = 1 \!.

Therefore, it can be concluded that for odd n values:

 (1-cos(n\pi)) = 1-(-1) = 2 \!

And for even n values:

 (1-cos(n\pi) = 1-(1) = 0 \!

Therefore, for the coefficient   a_{n} \!, all even terms will equal zero while all odd terms will have a multiplier of 2, this yields (for all odd n values):

                                             a_{n} = -\frac{4}{n^2\pi} \text{  for  } n = 1,3,5... \!


Calculating the coefficient  b_{n} \!:

 b_{n} = \frac{1}{\pi} \left( \int_{-\pi}^{0} -x sin(nx) dx + \int_{0}^{\pi} x sin(nx) dx \right ) \!
 b_{n} = \frac{1}{\pi} \left( - \int_{-\pi}^{0} x sin(nx) dx + \int_{0}^{\pi} x sin(nx) dx \right ) \!

Using integration by parts with the following substitutions:

 u = x \! and therefore  du = dx \!
 dv = sin(nx)dx \! and therefore  v = \frac{-1}{n}cos(nx) \!

This yields for the integral:

 b_{n} = \frac{1}{\pi} \left( -\left[\frac{-1}{n} x cos(nx) - \int \frac{-1}{n}cos(nx)dx \right]_{-\pi}^{0} + \left[\frac{-1}{n} x cos(nx) - \int \frac{-1}{n}cos(nx)dx \right]_{0}^{\pi} \right ) \!
 b_{n} = \frac{1}{\pi} \left( -\left[\frac{-1}{n} x cos(nx) + \frac{1}{n^2}sin(nx) \right]_{-\pi}^{0} + \left[\frac{-1}{n} x cos(nx) + \frac{1}{n^2}sin(nx) \right]_{0}^{\pi} \right ) \!
 b_{n} = \frac{1}{\pi} \left( -\left[0 - \left (\frac{-1}{n} (-\pi) cos(-n\pi) + \frac{1}{n^2}sin(-n \pi) \right) \right] + \left[\frac{-1}{n} \pi cos(n\pi) + \frac{1}{n^2}sin(n\pi) - 0 \right] \right ) \!

Note that for all n = 1,2,3... :  sin(n\pi) = 0 \! as  sin(\pi) = sin(2\pi) = sin(3\pi) ... = 0 \! therefore these terms are evaluated as zero, which yields:

 b_{n} = \frac{1}{\pi} \left( -\left[0 - \left (\frac{-1}{n} (-\pi) cos(-n\pi) + 0 \right) \right] + \left[\frac{-1}{n} \pi cos(n\pi) + 0 \right] \right ) \!
 b_{n} = \frac{1}{\pi} \left( \left[\frac{1}{n} (\pi) cos(-n\pi) \right] + \left[\frac{-1}{n} \pi cos(n\pi) \right] \right ) \!

Note that  cos(-x) = cos(x) \! therefore:

 b_{n} = \frac{1}{\pi} \left( \frac{1}{n} \pi cos(n\pi)  + \frac{-1}{n} \pi cos(n\pi)  \right ) \!
 b_{n} = \frac{1}{\pi} \left( 0  \right ) \!

                                                        b_{n} = 0 \!

Therefore there will be no  sin(nx) \! terms in the Fourier representation. In conclusion, the Fourier series representation for the given function is as follows:

 f(x) = \frac{\pi}{2} - \frac{4}{\pi} cos(x) - \frac{4}{3^2 \pi} cos(3x) - \frac{4}{5^2 \pi} cos(5x) + ... \!

                                     f(x) = \frac{\pi}{2} - \frac{4}{\pi}\left (cos(x) + \frac{1}{9} cos(3x) + \frac{1}{25} cos(5x) + ... \right ) \!



A graph of the function, and the Fourier series for  n = 1,3,5 \! is shown below:

R7.4.12.jpg
--Egm4313.s12.team11.sheider (talk) 06:00, 22 April 2012 (UTC)

K 2011 p.482 pb. 13 [edit]

Problem Statement [edit]

Find the Fourier series of the given function which is assumed to have a period of  2 \pi \!. Show the details of your work.
Sketch or graph the partial sums up to that including  cos(5x) \! and  sin(5x) \!

Given:

 f(x) = \left\{\begin{matrix} 
-x \text{ if } -\pi < x < 0\\\pi - x \text{ if } 0 < x < \pi 
\end{matrix}\right.
\!

Solution [edit]

The Fourier series of a function with a period of  p = 2\pi \! is defined:

 f(x) = a_{0} + \sum_{n=1}^{\infty } (a_{n}cos(nx) + b_{n}sin(nx))\!

Where:

 a_{0} = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x) dx \!
 a_{n} = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) cos(nx) dx \!
 b_{n} = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) sin(nx) dx \!

Calculating the first term  a_{0} \!:

 a_{0} = \frac{1}{2\pi} \left ( \int_{-\pi}^{0} x dx + \int_{0}^{\pi} (\pi - x) dx \right) \!
 a_{0} = \frac{1}{2\pi} \left ( \left [\frac{x^2}{2} \right ]_{-\pi}^{0} + \left [\pi x - \frac{x^2}{2} \right ]_{0}^{\pi} \right)\!
 a_{0} = \frac{1}{2\pi} \left ( - \left(\frac{\pi^2}{2}\right ) + \left (\pi^2 - \frac{\pi^2}{2}\right)\right) \!
 a_{0} = \frac{1}{2\pi} \left ( -\frac{\pi^2}{2} + \pi^2 - \frac{\pi^2}{2}\right) \!
 a_{0} = \frac{1}{2\pi} \left (\pi^2 - \pi^2 \right) \!

                                                          a_{0} = 0 \!


Calculating the coefficient  a_{n} \!:

 a_{n} = \frac{1}{\pi} \left( \int_{-\pi}^{0} x cos(nx) dx + \int_{0}^{\pi} (\pi - x) cos(nx) dx \right ) \!

Using integration by parts with the following substitutions for the integral  \int_{-\pi}^{0} x cos(nx) dx \!:

 u = x \! and therefore  du = dx \!
 dv = cos(nx)dx \! and therefore  v = \frac{1}{n}sin(nx) \!

Using integration by parts with the following substitutions for the integral  \int_{0}^{\pi} (\pi - x) cos(nx) dx \!:

 u = \pi - x \! and therefore  du = -dx \!
 dv = cos(nx)dx \! and therefore  v = \frac{1}{n}sin(nx) \!

This yields for the overall expression:

 a_{n} = \frac{1}{\pi} \left( \left[\frac{1}{n} x sin(nx) - \int \frac{1}{n}sin(nx)dx \right]_{-\pi}^{0} + \left[\frac{1}{n} (\pi - x) sin(nx) - \int -\frac{1}{n}sin(nx)dx \right]_{0}^{\pi} \right ) \!
 a_{n} = \frac{1}{\pi} \left( \left[\frac{1}{n} x sin(nx) + \frac{1}{n^2}cos(nx) \right]_{-\pi}^{0} + \left[\frac{1}{n} (\pi - x) sin(nx) - \frac{1}{n^2}cos(nx) \right]_{0}^{\pi} \right ) \!
 a_{n} = \frac{1}{\pi} \left( \left[\frac{1}{n^2} - \left (\frac{1}{n} (-\pi) sin(-n\pi) + \frac{1}{n^2}cos(-n \pi) \right) \right] + \left[-\frac{1}{n^2}cos(n\pi) + \frac{1}{n^2} \right] \right ) \!

Note that for all n = 1,2,3... :  sin(n\pi) = 0 \! as  sin(\pi) = sin(2\pi) = sin(3\pi) ... = 0 \! therefore these terms are evaluated as zero, which yields:

 a_{n} = \frac{1}{\pi} \left( \left[\frac{1}{n^2} - 0 - \frac{1}{n^2}cos(-n \pi) \right] + \left[-\frac{1}{n^2}cos(n\pi) + \frac{1}{n^2} \right] \right ) \!

 a_{n} = \frac{1}{\pi} \left(\frac{1}{n^2} - \frac{1}{n^2}cos(-n \pi) - \frac{1}{n^2}cos(n\pi) + \frac{1}{n^2} \right ) \!

Note that  cos(-x) = cos(x) \! therefore:

 a_{n} = \frac{1}{\pi} \left(\frac{1}{n^2} - \frac{1}{n^2}cos(n \pi) - \frac{1}{n^2}cos(n\pi) + \frac{1}{n^2} \right ) \!

 a_{n} = \frac{1}{\pi} \left(\frac{2}{n^2} - \frac{2}{n^2}cos(n \pi) \right ) \!
 a_{n} = \frac{1}{\pi} \left( \left (\frac{2}{n^2} \right)(1 - cos(n \pi)) \right ) \!
 a_{n} = \frac{2}{n^2\pi} \left (1 - cos(n \pi) \right )\!

To evaluate the term  (1-cos(n\pi)) \!:

Note that  cos(n\pi) = -1 \! for odd n values as  cos(\pi) = cos(3\pi) = cos(5\pi) ... = -1 \!

And that  cos(n\pi) = 1 \! for even n values as  cos(2\pi) = cos(4\pi) = cos(6\pi) ... = 1 \!.

Therefore, it can be concluded that for odd n values:

 (1-cos(n\pi)) = 1-(-1) = 2 \!

And for even n values:

 (1-cos(n\pi)) = 1-(1) = 0 \!

Therefore, for the coefficient   a_{n} \!, all even terms will equal zero while all odd terms will have a multiplier of 2, this yields (for all odd n values):

                                             a_{n} = \frac{4}{n^2\pi} \text{  for  } n = 1,3,5... \!


Calculating the coefficient  b_{n} \!:

 b_{n} = \frac{1}{\pi} \left( \int_{-\pi}^{0} x sin(nx) dx + \int_{0}^{\pi} (\pi - x) sin(nx) dx \right ) \!

Using integration by parts with the following substitutions for the integral  \int_{-\pi}^{0} x sin(nx) dx \!:

 u = x \! and therefore  du = dx \!
 dv = sin(nx)dx \! and therefore  v = \frac{-1}{n}cos(nx) \!

Using integration by parts with the following substitutions for the integral  \int_{0}^{\pi} (\pi - x) sin(nx) dx \!:

 u = \pi - x \! and therefore  du = -dx \!
 dv = sin(nx)dx \! and therefore  v = \frac{-1}{n}cos(nx) \!

This yields for the overall expression:

 b_{n} = \frac{1}{\pi} \left( \left[\frac{-1}{n} x cos(nx) - \int \frac{-1}{n}cos(nx)dx \right]_{-\pi}^{0} + \left[\frac{-1}{n}(\pi - x) cos(nx) - \int -\frac{-1}{n}cos(nx)dx \right]_{0}^{\pi} \right ) \!
 b_{n} = \frac{1}{\pi} \left( \left[\frac{-1}{n} x cos(nx) + \frac{1}{n^2}sin(nx) \right]_{-\pi}^{0} + \left[\frac{-1}{n}(\pi- x) cos(nx) - \frac{1}{n^2}sin(nx) \right]_{0}^{\pi} \right ) \!
 b_{n} = \frac{1}{\pi} \left( \left[0 - \left (\frac{-1}{n} (-\pi) cos(-n\pi) + \frac{1}{n^2}sin(-n \pi) \right) \right] + \left[- \frac{1}{n^2}sin(n\pi) - \left( \frac{-1}{n}\pi \right) \right] \right ) \!
 b_{n} = \frac{1}{\pi} \left( - \frac{1}{n} \pi cos(-n\pi) - \frac{1}{n^2}sin(-n \pi) - \frac{1}{n^2}sin(n\pi) +  \frac{1}{n}\pi   \right ) \!

Note that for all n = 1,2,3... :  sin(n\pi) = 0 \! as  sin(\pi) = sin(2\pi) = sin(3\pi) ... = 0 \! therefore these terms are evaluated as zero, which yields:

 b_{n} = \frac{1}{\pi} \left( - \frac{1}{n} \pi cos(-n\pi) -0 - 0 +  \frac{1}{n}\pi   \right ) \!
 b_{n} = \frac{1}{\pi} \left(\frac{1}{n}\pi - \frac{1}{n} \pi cos(-n\pi)  \right ) \!

Note that  cos(-x) = cos(x) \! therefore:

 b_{n} = \frac{1}{\pi} \left(\frac{1}{n}\pi - \frac{1}{n} \pi cos(n\pi)  \right ) \!
 b_{n} = \frac{1}{\pi} \left( \left(\frac{\pi}{n} \right)(1-cos(n\pi))  \right ) \!
 b_{n} = \frac{1}{n} \left(1-cos(n\pi) \right ) \!

To evaluate the term  (1-cos(n\pi)) \!:

Note that  cos(n\pi) = -1 \! for odd n values as  cos(\pi) = cos(3\pi) = cos(5\pi) ... = -1 \!

And that  cos(n\pi) = 1 \! for even n values as  cos(2\pi) = cos(4\pi) = cos(6\pi) ... = 1 \!.

Therefore, it can be concluded that for odd n values:

 (1-cos(n\pi)) = 1-(-1) = 2 \!

And for even n values:

 (1-cos(n\pi)) = 1-(1) = 0 \!

Therefore, for the coefficient   b_{n} \!, all even terms will equal zero while all odd terms will have a multiplier of 2, this yields (for all odd n values):

                                             b_{n} = \frac{2}{n} \text{  for  } n = 1,3,5... \!


In conclusion, the Fourier series representation for the given function is as follows:

 f(x) = 0 + \left (\frac{4}{\pi} cos(x) + \frac{4}{3^2 \pi} cos(3x) + \frac{4}{5^2 \pi} cos(5x) + ... \right ) + \left (2sin(x) + \frac{2}{3} sin(3x) + \frac{2}{5} sin(5x) + ... \right ) \!


                    f(x) = \frac{4}{\pi} \left (cos(x) + \frac{1}{9} cos(3x) + \frac{1}{25} cos(5x) + ... \right ) + 2 \left (sin(x) + \frac{1}{3} sin(3x) + \frac{1}{5} sin(5x) + ... \right ) \!



A graph of the function, and the Fourier series for  n = 1,3,5 \! is shown below:

R7.4.13.jpg
--Egm4313.s12.team11.sheider (talk) 06:00, 22 April 2012 (UTC)

R7.5 [edit]

Solved by Daniel Suh

Problem Statement [edit]

Consider the following,
\left \langle \phi_{2j-1}, \phi_{2k-1} \right \rangle=\int_{0}^{p}\phi _{2j-1}(x) \cdot \phi _{2k-1}(x)dx\!

\left \langle \phi_{2j-1}, \phi_{2k-1} \right \rangle=\int_{0}^{p}\sin {j\omega x} \cdot \sin {k\omega x} \; dx\!

with j\neq k\; and\; j,k = 1,2,...\!, and p=2\pi, j=2, k=3\!

1. Find the integration with the given data.

2. Confirm the results with Matlab's trapz command for the trapezoidal rule.

Solution [edit]

Part 1 [edit]

Trigonometric Identities [edit]

Angle Sum and Difference Identities

(1) \cos{(a+b)} = \cos{a}\cos {b} - \sin {a}\sin{b}\!
(2) \cos{(a-b)} = \cos{a}\cos {b} + \sin {a}\sin{b}\!


Rearrange

(1) \sin {a}\sin{b} = \cos{a}\cos {b}-\cos{(a+b)}\!
(2) \cos{a}\cos {b} = \cos{(a-b)} - \sin{a}\sin {b}\!


Substitute and Combine

\sin {a}\sin{b} = \cos{(a-b)} - \sin{a}\sin {b} - \cos{(a+b)}\!
2\sin {a}\sin{b} = \cos{(a-b)} - \cos{(a+b)}\!
\sin {a}\sin{b} = \frac{1}{2}\cos{(a-b)} - \frac{1}{2}\cos{(a+b)}\!

Utilize Trig Identities [edit]

\left \langle \phi_{2j-1}, \phi_{2k-1} \right \rangle=\int_{0}^{p}\sin {jwx} \cdot \sin {kwx} \; dx\!

\left \langle \phi_{2j-1}, \phi_{2k-1} \right \rangle=\int_{0}^{2\pi}\sin {2\omega x} \cdot \sin {3\omega x} \; dx\!

\left \langle \phi_{2j-1}, \phi_{2k-1} \right \rangle=\int_{0}^{2\pi}\frac{1}{2}\cos {(2\omega x - 3\omega x)} - \frac{1}{2}\cos{(2\omega x + 3\omega x)} \; dx\!

\left \langle \phi_{2j-1}, \phi_{2k-1} \right \rangle=\frac{1}{2}\int_{0}^{2\pi}\cos {(-\omega x)} \; dx - \frac{1}{2}\int_{0}^{2\pi}\cos{(5\omega x)} \; dx\!

\left \langle \phi_{2j-1}, \phi_{2k-1} \right \rangle=\frac{1}{2}\sin {(-\omega x)}|_{0}^{2\pi} - \frac{1}{2}\sin{(5\omega x)}|_{0}^{2\pi}\!

\left \langle \phi_{2j-1}, \phi_{2k-1} \right \rangle= (0-0) - (0-0) \!

                      \left \langle \phi_{2j-1}, \phi_{2k-1} \right \rangle= 0 \!

Part 2 [edit]

>> X = 0:2*pi/100:2*pi;

>> Y = sin(2*X).*sin(3*X);

>> Z = trapz(X,Y)

Z =

 2.9490e-017