User:EGM4313.f14.Team1.Bishop/Report 4

=Report 4=

Problem Statement
For the following L2-ODE-CC


 * {| style="width:100%" border="0"

$$ y'' + \frac23 y' + \frac{37}{9} y = r(x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

with excitation close to the damped circular frequency:


 * {| style="width:100%" border="0"

$$ r(x) = \cos 2.1 x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and initial conditions


 * {| style="width:100%" border="0"

$$ y(0) = 1, \ y'(0) = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

1. Identify the damped circular frequency.

2. Find the solution.

3. P rovide a quantitative and a qualitative (graphic) verification of the above results: solution satisfies the initial conditions, and solution satisfies the L2-ODE-CC.

Part 1

 * {| style="width:100%" border="0"

$$ y'' + \frac23 y' + \frac{37}{9} y = cos 2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Can break solution into homogeneous and particular solutions.


 * {| style="width:100%" border="0"

$$ y = y_h + y_p $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To find homogeneous solution we must assume a trial solution that takes the form


 * {| style="width:100%" border="0"

$$ y_h= e^{\lambda t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

with derivatives


 * {| style="width:100%" border="0"

$$ y_h'= \lambda e^{\lambda t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_h''= \lambda^2 e^{\lambda t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

plugging in


 * {| style="width:100%" border="0"

$$ \lambda^2 + \frac{2}{3} \lambda + \frac{37}{9} e^{\lambda t} = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

since $$ e^{\lambda t} $$ cannot be zero we retrieve following relation.


 * {| style="width:100%" border="0"

$$ \lambda^2 + \frac23 \lambda + \frac{37}{9}= 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Seeing that


 * {| style="width:100%" border="0"

$$ \Delta=\frac23^2-4(\frac{37}{9})=-\frac{80}{30} < 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore there must be two complex conjugate roots


 * {| style="width:100%" border="0"

$$ \lambda_{1} = -\frac13 - i 2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \lambda_{2} = -\frac13 + i 2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and the damped circular frequency $$ \tilde \omega = 2 $$.

Part 2
Continuing on from part 1 the homogeneous solution will then take the form


 * {| style="width:100%" border="0"

$$ y_h= e^{-0.5}(Acos(2t)+Bsin(2t)) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where A and B are undetermined coefficients to be found by solving

the full solution IVP.

Now we must find the particular solution. We begin by noting that the excitation r(x)

is trigonometric. There for we must select a particular solution that takes the form


 * {| style="width:100%" border="0"

$$ y_p= Mcos2.1x + Nsin2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

noting that this choice of particular solution must satisfy the initial ODE


 * {| style="width:100%" border="0"

$$ y_p'' + \frac23 y_p' + \frac{37}{9} y_p = cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore finding the necessary derivatives of the choice of particular solution


 * {| style="width:100%" border="0"

$$ y_p'= -M(2.1)sin2.1x + N(2.1)cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_p''= -M(4.41)cos2.1x - N(4.41)sin2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore


 * {| style="width:100%" border="0"

$$ -M(4.41)cos2.1x - N(4.41)sin2.1x + \frac23(-M(2.1)sin2.1x + N(2.1)cos2.1x) + \frac{37}{9}(Mcos2.1x + Nsin2.1x)= cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

rearranging equation to be more digestible


 * {| style="width:100%" border="0"

$$ (-0.30M + 1.4N)cos2.1x + (-1.4M + -0.30N)sin2.1x = cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

in order for the above solution to be satisfied the coefficients of the each of the

trig functions must matchup with coefficients of the trig functions of the excitation.

This yields two equations which allows us to solve for the two unknowns M and N.

The first equation


 * {| style="width:100%" border="0"

$$ -0.30M + 1.4N= 1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and the second equation


 * {| style="width:100%" border="0"

$$ -1.4M + -0.30N=0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

placing these equations into matrix form allows the system of equations to be solved easily


 * {| style="width:100%" border="0"

$$ \begin{bmatrix}-0.30 & 1.4 \\ 1.4 & -0.30\end{bmatrix} \begin{Bmatrix} M \\ N \end{Bmatrix} = \begin{Bmatrix} 1 \\ 0 \end{Bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore coefficients M and N


 * {| style="width:100%" border="0"

$$ M= 0.1604 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ N= 0.7487 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and the particular solution becomes


 * {| style="width:100%" border="0"

$$ y_p= 0.1604cos2.1x + 0.7487sin2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

the full solution which is a sum of the two linearly independent homogeneous and particular solutions

takes the form


 * {| style="width:100%" border="0"

$$ y= e^{-0.5}(Acos(2t)+Bsin(2t)) + 0.1604cos2.1x + 0.7487sin2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

to recover undetermined coefficients A and B we must utilize our given initial conditions.

taking the derivative of our solution


 * {| style="width:100%" border="0"

$$ y= e^{-0.5x}(Acos(2x)+Bsin(2x)) + 0.1604cos2.1x + 0.7487sin2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y'= 2 e^{-0.5 x} (B cos2x-A sin2x)-0.5 e^{-0.5 x} (A cos2x+B sin2x)-0.33684 sin2.1x+1.57227 cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore with initial conditions


 * {| style="width:100%" border="0"

$$ y(0)= A + 0.1604 = 1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y'(0)= 2(B)-0.5(A)+1.57227 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore


 * {| style="width:100%" border="0"

$$ A = 0.8396 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ B = -0.5762 $$ Therefore the final solution becomes
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y= e^{-0.5x}(0.8396cos(2x)-0.5762sin(2x)) + 0.1604cos2.1x + 0.7487sin2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Part 3
Checking if the retrieved solution indeed satisfies the L2-ODE-CC we plug the solution back into the ODE.


 * {| style="width:100%" border="0"

$$ y'= 2 e^{-0.5 x} (-0.5762 cos2x-0.8396sin2x)-0.5 e^{-0.5 x} (0.8396cos2x-0.5762  sin2x)-0.33684 sin2.1x+1.57227 cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y''= -3.30177 sin(2.1 x)-1.9961 e^{-0.5 x} cos(2 x)-0.707364 cos(2.1 x)+7.6799 e^{-0.5 x} sin(x) cos(x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

plugging solution into ODE and using Wolfram Alpha to find and check if indeed the answer to the left hand of the

ODE is equal to given excitation


 * {| style="width:100%" border="0"

$$ y'' + \frac23 y' + \frac{37}{9} y= cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

which it is.

Now plotting solution to check that initial conditions are met.



it can be seen that at a x location of 0 the function holds a value of one. Also it can be seen at

an x location of 0 the derivative of the function is 0.

Problem Statement
1. Find the expression for the normal stress $$ \sigma_{y'} $$ in y’ direction by replacing the angle $$ \theta $$ in Eq.(7.5) above with the angle $$ \theta +\frac{\pi}{2} $$.

2. Let the basis vectors for the (x,y) coordinates be $$ \mathbf e_{x}, \mathbf e_{y} $$, and the basis vectors in the (x’,y’) coordinates be $$ \mathbf e_{x'} , \mathbf e_{y'} $$. then we have


 * {| style="width:100%" border="0"

$$ \mathbf e_{x'} = \cos \theta \, \mathbf e_x + \sin \theta \, \mathbf e_y $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf e_{y'} = -\sin \theta \, \mathbf e_x + \cos \theta \, \mathbf e_y $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \begin{Bmatrix} \mathbf e_{x'} \\ \mathbf e_{y'} \end{Bmatrix} = \begin{bmatrix} \cos \theta & \sin \theta \\ -\sin \theta & \cos \theta \end{bmatrix} \begin{Bmatrix} \mathbf e_{x} \\ \mathbf e_{y} \end{Bmatrix} = \mathbf Q \begin{Bmatrix} \mathbf e_{x} \\ \mathbf e_{y} \end{Bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

arrange the stresses $$ (\sigma_{x'}, \ \sigma_{y'}, \ \tau_{x'y'} ) e_{x}, \mathbf e_{y} $$  and the stresses $$ (\sigma_{x}, \ \sigma_{y}, \ \tau_{xy} )$$  in symmetric matrix form, and verify the following relation by comparing with the above expressions for $$ (\sigma_{x'}, \ \sigma_{y'}, \ \tau_{x'y'} )$$  in terms of  $$ (\sigma_{x}, \ \sigma_{y}, \ \tau_{xy} )$$.


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} \sigma_{x'} & \tau_{x'y'} \\ \tau_{x'y'} & \sigma_{y'} \end{bmatrix} = \mathbf Q \, \begin{bmatrix} \sigma_{x} & \tau_{xy} \\ \tau_{xy} & \sigma_{y} \end{bmatrix} \, \mathbf Q^T $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

compare the above transformation of coordinates for stresses to the transformation of coordinates for the stiffness matrix in mtg.13, p.7, and sec.53e, Eq.(1) p.53-40.

3. The principal stresses are the max and min stresses as given by eq. (7.14) and principle directions are given by (7.12). solve the standard eigenvalue problem of the symmetric stress matrix.


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} \sigma_{x} & \tau_{xy} \\ \tau_{xy} & \sigma_{y} \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

to show that the eigenvalues are the max and min stresses in Eq.(7.14) above, and the eigendirections are given by Eq.(7.12) above.

Part 1
Eq. (7.5) states


 * {| style="width:100%" border="0"

$$ \sigma_{x'}=\frac{\sigma_x+\sigma_y}{2}+\frac{\sigma_x-\sigma_y}{2}\cos{2\theta}+\tau_{xy}\sin{2\theta} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Substituting $$\theta=\theta+\frac{\pi}{2}$$ into (7.5) gives us $$\sigma_{y'}$$


 * {| style="width:100%" border="0"

$$ \sigma_{y'}=\frac{\sigma_x+\sigma_y}{2}+\frac{\sigma_x-\sigma_y}{2}\cos{2(\theta+\frac{\pi}{2})}+\tau_{xy}\sin{2(\theta+\frac{\pi}{2})} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Simplifying


 * {| style="width:100%" border="0"

$$ \sigma_{y'}=\frac{\sigma_x+\sigma_y}{2}+\frac{\sigma_x-\sigma_y}{2}\cos{(2\theta+\pi)}+\tau_{xy}\sin{(2\theta+\pi)} $$     (1)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

From trigonometry, we know that $$sin{x+\pi}=-sin{x}$$ and $$cos{x+\pi}=-cos{x}$$. Substituting both into (1) gives


 * {| style="width:100%" border="0"

$$ \sigma_{y'}=\frac{\sigma_x+\sigma_y}{2}-\frac{\sigma_x-\sigma_y}{2}\cos{2\theta}-\tau_{xy}\sin{2\theta} $$     (2)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Part 2
From Eq. (7.5), Eq. (7.6), and (2), we know the formulas for $$\sigma_{x'}$$, $$\sigma_{y'}$$, and $$\tau_{x'y'}$$:


 * {| style="width:100%" border="0"

$$ \sigma_{x'}=\frac{\sigma_x+\sigma_y}{2}+\frac{\sigma_x-\sigma_y}{2}\cos{2\theta}+\tau_{xy}\sin{2\theta} $$     (7.5)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


 * {| style="width:100%" border="0"

$$ \sigma_{y'}=\frac{\sigma_x+\sigma_y}{2}-\frac{\sigma_x-\sigma_y}{2}\cos{2\theta}-\tau_{xy}\sin{2\theta} $$     (2)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


 * {| style="width:100%" border="0"

$$ \tau_{x'y'}=-\frac{\sigma_x-\sigma_y}{2}\sin{2\theta}+\tau_{xy}\cos{2\theta} $$     (7.6)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

From trigonometry, we know the following:


 * {| style="width:100%" border="0"

$$ \frac{1+cos{2\theta}}{2}=cos^2{\theta} $$     (3)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


 * {| style="width:100%" border="0"

$$ \frac{1-cos{2\theta}}{2}=sin^2{\theta} $$     (4)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


 * {| style="width:100%" border="0"

$$ sin{2\theta}=2sin{\theta}cos{\theta} $$     (5)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


 * {| style="width:100%" border="0"

$$ cos{2\theta}=cos^2{\theta}-sin^2{\theta} $$     (6)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

(7.5) can be rewritten as shown below:


 * {| style="width:100%" border="0"

$$ \sigma_{x'}=\frac{\sigma_x}{2}+\frac{\sigma_y}{2}+\frac{\sigma_x}{2}\cos{2\theta}-\frac{\sigma_y}{2}\cos{2\theta}+\tau_{xy}sin{2\theta} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \sigma_{x'}=\sigma_x(\frac{1+cos{2\theta}}{2})+\sigma_y(\frac{1-cos{2\theta}}{2})+\tau_{xy}sin{2\theta} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Substituting in (3), (4), and (5) gives the new form of (7.5):


 * {| style="width:100%" border="0"

$$ \sigma_{x'}=\sigma_xcos^2{\theta}+\sigma_ysin^2{\theta}+2\tau_{xy}sin{\theta}cos{\theta} $$     (7.5)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Similarly, with (2):


 * {| style="width:100%" border="0"

$$ \sigma_{y'}=\sigma_xsin^2{\theta}+\sigma_ycos^2{\theta}-2\tau_{xy}sin{\theta}cos{\theta} $$     (2)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

(7.6) can also be rewritten:


 * {| style="width:100%" border="0"

$$ \tau_{x'y'}=-\frac{\sigma_x}{2}sin{2\theta}+\frac{\sigma_y}{2}sin{2\theta}+\tau_{xy}cos{2\theta} $$ Substituting in (5) and (6) gives the new form of (7.6):
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \tau_{x'y'}=-\sigma_xsin{\theta}cos{\theta}+\sigma_ysin{\theta}cos{\theta}+\tau_{xy}(cos^2{\theta}-sin^2{\theta}) $$     (7.6)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

(7.5), (2), and (7.6) can be written in matrix from as below:


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} \sigma_{x'} & \tau_{x'y'} \\ \tau_{x'y'} & \sigma_{y'} \end{bmatrix} = \mathbf Q \, \begin{bmatrix} \sigma_{x} & \tau_{xy} \\ \tau_{xy} & \sigma_{y} \end{bmatrix} \, \mathbf Q^T $$     (7)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Where $$\mathbf Q=\begin{bmatrix}Q_{11} & Q_{12} \\ Q_{21} & Q_{22}\end{bmatrix}$$ and $$\mathbf Q^T=\begin{bmatrix}Q_{11} & Q_{21} \\ Q_{12} & Q_{22}\end{bmatrix}$$

Multiplying out (7) to find the values in $$\mathbf Q$$


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} \sigma_{x'} & \tau_{x'y'} \\ \tau_{x'y'} & \sigma_{y'} \end{bmatrix} = \begin{bmatrix}Q_{11} & Q_{12} \\ Q_{21} & Q_{22}\end{bmatrix} \begin{bmatrix} Q_{11}\sigma_{x}+Q_{12}\tau_{xy} & Q_{21}\sigma_{x}+Q_{22}\tau_{xy} \\ Q_{11}\tau_{xy}+Q_{12}\sigma_{y} & Q_{21}\tau_{xy}+Q_{22}\sigma_{y} \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} \sigma_{x'} & \tau_{x'y'} \\ \tau_{x'y'} & \sigma_{y'} \end{bmatrix} = \begin{bmatrix} Q_{11}^2\sigma_{x}+2Q_{11}Q_{12}\tau_{xy}+Q_{12}^2\sigma_{y} & Q_{11}Q_{12}\sigma_{x}+(Q_{11}Q_{22}+Q_{12}Q_{21})\tau_{xy}+Q_{12}Q_{22}\sigma_{y} \\ Q_{11}Q_{12}\sigma_{x}+(Q_{11}Q_{22}+Q_{12}Q_{21})\tau_{xy}+Q_{12}Q_{22}\sigma_{y} & Q_{21}^2\sigma_{x}+2Q_{21}Q_{22}\tau_{xy}+Q_{22}^2\sigma_{y} \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Equating the values in the right matrix with the new forms of (7.5), (2), and (7.6) gives


 * {| style="width:100%" border="0"

$$ \sigma_xcos^2{\theta}+\sigma_ysin^2{\theta}+2\tau_{xy}sin{\theta}cos{\theta}=Q_{11}^2\sigma_{x}+2Q_{11}Q_{12}\tau_{xy}+Q_{12}^2\sigma_{y} $$     (8)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


 * {| style="width:100%" border="0"

$$ \sigma_xsin^2{\theta}+\sigma_ycos^2{\theta}-2\tau_{xy}sin{\theta}cos{\theta}=Q_{21}^2\sigma_{x}+2Q_{21}Q_{22}\tau_{xy}+Q_{22}^2\sigma_{y} $$     (9)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


 * {| style="width:100%" border="0"

$$ -\sigma_xsin{\theta}cos{\theta}+\sigma_ysin{\theta}cos{\theta}+\tau_{xy}(cos^2{\theta}-sin^2{\theta})=Q_{11}Q_{12}\sigma_{x}+(Q_{11}Q_{22}+Q_{12}Q_{21})\tau_{xy}+Q_{12}Q_{22}\sigma_{y} $$     (10)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

From (10), we can deduce that $$Q_{11}=Q_{22}=cos{\theta}$$ and that $$Q_{12}$$ and $$Q_{21}$$ are both sin{\theta}, with one of them being negative.

We can then deduce from (9) that $$Q_{21}$$ has to be negative to account for the negative sign in front of the third coefficient on the left side of the equation. Therefore, $$Q_{12}=sin{\theta}$$

We can now form the matrix $$\mathbf Q$$:


 * {| style="width:100%" border="0"

$$ \mathbf Q=\begin{bmatrix}cos{\theta} & sin{\theta} \\ -sin{\theta} & cos{\theta}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Rewriting (7) gives the matrix form of the stresses:


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} \sigma_{x'} & \tau_{x'y'} \\ \tau_{x'y'} & \sigma_{y'} \end{bmatrix} = \begin{bmatrix}cos{\theta} & sin{\theta} \\ -sin{\theta} & cos{\theta}\end{bmatrix} \begin{bmatrix} \sigma_{x} & \tau_{xy} \\ \tau_{xy} & \sigma_{y} \end{bmatrix} \begin{bmatrix}cos{\theta} & -sin{\theta} \\ sin{\theta} & cos{\theta}\end{bmatrix} $$     (7)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

We know from the GEP that transforming the stiffness matrix $$\mathbf K$$ from the old coordinate system to the new coordinate system is done by
 * {| style="width:100%" border="0"

$$ \overline{\mathbf K}=\begin{bmatrix}\bar{\boldsymbol \phi}_1 \ \bar{\boldsymbol \phi}_2 \end{bmatrix}^T \mathbf K \begin{bmatrix}\bar{\boldsymbol \phi}_1 \ \bar{\boldsymbol \phi}_2\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This method is essentially the same to (7), where $$\mathbf Q^T$$ is the matrix of eigenvectors and the stiffness matrix is the stress matrix.

Part 3
From (7.14),


 * {| style="width:100%" border="0"

$$ \sigma_{max, min}=\frac{\sigma_x+\sigma_y}{2} \pm \sqrt{\left( \frac{\sigma_x-\sigma_y}{2}\right)^2 + \tau_{xy}^2} $$     (7.14)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

From (7.12),


 * {| style="width:100%" border="0"

$$ \tan{2\theta_p}=\frac{2\tau_{xy}}{\sigma_x-\sigma_y} $$     (7.12)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Part 3a
The Standard Eigenvalue Problem (SEP) is


 * {| style="width:100%" border="0"

$$ \mathbf K \boldsymbol \phi = \beta \mathbf I \boldsymbol \phi $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where $$\mathbf K$$ is the matrix being transformed by the eigenvector (in this case, the stress matrix), $$\boldsymbol \phi$$ is the eigenvector (in this case, the first or second column of $$\mathbf Q^T$$), and $$\beta$$ is the eigenvalue corresponding to the eigenvector. $$\mathbf I$$ is the identity matrix, standing in for the mass matrix for the SEP.

To solve the SEP, we first need to find the two eigenvalues. This is done by solving the equation


 * {| style="width:100%" border="0"

$$ \begin{vmatrix} \mathbf K - \beta \mathbf I \end{vmatrix}=0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

As a reminder from Part 2,


 * {| style="width:100%" border="0"

$$ \mathbf K = \begin{bmatrix} \sigma_{x} & \tau_{xy} \\ \tau_{xy} & \sigma_{y} \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf Q^T=\boldsymbol \Phi=\begin{bmatrix}cos{\theta} & -sin{\theta} \\ sin{\theta} & cos{\theta}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now we solve for the eigenvalues.


 * {| style="width:100%" border="0"

$$ \begin{vmatrix} \sigma_x-\beta & \tau_{xy} \\ \tau_{xy} & \sigma_y-\beta \end{vmatrix}=0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \left( \sigma_x-\beta \right) \left( \sigma_y-\beta \right) - \tau_{xy}^2=0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \sigma_x \sigma_y - \left( \sigma_x + \sigma_y \right) \beta + \beta^2 - \tau_{xy}^2=0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \beta^2 - \left( \sigma_x + \sigma_y \right) \beta + \left( \sigma_x \sigma_y - \tau_{xy}^2 \right)=0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \beta=\frac{\left( \sigma_x + \sigma_y \right) \pm \sqrt{\left( \sigma_x + \sigma_y \right)^2 - 4\left( \sigma_x \sigma_y - \tau_{xy}^2 \right)}}{2} $$     (8)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

(8) can be simplified as follows:


 * {| style="width:100%" border="0"

$$ \beta=\frac{\sigma_x+\sigma_y}{2} \pm \sqrt{\left( \frac{\sigma_x + \sigma_y}{2} \right)^2 - \sigma_x \sigma_y + \tau_{xy}^2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \beta=\frac{\sigma_x+\sigma_y}{2} \pm \sqrt{\frac{\sigma_x^2}{4} + \frac{\sigma_x \sigma_y}{2} + \frac{\sigma_y^2}{4} - \sigma_x \sigma_y + \tau_{xy}^2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \beta=\frac{\sigma_x+\sigma_y}{2} \pm \sqrt{\frac{\sigma_x^2}{4} - \frac{\sigma_x \sigma_y}{2} + \frac{\sigma_y^2}{4} + \tau_{xy}^2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \beta=\frac{\sigma_x+\sigma_y}{2} \pm \sqrt{\left( \frac{\sigma_x - \sigma_y}{2} \right)^2 + \tau_{xy}^2} $$     (9)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

It can be seen that (9) is the same as (7.14). So, the maximum and minimum stresses are the eigenvalues of the stress matrix.

Part 3b
Now that we know the eigenvalues, we can solve for the eigenvectors in terms of $$\sigma_x$$, $$\sigma_y$$, and $$\tau_{xy}$$.

We are solving for the first eigenvector using the first eigenvalue. While either coefficient in the eigenvectors can be set to any value, the first coefficient is being set to 1 because it will make proving (7.12) easier.

We know from Part 2 that the first eigenvector is $$\begin{bmatrix}\cos{\theta} \\ \sin{\theta} \end{bmatrix}$$

If we solve for $$\phi_{12}$$ when $$\phi_{11}=1$$, then we are solving for $$\tan{\theta}$$, because we divide the first eigenvector by $$\cos{\theta}$$. This is beneficial to us because we want to find $$\tan{2\theta}$$, as (7.12) has. From trigonometry, we know that


 * {| style="width:100%" border="0"

$$ \tan{2\theta}=\frac{2\sin{\theta}\cos{\theta}}{\cos^2{\theta}-\sin^2{\theta}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Which, knowing the definition of the tangent function, can be rewritten as


 * {| style="width:100%" border="0"

$$ \tan{2\theta}=\frac{2\cos^2{\theta}\tan{\theta}}{\cos^2{\theta}\left(1-\tan^2{\theta}\right)} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \tan{2\theta}=\frac{2\tan{\theta}}{1-\tan^2{\theta}} $$     (10)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

So, if we know what $$\tan{\theta}$$ is, we can calculate what $$\tan{2\theta}$$ is.


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} \sigma_{x} & \tau_{xy} \\ \tau_{xy} & \sigma_{y} \end{bmatrix} \begin{bmatrix} 1 \\ \tan{\theta} \end{bmatrix} = \left(\frac{\sigma_x+\sigma_y}{2} - \sqrt{\left( \frac{\sigma_x - \sigma_y}{2} \right)^2 + \tau_{xy}^2}\right) \begin{bmatrix} 1 \\ \tan{\theta} \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \sigma_{x}+\tau_{xy}\tan{\theta}=\frac{\sigma_x+\sigma_y}{2} - \sqrt{\left( \frac{\sigma_x - \sigma_y}{2} \right)^2 + \tau_{xy}^2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \tau_{xy}\tan{\theta}=\frac{\sigma_y-\sigma_x}{2} - \sqrt{\left( \frac{\sigma_x - \sigma_y}{2} \right)^2 + \tau_{xy}^2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \tan{\theta}=\frac{\sigma_y-\sigma_x}{2\tau_{xy}} - \sqrt{\left( \frac{\sigma_x - \sigma_y}{2\tau_{xy}} \right)^2 + 1} $$     (11)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Now that we know $$\tan{\theta}$$ from (11), we can calculate $$\tan{2\theta}$$ from (10). We used Wolfram Alpha to simplify this process. Here is a link to the page. On the page, x represents $$\sigma_x$$, y represents $$\sigma_y$$, and z represents $$\tau_{xy}$$.

The first "alternate form" shown by Wolfram Alpha is


 * {| style="width:100%" border="0"

$$ \tan{2\theta}=\frac{2\tau_{xy}}{\sigma_x-\sigma_y} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Which is the same as (7.12). What this tells us is that the principal stresses, the values in the transformed stress matrix, act along the angle $$\theta$$ given by (7.12), the eigendirection.

Problem Statement
For the following L2-ODE-CC


 * {| style="width:100%" border="0"

$$ y'' + \frac23 y' + \frac{37}{9} y = r(x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

with excitation close to the damped circular frequency:


 * {| style="width:100%" border="0"

$$ r(x) = e^{-x/4} \cos 2.1 x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and initial conditions


 * {| style="width:100%" border="0"

$$ y(0) = 1, \ y'(0) = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

1. Identify the damped circular frequency.

2. Find the solution. (Wolfram alpha and notes to help with search for particular solution.

3. P rovide a quantitative and a qualitative (graphic) verification of the above results: solution satisfies the initial conditions, and solution satisfies the L2-ODE-CC.

Part 1

 * {| style="width:100%" border="0"

$$ y'' + \frac23 y' + \frac{37}{9} y = 1.5 + e^cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Can break solution into homogeneous and particular solutions.


 * {| style="width:100%" border="0"

$$ y = y_h + y_p $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To find homogeneous solution we must assume a trial solution that takes the form


 * {| style="width:100%" border="0"

$$ y_h= e^{\lambda t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

with derivatives


 * {| style="width:100%" border="0"

$$ y_h'= \lambda e^{\lambda t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_h''= \lambda^2 e^{\lambda t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

plugging in


 * {| style="width:100%" border="0"

$$ \lambda^2 + \frac{2}{3} \lambda + \frac{37}{9} e^{\lambda t} = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

since $$ e^{\lambda t} $$ cannot be zero we retrieve following relation.


 * {| style="width:100%" border="0"

$$ \lambda^2 + \frac23 \lambda + \frac{37}{9}= 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Seeing that


 * {| style="width:100%" border="0"

$$ \Delta=\frac23^2-4(\frac{37}{9})=-\frac{80}{30} < 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore there must be two complex conjugate roots


 * {| style="width:100%" border="0"

$$ \lambda_{1} = -\frac13 - i 2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \lambda_{2} = -\frac13 + i 2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and the damped circular frequency $$ \tilde \omega = 2 $$.

Part 2
Continuing on from part 1 the homogeneous solution will then take the form


 * {| style="width:100%" border="0"

$$ y_h= e^(Acos(2t)+Bsin(2t)) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where A and B are undetermined coefficients to be found by solving

the full solution IVP.

Now we must find the particular solution. We begin by noting that the excitation r(x)

is trigonometric. There for we must select a particular solution that takes the form


 * {| style="width:100%" border="0"

$$ y_p= e^(Kcos2.1x + Nsin2.1x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

noting that this choice of particular solution must satisfy the initial ODE


 * {| style="width:100%" border="0"

$$ y_p'' + \frac23 y_p' + \frac{37}{9} y_p = 1.5 + e^cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore finding the necessary derivatives of the choice of particular solution


 * {| style="width:100%" border="0"

$$ y_p'= -\frac{1}{4}e^(Kcos2.1x + Nsin2.1x) + e^(-2.1Ksin2.1x + 2.1Ncos2.1x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_p''= 2(-\frac{1}{4}e^(-2.1Ksin2.1x + 2.1Ncos2.1x)) + \frac{1}{16}e^(Kcos2.1x + Nsin2.1x) + e^((-4.41)Kcos2.1x + (-4.41)Nsin2.1x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore


 * {| style="width:100%" border="0"

$$ e^(( \frac{1}{16}(Kcos2.1x + Nsin2.1x)+\frac{2.1}{2}(Ksin2.1x - Ncos2.1x) - 4.41(Kcos2.1x + Nsin2.1x)) + \frac{2}{3}(\frac{-1}{4}(Kcos2.1x + Nsin2.1x) + 2.1(-Ksin2.1x + Ncos2.1x)) +\frac{37}{9}(Kcos2.1x + Nsin2.1x) = 1.5 + e^cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

rearranging equation to be more digestible


 * {| style="width:100%" border="0"

$$ e^(((\frac{1}{16}-4.41-\frac{1}{4}+1)K + (-\frac{2.1}{2} + 2.1)N)cos2.1x + ((\frac{1}{16}-4.41-\frac{1}{4}+1)N + (\frac{2.1}{2} - 2)K)sin2.1x)) = 1.5 + e^cos2.1x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ e^((-3.5975K + 1.05N)cos2.1x + (-3.5975N - 1.05K)sin2.1x) = 1.5 + e^cos2.1x $$ in order for the above solution to be satisfied the coefficients of the each of the
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

trig functions must matchup with coefficients of the trig functions of the excitation.

This yields two equations which allows us to solve for the two unknowns K and N.

The first equation


 * {| style="width:100%" border="0"

$$ -3.5975K + 1.05N = 1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and the second equation


 * {| style="width:100%" border="0"

$$ -3.5975N + -1.05K = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

placing these equations into matrix form allows the system of equations to be solved easily


 * {| style="width:100%" border="0"

$$ \begin{bmatrix}-3.5975 & 1.05 \\ -1.05 & -3.5975\end{bmatrix} \begin{Bmatrix} K \\ N \end{Bmatrix} = \begin{Bmatrix} 1 \\ 0 \end{Bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Problem 4.4
Find the projections (approximations) of each the functions below, defined on the interval [0,1], onto the polynomial basis


 * {| style="width:100%" border="0"

$$ \{ 1, x, x^2, ...., x^n \} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

for different values of n; here n = 2, 4, 6.

for each of the functions below, plot the exact function and its approximations.

1. Exponential function: $$ e^x = \exp(x) $$ use integration by parts, and verify your results with Wolfram integrator; provide links to your Wolfram integrator results.

2. Same as in Question 1, but with the sine function: sin x

3. Same as in Question 1, but the logarithm function : log(1+x). try to integrate with integration by parts first, and and point out the difficulty in your report.

when you come to a deadend with integration by parts, use numerical integration with with both GNU Octave / matlab commands trapz

and quad to verify, and verify again with Wolfram integrator, as mentioned above.

Solution
General approximation projected on the polynomial basis:
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

f(x) \approx \sum_{j=1}^n c_j b_j(x) = c_o + c_1x + c_2x^2 +...+c_nx^n $$ find c_j using Gram matrix as with vectors
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\{ b_i(x), \, i=1,...n \} $$ to obtain
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\sum_{j=1}^n c_j \langle b_i, b_j \rangle = \langle b_i , f \rangle , \ i=1,...,n $$ Gram matrix:
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} \langle b_1, b_1 \rangle & ... & \langle b_1, b_n \rangle \\

\vdots & \vdots & \vdots \\ \langle b_n, b_1 \rangle & ... & \langle b_n, b_n \rangle \end{bmatrix} $$
 * }
 * }

Unknown coefficients that need to be solve:
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\mathbf c = \lfloor c_1, ... , c_n \rfloor^T $$ Known components
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\mathbf d = \lfloor \langle b_1, f \rangle , ... , \langle b_n, f \rangle \rfloor^T = \lfloor d_1 , ..., d_n \rfloor^T $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\boldsymbol \Gamma \mathbf c = \mathbf d $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma \ne 0 \Rightarrow \boldsymbol \Gamma^{-1} \text{ exists} \Rightarrow \mathbf c = \boldsymbol \Gamma^{-1} \mathbf d $$
 * }
 * }

Question 1
$$f(x)=e^x $$

In order to get the scalar product between $$e^x$$ and the basis functions, we need to use integration by parts. Because the basis functions are in the form $$x^n$$, where $$n \ge 1$$, we can use a general form of the scalar product to make the process simpler.

First, we need to define how to integrate by parts.


 * {| style="width:100%" border="0"

$$ \int u dv=uv-\int v du $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \int_0^1 x^n e^x dx $$ (1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

In (1), $$u=x^n$$ and $$dv=e^x dx$$, so $$du=nx^{n-1}dx$$ and $$v=e^x$$. So, (1) can be rewritten as


 * {| style="width:100%" border="0"

$$ \int_0^1 x^n e^x dx= \left( 1^ne^1-0^ne^0 \right)-n\int_0^1x^{n-1}e^x dx $$ (1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \int_0^1 x^n e^x dx= e-n\int_0^1x^{n-1}e^x dx $$ (2)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

When $$n \ge 1$$, we can use (2) to quickly get the value of the integral, so we don't have to do integration by parts every time. If $$n=0$$, then we just have to integrate the exponential function.


 * {| style="width:100%" border="0"

$$ \langle x^0,e^x \rangle = \langle 1,e^x \rangle = \int_0^1 e^x dx = [e^x]_0^1=e-1 $$     (3)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x,e^x \rangle=\int_0^1 x^1 e^x dx= e-1\int_0^1x^{1-1}e^x dx=e-\int_0^1e^x dx=e-(e-1)=1 $$     (4)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^2,e^x \rangle=\int_0^1 x^2 e^x dx= e-2\int_0^1x^{2-1}e^x dx=e-\int_0^1xe^x dx=e-2(1)=e-2 $$     (5)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^3,e^x \rangle=\int_0^1 x^3 e^x dx= e-3\int_0^1x^{3-1}e^x dx=e-3\int_0^1x^2e^x dx=e-3(e-2)=e-3e+6=6-2e $$     (6)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^4,e^x \rangle=\int_0^1 x^4 e^x dx= e-4\int_0^1x^{4-1}e^x dx=e-4\int_0^1x^3e^x dx=e-4(6-2e)=e-24+8e=9e-24 $$     (7)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^5,e^x \rangle=\int_0^1 x^5 e^x dx= e-5\int_0^1x^{5-1}e^x dx=e-5\int_0^1x^4e^x dx=e-5(9e-24)=e-45e+120=120-44e $$     (8)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^6,e^x \rangle=\int_0^1 x^6 e^x dx= e-6\int_0^1x^{6-1}e^x dx=e-6\int_0^1x^5e^x dx=e-6(120-44e)=e-720+264e=265e-720 $$     (9)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

n=2
The basis is


 * {| style="width:100%" border="0"

$$ \{ 1, x, x^2 \} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

so the function f(x) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx c_0b_0+c_1b_1+c_2b_2=c_0+c_1x+c_2x^2 $$      (10)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

where $$c_0$$, $$c_1$$, and $$c_2$$ will be found by solving the matrix equation


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma \mathbf c = \mathbf d $$ (11)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

where $$\mathbf d$$ is defined by


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} \langle 1,e^x \rangle \\ \langle x,e^x \rangle \\ \langle x^2,e^x \rangle \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The coefficients come from (3) to (5).


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} e-1 \\ 1 \\ e-2 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Because the interval is from 0 to 1, $$\boldsymbol \Gamma$$ is the Hilbert matrix of order 3, or


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To solve (11), we need to find the inverse of $$\boldsymbol \Gamma$$. We used Matlab to simplify this process.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We can now solve for the coefficients in (10).


 * {| style="width:100%" border="0"

$$ \mathbf c= \boldsymbol \Gamma^{-1} \mathbf d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c= \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} \begin{bmatrix} e-1 \\ 1 \\ e-2 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c= \begin{bmatrix} 9e-9-36+30e-60 \\ -36e+36+192-180e+360 \\ 30e-30-180+180e-360 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c= \begin{bmatrix} 39e-105 \\ 588-216e \\ 210e-570 \end{bmatrix} \approx \begin{bmatrix} 1.0130 \\ 0.8511 \\ 0.8392 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

So, from (10),


 * {| style="width:100%" border="0"

$$ e^x \approx 1.0130+1.8511x+0.8392x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

n = 4
\{ 1, x, x^2, x^3, x^4 \}

n = 6
\{ 1, x, x^2, x^3, x^4, x^5, x^6 \}

Question 2
$$f(x)=\sin{x}$$

In order to get the scalar product between $$\sin{x}$$ and the basis functions, we need to use integration by parts. Because the basis functions are in the form $$x^n$$, where $$n \ge 1$$, we can use a general form of the scalar product to make the process simpler.

First, we need to define how to integrate by parts.


 * {| style="width:100%" border="0"

$$ \int u dv=uv-\int v du $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \int_0^1 x^n \sin{x} dx $$ (1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

In (1), $$u=x^n$$ and $$dv=\sin{x} dx$$, so $$du=nx^{n-1}dx$$ and $$v=\cos{x}$$. So, (1) can be rewritten as


 * {| style="width:100%" border="0"

$$ \int_0^1 x^n e^x dx= \left( -1^x\cos{1}+0^n\cos{0} \right)-n\int_0^1x^{n-1}\cos{x} dx $$ (1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \int_0^1 x^n e^x dx= -\cos{1}-n\int_0^1x^{n-1}\cos{x} dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

In order to do the same method as with $$e^x$$, we need to do integration by parts again. $$u=x^{n-1}$$ and $$dv=\cos{x} dx$$, so $$du=(n-1)x^{n-2} dx$$ and $$v=sin{x}$$.


 * {| style="width:100%" border="0"

$$ \int_0^1 x^n e^x dx= -\cos{1}-n \left( 1^{n-1}\sin{1}-0^{n-1}\sin{0} - (n-1)\int_0^1 x^{n-2}\sin{x} dx \right) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \int_0^1 x^n e^x dx= n\sin{1}-\cos{1}-n(n-1)\int_0^1 x^{n-2}\sin{x} dx $$ (2)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

When $$n \ge 1$$, we can use (2) to quickly get the value of the integral, so we don't have to do integration by parts every time. If $$n=0$$, then we just have to integrate the sine function.


 * {| style="width:100%" border="0"

$$ \langle x^0,\sin{x} \rangle = \langle 1,\sin{x} \rangle = \int_0^1 \sin{x} dx = [-\cos{x}]_0^1=1-\cos{1} $$     (3)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x,\sin{x} \rangle=\int_0^1 x^1 \sin{x} dx= 1\sin{1}-\cos{1}-1(1-1)\int_0^1 x^{1-2}\sin{x} dx = \sin{1}-\cos{1} $$     (4)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^2,\sin{x} \rangle=\int_0^1 x^2 \sin{x} dx=2\sin{1}-\cos{1}-2\int_0^1\sin{x} dx= 2\sin{1}-\cos{1}-2+2\cos{1}=2\sin{1}+\cos{1}-2 $$     (5)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^3,\sin{x} \rangle=\int_0^1 x^3 \sin{x} dx=3\sin{1}-\cos{1}-6\int_0^1x\sin{x} dx= 3\sin{1}-\cos{1}-6\sin{1}+6\cos{1}=5\cos{1}-3\sin{1} $$     (6)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^4,\sin{x} \rangle=\int_0^1 x^4 \sin{x} dx=4\sin{1}-\cos{1}-12\int_0^1x^2\sin{x} dx= 4\sin{1}-\cos{1}-24\sin{1}-12\cos{1}+24=24-13\cos{1}-20\sin{1} $$     (7)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^5,\sin{x} \rangle=\int_0^1 x^5 \sin{x} dx=5\sin{1}-\cos{1}-20\int_0^1x^3\sin{x} dx= 5\sin{1}-\cos{1} - 100\cos{1} + 60\sin{1} = 65\sin{1} - 101\cos{1} $$     (8)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ \langle x^6,\sin{x} \rangle=\int_0^1 x^6 \sin{x} dx= 6\sin{1}-\cos{1}-30\int_0^1x^4\sin{x} dx= 6\sin{1}-\cos{1}-720+390\cos{1}+600\sin{1}=389\cos{1}+606\sin{1}-720 $$     (9)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

n=2
The basis is


 * {| style="width:100%" border="0"

$$ \{ 1, x, x^2 \} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

so the function sin(x) can be approximated as


 * {| style="width:100%" border="0"

$$ sin(x) \approx c_0b_0+c_1b_1+c_2b_2=c_0+c_1x+c_2x^2 $$      (10)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

where $$c_0$$, $$c_1$$, and $$c_2$$ will be found by solving the matrix equation


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma \mathbf c = \mathbf d $$ (11)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

where $$\mathbf d$$ is defined by


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} \langle 1,\sin{x} \rangle \\ \langle x,\sin{x} \rangle \\ \langle x^2,\sin{x} \rangle \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The coefficients come from (3) to (5).


 * {| style="width:100%" border="0"

$$ \begin{bmatrix} 1-\cos{1} \\ \sin{1}-\cos{1} \\ \cos{1}+2\sin{1}-2 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Because the interval is from 0 to 1, $$\boldsymbol \Gamma$$ is the Hilbert matrix of order 3, or


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To solve (11), we need to find the inverse of $$\boldsymbol \Gamma$$. We used Matlab to simplify this process.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We can now solve for the coefficients in (10).


 * {| style="width:100%" border="0"

$$ \mathbf c= \boldsymbol \Gamma^{-1} \mathbf d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c= \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} \begin{bmatrix} 1-\cos{1} \\ \sin{1}-\cos{1} \\ \cos{1}+2\sin{1}-2 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c= \begin{bmatrix} 9-9\cos{1}-36\sin{1}+36\cos{1}+30\cos{1}+60\sin{1}-60 \\ -36+36\cos{1}+192\sin{1}-192\cos{1}-180\cos{1}-360\sin{1}+360 \\ 30-30\cos{1}-180\sin{1}+180\cos{1}+180\cos{1}+360\sin{1}-360 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c= \begin{bmatrix} 57\cos{1}+24\sin{1}-51 \\ 324-336\cos{1}-168\sin{1} \\ 330\cos{1}+180\sin{1}-330 \end{bmatrix} \approx \begin{bmatrix} -0.007465 \\ 1.0913 \\ -0.2355 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

So, from (10),


 * {| style="width:100%" border="0"

$$ \sin{x} \approx -0.007465+1.0913x-0.2355x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

n = 4
\{ 1, x, x^2, x^3, x^4 \}

n = 6
\{ 1, x, x^2, x^3, x^4, x^5, x^6 \}

Question 3
$$n=2$$


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

$$
 * }
 * }

$$n=4$$

$$n=6$$

Problem Statement
Find the projection (approximation) of each the functions below, defined on the interval [0,1], onto the Fourier cosine basis (Fourier cosine series)


 * {| style="width:100%" border="0"

$$ \{ 1, \cos \omega x , \cos 2 \omega x , ..., \cos n \omega x \} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

1. use L = 1, which half the period p, find the circular frequency and verify the orthogonality of the Fourier basis for n = 4.

for each of the functions below, plot the exact function and its approximations.

for integration by parts, you may want to consult sec.9d, and then use Wolfram Alpha or Wolfram integrator to verify your results. for example, here is the exact integration of x^2 log(1+x).

for numerical integration, you may want to use both GNU Octave / matlab commands trapz and quad to verify your results. you can also use Wolfram integrator to verify your results when possible.

2. Exponential function: $$ e^x = \exp(x) $$ use integration by parts, and verify your results with Wolfram integrator; provide links to your Wolfram integrator results.

3. Same as in Question 1, but with the sine function: sin x

4. Same as in Question 1, but the logarithm function : log(1+x). try to integrate with integration by parts first, and and point out the difficulty in your report.

when you come to a deadend with integration by parts, use numerical integration with with both GNU Octave / matlab commands trapz

and quad to verify, and verify again with Wolfram integrator, as mentioned above.

for different values of n; here n = 2,3,4.

Solution
Circular frequency
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\omega := \frac{\pi}{L} = \frac{\pi}{1} = {\pi} $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\omega = \frac{2\pi}{p} \rightarrow {\pi} = \frac{2\pi}{p} \rightarrow p = 2 $$ family of basis functions
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\{ b_1(x), b_2(x) , b_3(x), ... , b_n(x) \} \rightarrow  \{ 1, \cos \omega x , \cos 2 \omega x , ..., \cos n \omega x \} $$ (here n = 2,3,4).
 * }
 * }

General approximation projected on the above basis:
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

f(x) \approx \sum_{j=1}^n c_j b_j(x) $$ find c_j using Gram matrix as with vectors
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\{ b_i(x), \, i=1,...n \} $$ to obtain
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\sum_{j=1}^n c_j \langle b_i, b_j \rangle = \langle b_i , f \rangle , \ i=1,...,n $$ Gram matrix:
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} \langle b_1, b_1 \rangle & ... & \langle b_1, b_n \rangle \\

\vdots & \vdots & \vdots \\ \langle b_n, b_1 \rangle & ... & \langle b_n, b_n \rangle \end{bmatrix} $$
 * }
 * }

Unknown coefficients that need to be solve:
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\mathbf c = \lfloor c_1, ... , c_n \rfloor^T $$ Known components
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\mathbf d = \lfloor \langle b_1, f \rangle , ... , \langle b_n, f \rangle \rfloor^T = \lfloor d_1 , ..., d_n \rfloor^T $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\boldsymbol \Gamma \mathbf c = \mathbf d $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma \ne 0 \Rightarrow \boldsymbol \Gamma^{-1} \text{ exists} \Rightarrow \mathbf c = \boldsymbol \Gamma^{-1} \mathbf d $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_i, b_j \rangle = \int_{a}^{b} b_i b_j dx $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_i, b_j \rangle =\langle b_j , b_i \rangle $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_1 \rangle = \int_{0}^{1} 1 dx = 1 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_2 \rangle = \int_{0}^{1}  \cos( \pi x) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_3 \rangle = \int_{0}^{1}  \cos( 2\pi x) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_4 \rangle = \int_{0}^{1}  \cos( 3\pi x) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_5 \rangle = \int_{0}^{1}  \cos( 4\pi x) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_1 \rangle = \int_{0}^{1}  \cos( \pi x) ( 1 ) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_2 \rangle = \int_{0}^{1}  \cos( \pi x) \cos( \pi x) dx = .5 $$ http://www.wolframalpha.com/input/?i=integrate+%28cos%28pi*x%29%29%28cos%28pi*x%29%29+dx+from+0+to+1
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_3 \rangle = \int_{0}^{1}  \cos( \pi x) \cos( 2\pi x) dx = 0 $$ http://www.wolframalpha.com/input/?i=integrate+%28cos%28pi*x%29%29%28cos%282pi*x%29%29+dx+from+0+to+1
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_4 \rangle = \int_{0}^{1}  \cos( \pi x) \cos( 3\pi x) dx = 0 $$ http://www.wolframalpha.com/input/?i=integrate+%28cos%28pi*x%29%29%28cos%283pi*x%29%29+dx+from+0+to+1
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_5 \rangle = \int_{0}^{1}  \cos( \pi x) \cos( 4\pi x) dx = 0 $$ http://www.wolframalpha.com/input/?i=integrate+%28cos%28pi*x%29%29%28cos%284pi*x%29%29+dx+from+0+to+1
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_1 \rangle = \langle b_0 , b_2 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_2 \rangle = \langle b_1 , b_2 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_3 \rangle = \int_{0}^{1}  \cos( 2\pi x) \cos( 2\pi x) dx = .5 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_4 \rangle = \int_{0}^{1}  \cos( 2\pi x) \cos( 3\pi x) dx = 0 $$ http://www.wolframalpha.com/input/?i=integrate+%28cos%282pi*x%29%29%28cos%283pi*x%29%29+dx+from+0+to+1
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_5 \rangle = \int_{0}^{1}  \cos( 2\pi x) \cos( 4\pi x) dx = 0 $$ http://www.wolframalpha.com/input/?i=integrate+%28cos%282pi*x%29%29%28cos%284pi*x%29%29+dx+from+0+to+1
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_1 \rangle = \langle b_0 , b_3 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_2 \rangle = \langle b_1 , b_3 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_3 \rangle = \langle b_2 , b_3 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_4 \rangle = \int_{0}^{1}  \cos( 3\pi x) \cos( 3\pi x) dx = .5 $$ http://www.wolframalpha.com/input/?i=integrate+%28cos%283pi*x%29%29%28cos%283pi*x%29%29+dx+from+0+to+1
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_5 \rangle = \int_{0}^{1}  \cos( 3\pi x) \cos( 4\pi x) dx = 0 $$ http://www.wolframalpha.com/input/?i=integrate+%28cos%283pi*x%29%29%28cos%284pi*x%29%29+dx+from+0+to+1
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_1 \rangle = \langle b_0 , b_4 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_2 \rangle = \langle b_1 , b_4 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_3 \rangle = \langle b_2 , b_4 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_4 \rangle = \langle b_3 , b_4 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_5 \rangle = \int_{0}^{1}  \cos( 4\pi x) \cos( 4\pi x) dx = .5 $$ http://www.wolframalpha.com/input/?i=integrate+%28cos%284pi*x%29%29%28cos%284pi*x%29%29+dx+from+0+to+1
 * }
 * }

Question 2
e^x = \exp(x)

n = 2

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & .5 & 0  \\ 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & .5 & 0  \\ 0 & 0 & .5 \end{bmatrix} $$ Compute known components on rhs
 * }
 * }
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} d_1 \\ d_2  \\ d_3  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_i = \langle b_i, f \rangle = \int_{a}^{b} b_i f dx $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_1 = \langle b_1, f \rangle = \int_{0}^{1} 1 e^x dx = e - 1 = 1.71828 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ d_2 = \langle b_2, f \rangle = \int_{0}^{1} \cos(\pi x) e^x dx = -.34208 $$ http://www.wolframalpha.com/input/?i=integrate+cos%28pi*x%29*e^xdx+from+0to+1
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_3 = \langle b_3, f \rangle = \int_{0}^{1} \cos(2\pi x) e^x dx = .04245

$$
 * }http://www.wolframalpha.com/input/?i=integrate+cos%282pi*x%29*e^xdx+from+0to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} 1.71828 \\ -.34208  \\ .04245  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Recall that
 * {| style="width:100%" border="0"

$$ \mathbf c = \boldsymbol \Gamma^{-1} \mathbf d $$ Substituting in to solve for the unknowns:
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$ \begin{bmatrix} c_1 \\ c_2 \\ c_3  \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0  \\ 0 & .5 & 0  \\ 0 & 0 & .5  \end{bmatrix} \begin{bmatrix} 1.71828 \\ -.34208  \\ .04245  \end{bmatrix} $$ And so
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$ \begin{bmatrix} c_1 \\ c_2 \\ c_3  \end{bmatrix} = \begin{bmatrix} 1.17828 \\ -.17104  \\ .021225  \end{bmatrix} $$ The approximation on the Fourier basis is:
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$ f(x) = e^x \approx c_1 b_1(x) + c_2 b_2(x) + c_3 b_3(x) = (1.17828)(1) + (-.17104)(\cos(\pi x)) + (.021225)(\cos(2\pi x)) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

n = 3

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }

Compute known components on rhs
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} d_1 \\ d_2  \\ d_3 \\d_4 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_i = \langle b_i, f \rangle = \int_{a}^{b} b_i f dx $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_1 = \langle b_1, f \rangle = \int_{0}^{1} 1 e^x dx = e - 1 = 1.71828 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ d_2 = \langle b_2, f \rangle = \int_{0}^{1} \cos(\pi x) e^x dx = -.34208 $$ http://www.wolframalpha.com/input/?i=integrate+cos%28pi*x%29*e^xdx+from+0to+1
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_3 = \langle b_3, f \rangle = \int_{0}^{1} \cos(2\pi x) e^x dx = .04245

$$
 * }http://www.wolframalpha.com/input/?i=integrate+cos%282pi*x%29*e^xdx+from+0to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_4 = \langle b_4, f \rangle = \int_{0}^{1} \cos(3\pi x) e^x dx \approx -.04139

$$ http://www.wolframalpha.com/input/?i=integrate+cos%283pi*x%29*e^xdx+from+0+to+1
 * }
 * }
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} 1.71828 \\ -.34208  \\ .04245 \\-.04139 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Recall that
 * {| style="width:100%" border="0"

$$ \mathbf c = \boldsymbol \Gamma^{-1} \mathbf d $$ Substituting in to solve for the unknowns:
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$ \begin{bmatrix} c_1 \\ c_2 \\ c_3 \\c_4 \end{bmatrix} = \begin{bmatrix}  1 & 0 & 0 & 0  \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} \begin{bmatrix} 1.71828 \\ -.34208  \\ .04245 \\-.04139 \end{bmatrix} $$ And so
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$ \begin{bmatrix} c_1 \\ c_2 \\ c_3 \\c_4 \end{bmatrix} = \begin{bmatrix} 1.17828 \\ -.17104  \\ .021225 \\-.020695 \end{bmatrix} $$ The approximation on the Fourier basis is:
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$ f(x) = e^x \approx c_1 b_1(x) + c_2 b_2(x) + c_3 b_3(x) + c_4 b_4(x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ \approx (1.17828)(1) + (-.17104)(\cos(\pi x)) + (.021225)(\cos(2\pi x)) + (-.020695)(\cos(3\pi x)) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

n = 4

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 & 0 \\ 0 & 0 & .5 & 0 & 0 \\ 0 & 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }

Question 3
sin(x)

n = 2

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & .5 & 0  \\ 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & .5 & 0  \\ 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }

n = 3

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }

n = 4

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 & 0 \\ 0 & 0 & .5 & 0 & 0 \\ 0 & 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }

Question 4
log(1 + x)

n = 2

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & .5 & 0  \\ 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & .5 & 0  \\ 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }

n = 3

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }

n = 4

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 \\ 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & .5 & 0 & 0 & 0 \\ 0 & 0 & .5 & 0 & 0 \\ 0 & 0 & 0 & .5 & 0 \\ 0 & 0 & 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }

Problem Statement

 * {| style="width:100%" border="0"

$$ f(x) = a_0 + \sum_{n=1}^\infty [a_n \cos n \omega x + b_n \sin n \omega x] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \omega = \frac{2\pi}{p} = \frac{2\pi}{2L} = \frac{\pi}{L} \Rightarrow p = \frac{2 \pi}{\omega} = 2L $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

1. plot the constant function $$ a_0 $$. What is the period of the constant function $$ a_0 $$? Deduce that the constant function $$ a_0 $$ is periodic p=2L.

2. plot the functions $$ cos3\omega x $$ and $$ sin3\omega x $$ with L = 2. what is the smallest period of the periodic functions $$ cos3\omega x $$ and $$ sin3\omega x $$ ? deduce that these periodic functions have period p = 2L. hint: find the period $$ \bar{p} $$ of the function $$ cos\bar{\omega}x $$ with $$ \bar{\omega}=3\omega $$, and relate $$ \bar{p} $$ to p.

3. now the general case, what is the smallest period of the periodic functions $$ cosn\omega x $$ and $$ sinn\omega x $$, where n can be any positive integer? deduce that these periodic functions have period p = 2L. similar hint as above.

4. do the Fourier series expansion of some simple functions.


 * {| style="width:100%" border="0"

$$ f(x) = x^2 (-1<x<1), p=2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and


 * {| style="width:100%" border="0"

$$ f(x) = 1-\frac{x^2}{4} (-2<x<2), p=4 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Verification
"Verifying: Part 1"

The following is a property of all periodic functions (not necessarily continuous)


 * {| Italic textstyle="width:100%" border="0"

$$ f(\hat x + n p) = f(\hat x), \text{ for any } \hat x
 * style="width:95%" |
 * style="width:95%" |

\text{ andfor all } n = ..., -2, -1, 0, 1, 2,... $$
 * }
 * }

where


 * {| Italic textstyle="width:100%" border="0"

$$ \hat x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

is a fixed, selected point (to distinguish from the variable x) and p is the period.

From now on, the hat over x will be omitted for simplicity in later calculations.

This property describes a period by showing how the value at any point x in period is

equivalent to that point x plus or minus p for any other period of the function.

Using this property we will describe that one period of a periodic function will start

at x=a and end at x=b. First we want to find the center of a and b.


 * {| Italic textstyle="width:100%" border="0"

$$ \frac{a + b}{2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can find the distance from this center to either end of the period.


 * {| Italic textstyle="width:100%" border="0"

$$ \text{ from a } \Rightarrow \bar x = a - \frac{a + b}{2} = \frac{a + b}{2} = -\frac{b - a}{2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \text{ from b } \Rightarrow \bar x = b - \frac{a + b}{2} = \frac{-a + b}{2} = \frac{b - a}{2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Substituting 2L in for (b - a), since 2L is equal to one period yields:


 * {| Italic textstyle="width:100%" border="0"

$$ \text{ from a } \Rightarrow \bar x = \frac{-2L}{2} = -L $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \text{ from b } \Rightarrow \bar x = \frac{2L}{2} = L $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

With the period extending a magnitude of L on either side of the center point, it can be

deduced by adding these two magnitudes together that from a to b is 2L. Therefore, we

can now say that:


 * {| Italic textstyle="width:100%" border="0"

$$ p = 2L $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Since
 * {| Italic textstyle="width:100%" border="0"

$$ a_0 $$ is the first term of the Fourier Series and represents the average of the function, it
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

is a constant function (a straight line) like y = 0 shown below.



Constant functions can have any period because the value of the function at all points

is the same. Therefore, it too has a period of 2L.

"Verifying: Part 2"

We are given the following functions (each with L = 2):


 * {| Italic textstyle="width:100%" border="0"

$$ \cos 3 \omega x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \sin 3 \omega x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using the following property of periodic functions


 * {| Italic textstyle="width:100%" border="0"

$$ f(x + n p) = f(x), \text{ for any } \hat x
 * style="width:95%" |
 * style="width:95%" |

\text{ andfor all } n = ..., -2, -1, 0, 1, 2,... $$
 * }
 * }

we can find the period of these two functions by finding the two the distance between

two consecutive points where the functions have equivalent values.

Both functions have the same distance between consecutive points:




 * {| Italic textstyle="width:100%" border="0"

$$ \text{distance} = \frac{4}{3} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This value can be compared to the distance between equivalent

values of the function when looking at the function


 * {| Italic textstyle="width:100%" border="0"

$$ \cos \omega x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \text{distance} = 4 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

It can be seen that there is a difference between these two distances of a factor

of 3. This factor of 3 affects the value of L.




 * {| Italic textstyle="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

$$ Using the following equality
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \omega = \frac{\pi}{L} = \frac{2 \pi}{p} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

we can conclude that


 * {| Italic textstyle="width:100%" border="0"

$$ p = 2L = \frac{2 \pi}{\omega} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

So for the original functions given L is one third of the L for


 * {| Italic textstyle="width:100%" border="0"

$$ \cos \omega x $$ , but, while L may be defined differently, it still holds that the period of each
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

function is two times what L is.

This can be seen is how substituting L in the original equations for 3L yields an graph

equivalent to that of the equation using omega instead of 3 times omega.

"Verifying: Part 3"

With the general case


 * {| Italic textstyle="width:100%" border="0"

$$ \cos n \omega x \text{ and } \sin n \omega x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

for any positive integer n the period can also be deduced to be equal to 2L through a

the same process as deducing the period for


 * {| Italic textstyle="width:100%" border="0"

$$ \cos 3 \omega x \text{ and } \sin 3 \omega x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For this general case, though, the value of L is affected by a factor of n so that

the L of this function is equal to 1/n of the L for the simplest case of


 * {| Italic textstyle="width:100%" border="0"

$$ \cos \omega x \text{ and } \sin \omega x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

So, as explained earlier, although the value of L changes, the period p of the function

can be still be defined as


 * {| Italic textstyle="width:100%" border="0"

$$ p = 2L $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Fourier Series Expansion Problems
"Problem #11"

The following is the function given with period, p, equal to 2.


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

on the interval (-1 < x < 1).

The Fourier Series is defined, in general, as


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = a_0 + \sum_{n=1}^\infty [a_n \cos n \omega x + b_n \sin n \omega x] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The three coefficients are defined, in general as


 * {| Italic textstyle="width:100%" border="0"

$$ a_0 = \frac{1}{p} \int_{0}^{p} f(x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ a_n = \frac{2}{p} \int_{0}^{p} f(x) \cos(n \omega x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ b_n = \frac{2}{p} \int_{0}^{p} f(x) \sin(n \omega x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in the values and function given yields the following results


 * {| Italic textstyle="width:100%" border="0"

$$ a_0 = \frac{1}{2} \int_{0}^{2} x^{2} dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{1}{2} [\frac{1}{3} x^{3}]_{0}^{2} = \frac{4}{3} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ a_n = \frac{2}{2} \int_{0}^{2} x^{2} \cos(n \pi x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = [\frac{1}{3} x^{3} \cos(n \pi x) + \frac{1}{n \pi} x^{2} \sin(n \pi x)]_{0}^{2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{8}{3} \cos(2 n \pi) + \frac{4}{n \pi} \sin(2 n \pi) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \text{Since sine of any integer times } 2 \pi \text{ equals zero this term can be omitted.} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{8}{3} \cos(2 n \pi) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ b_n = \frac{2}{2} \int_{0}^{2} x^{2} \sin(n \omega x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = [\frac{1}{3} x^{3} \sin(n \pi x) - \frac{1}{n \pi} x^{2} \cos(n \pi x)]_{0}^{2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{1}{3} 2^{3} \sin(2 n \pi) - \frac{1}{n \pi} 2^{2} \cos(2 n \pi) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \text{Since sine of any integer times } 2 \pi \text{ equals zero this term can be omitted.} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{-4}{n \pi} \cos(2 n \pi) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Putting these values into the Fourier Series equation and cancelling out terms that come out

to zero yields:


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = \frac{4}{3} + \sum_{n=1}^{\infty}[\frac{8}{3} \cos(2 n \pi) \cos(n \pi x)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

"Problem #12"

The following is the function given with period, p, equal to 4.


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = 1 - \frac{x^2}{4} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

on the interval (-2 < x <2).

The Fourier Series is defined, in general, as


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = a_0 + \sum_{n=1}^\infty [a_n \cos n \omega x + b_n \sin n \omega x] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The three coefficients are defined, in general as


 * {| Italic textstyle="width:100%" border="0"

$$ a_0 = \frac{1}{p} \int_{0}^{p} f(x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ a_n = \frac{2}{p} \int_{0}^{p} f(x) \cos(n \omega x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ b_n = \frac{2}{p} \int_{0}^{p} f(x) \sin(n \omega x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in the values and function given yields the following results


 * {| Italic textstyle="width:100%" border="0"

$$ a_0 = \frac{1}{4} \int_{0}^{4} 1 - \frac{x^{2}}{4} dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{1}{4} [x - \frac{x^{3}}{12}]_{0}^{4} = \frac{-1}{3} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ a_n = \frac{2}{4} \int_{0}^{4} 1 - \frac{x^{2}}{4} \cos(n \frac{\pi}{2} x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{1}{2} [\frac{2}{n \pi} \sin(n \frac{\pi}{2} x) - \frac{x^{3}}{12} \cos(n \frac{\pi}{2} x) + \frac{x^{2}}{2 n \pi} \sin(n \frac{\pi}{2} x)]_{0}^{4} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{1}{2} [\frac{2}{n \pi} \sin(2 n \pi) - \frac{16}{3} \cos(2 n \pi) + \frac{8}{n \pi} \sin(2 n \pi)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \text{Since sine of any integer times } 2 \pi \text{ equals zero these terms can be omitted.} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{-8}{3} \cos(2 n \pi) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ b_n = \frac{2}{4} \int_{0}^{4} 1 - \frac{x^{2}}{4} \sin(n \frac{\pi}{2} x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{1}{2} [\frac{-2}{n \pi} \cos(n \frac{\pi}{2} x) - \frac{x^{3}}{12} \sin(n \frac{\pi}{2} x) + \frac{x^{2}}{2 n \pi} \cos(n \frac{\pi}{2} x)]_{0}^{4} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{1}{2} [\frac{-2}{n \pi} \cos(2 n \pi) - \frac{16}{3} \sin(2 n \pi) + \frac{8}{n \pi} \cos(2 n \pi)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \text{Since sine of any integer times } 2 \pi \text{ equals zero this term can be omitted.} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{-1}{n \pi} \cos(2 n \pi) + \frac{4}{n \pi}cos(2 n \pi) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{3}{n \pi} \cos(2 n \pi) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Putting these values into the Fourier Series equation yields:


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = \frac{-1}{3} + \sum_{n=1}^{\infty}[\frac{-8}{3} \cos(2 n \pi) \cos(n \pi x) + \frac{3}{n \pi} \cos(2 n \pi)sin(\frac{\pi}{2} n x)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Problem Statement
Create a spreadsheet with the 88 piano keys, their corresponding frequencies (pitches), and deduce for each

pitch the music note (in scientific notation) for that piano key, using the spreadsheet formulas provided in

this section. also, check your results with portions of this spreadsheet, as given in this section.

Solution
The table below shows the frequencies of all 88 piano keys along with pitch for each corresponding piano key. All other information was a supplement to the calculations performed. The following formula was provided and used to find the frequency of each piano key.


 * {| Italic textstyle="width:100%" border="0"

$$ f_n = f_1 * (\sqrt[12]{2} \,)^{(n-1)}, \ \text{with } f_1 = 27.5 \text{ Hz } $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

$$ f_1 $$ is given and remains constant through all frequency calculations performed for the table.

$$ (\sqrt[12]{2} \,)^{(n-1)} $$ represents the frequency factor where $$ n $$ represents the key number.

The part of the frequency formula that is used to find frequency factor is derived from the premise that an octave is divided into 12 semitones. The ratio of the 2 frequencies to the 2 successive semitones equals $$ (\sqrt[12]{2} \,) $$.

The number of keys from A0 is approximated by $$ n-1 $$.

When the calculated frequency is not an exact key away from A0 ($$ n-1 $$ is not a round integer number) the following equation is used to find the key number away from A0 that is closest to the calculated frequency.


 * {| Italic textstyle="width:100%" border="0"

$$ n-1 = 12 * \ln ( f_n / f_1 ) / \ln(2) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The key number within an octave was found using the excel formula MOD(ROUND(n-1,0),12)+1 where ROUND(n-1,0) equals rounding (n-1) with a zero decimal digit and MOD(m, 12) equals the remainder of m divided by 12.

Finally the octave number was determined by using the excel test

if ("key no. in an octave"<4) then

QUOTIENT (ROUND(n-1, 0), 12)

else

QUOTIENT (ROUND(n-1, 0), 12) + 1

endif