# University of Florida/Egm4313/s12.team11.R6

Report 6

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

## R6.1

Solved by Daniel Suh

### Problem Statement

• Find the fundamental period of ${\displaystyle \cos(n\omega x)\!}$ and ${\displaystyle \sin(n\omega x)\!}$
• Show that these functions also have period ${\displaystyle p\!}$.
• Show that the constants ${\displaystyle a_{0}\!}$ is also a periodic function with period ${\displaystyle p\!}$.

### Solution

• Find the fundamental period, and show that these functions have a period of ${\displaystyle p\!}$.

${\displaystyle p=2L=2{\frac {\pi }{\omega }}\!}$

${\displaystyle L={\frac {\pi }{\omega }}\!}$

${\displaystyle f(x+np)=f(x)\!}$

${\displaystyle f(x)=cos(n\omega x)\!}$

${\displaystyle f(x+n{\frac {2\pi }{n\omega }})=cos(n\omega (x+{\frac {2\pi }{n\omega }}))\!}$

${\displaystyle f(x+{\frac {2\pi }{\omega }})=cos(n\omega x+2\pi )\!}$

${\displaystyle f(x+2L)=cos(n\omega x+2\pi )\!}$

              ${\displaystyle p=2L\!}$ is the fundamental period for ${\displaystyle cos(n\omega x)\!}$.


${\displaystyle f(x+np)=f(x)\!}$

${\displaystyle f(x)=sin(n\omega x)\!}$

${\displaystyle f(x+n{\frac {2\pi }{n\omega }})=sin(n\omega (x+{\frac {2\pi }{n\omega }}))\!}$

${\displaystyle f(x+{\frac {2\pi }{\omega }})=sin(n\omega x+2\pi )\!}$

${\displaystyle f(x+2L)=sin(n\omega x+2\pi )\!}$

              ${\displaystyle p=2L\!}$ is the fundamental period for ${\displaystyle sin(n\omega x)\!}$.

• Show that the constants ${\displaystyle a_{0}\!}$ is also a periodic function with period ${\displaystyle p\!}$.

From Fourier Series,
${\displaystyle a_{0}={\frac {1}{2L}}\int _{-L}^{L}f(x)dx\!}$

${\displaystyle f(x)=\cos(n\omega x)\!}$

${\displaystyle a_{0}={\frac {\omega }{2\pi }}\int _{-{\frac {\pi }{\omega }}}^{\frac {\pi }{\omega }}cos(n\omega x)dx\!}$

${\displaystyle a_{0}={\frac {\omega }{2\pi }}[{\frac {sin(n\omega x)}{n\omega }}|_{-{\frac {\pi }{\omega }}}^{\frac {\pi }{\omega }}]\!}$

${\displaystyle a_{0}={\frac {\omega }{2\pi }}[{\frac {2sin(n\pi )}{n\omega }}]\!}$

          ${\displaystyle a_{0}=0\!}$


${\displaystyle f(x)=\sin(n\omega x)\!}$

${\displaystyle a_{0}={\frac {\omega }{2\pi }}\int _{-{\frac {\pi }{\omega }}}^{\frac {\pi }{\omega }}sin(n\omega x)dx\!}$

${\displaystyle a_{0}={\frac {\omega }{2\pi }}[{\frac {cos(n\omega x)}{n\omega }}|_{-{\frac {\pi }{\omega }}}^{\frac {\pi }{\omega }}]\!}$

${\displaystyle a_{0}={\frac {\omega }{2\pi }}[{\frac {-cos{n\pi }+cos{n\pi }}{n\omega }}]\!}$

          ${\displaystyle a_{0}=0\!}$


## R6.2

### Problem Statement

Solve the problems 11 and 12 from Kreyszig p.491

### Solution

First, for problem 11:
${\displaystyle f(x)=x^{2}\!}$ from ${\displaystyle <-1\!}$ where ${\displaystyle p=2\!}$ We know that ${\displaystyle p=2=2L\!}$ so that ${\displaystyle L=1\!}$

We check is the function is even, odd or neither.
Since ${\displaystyle f(x)\!}$ satisfies the condition ${\displaystyle f(x)=f(-x)\!}$ we know that the function is even.
Given that the function is even and that ${\displaystyle b_{n}=0\!}$ for even functions, we exclude the ${\displaystyle b_{n}\!}$ term from the Fourier Series.

We find ${\displaystyle a_{0}\!}$:
${\displaystyle a_{0}={\frac {1}{2L}}\int _{-L}^{L}f(x)dx\!}$
Plugging in,
${\displaystyle a_{0}={\frac {1}{2}}\int _{-1}^{1}x^{2}dx={\frac {1}{2}}\left[{\frac {1}{3}}x^{3}\right]_{-1}^{1}={\frac {1}{2}}\left[{\frac {1}{3}}+{\frac {1}{3}}\right]={\frac {1}{3}}\!}$

We find ${\displaystyle a_{n}\!}$
${\displaystyle a_{n}={\frac {1}{L}}\int _{-L}^{L}f(x)cos({\frac {n\pi x}{L}})dx\!}$
${\displaystyle a_{n}=1\int _{-1}^{1}x^{2}cos(n\pi x)dx\!}$
We can use the equivalent expression:
${\displaystyle a_{n}=2\int _{0}^{1}x^{2}cos(n\pi x)dx\!}$

Now we evaluate the integral by using integration by parts. Below are the steps:
Integration by parts uses ${\displaystyle \int fdg=fg-\int gdf\!}$
${\displaystyle {\begin{matrix}f=x^{2}&dg=cos(\pi nx)dx\\df=2xdx&g={\frac {sin(\pi nx)}{\pi n}}\end{matrix}}\!}$
Then, we have:
${\displaystyle \left[{\frac {x^{2}sin(\pi nx)}{\pi n}}\right]_{0}^{1}-{\frac {2}{\pi n}}\int _{0}^{1}xsin(\pi nx)dx\!}$
Repeating for the second term:
${\displaystyle {\begin{matrix}f=x&dg=sin(\pi nx)\\df=dx&g={\frac {-cos(\pi nx)}{\pi n}}\end{matrix}}\!}$
Then, we have:
${\displaystyle \left[{\frac {-xcos(\pi nx)}{\pi n}}\right]_{0}^{1}-{\frac {1}{\pi n}}\int _{0}^{1}cos(\pi nx)dx\!}$
Bringing all the terms together:
${\displaystyle 2\left[\left[{\frac {x^{2}sin(\pi nx)}{\pi n}}\right]_{0}^{1}-{\frac {2}{\pi n}}\left[{\frac {-xcos(\pi nx)}{\pi n}}\right]_{0}^{1}-{\frac {1}{\pi n}}\int _{0}^{1}cos(\pi nx)dx\right]\!}$
Then,
${\displaystyle 2\left[\left[{\frac {x^{2}sin(\pi nx)}{\pi n}}\right]_{0}^{1}-{\frac {2}{\pi n}}\left[{\frac {-xcos(\pi nx)}{\pi n}}\right]_{0}^{1}-{\frac {1}{\pi n}}\left[{\frac {sin(\pi nx)}{\pi n}}\right]_{0}^{1}\right]\!}$
Evaluating at the boundaries and simplifying:
${\displaystyle 2\left[\left[0-0\right]+{\frac {2}{\pi ^{2}n^{2}}}\left[cos(\pi n)\right]-{\frac {1}{\pi n}}\left[0-0\right]\right]\!}$
Further,
${\displaystyle {\frac {4}{\pi ^{2}n^{2}}}cos(\pi n)\!}$
We can simplify one step further by acknowledging that ${\displaystyle cos(\pi n)=(-1)^{n}\!}$.
${\displaystyle \therefore a_{n}={\frac {4}{\pi ^{2}n^{2}}}(-1)^{n}\!}$

Finally,
${\displaystyle f(x)=a_{0}+\sum _{n=1}^{\infty }a_{n}cos({\frac {\pi n}{L}})x\!}$

The Fourier series is:

                                   ${\displaystyle f(x)={\frac {1}{3}}+\sum _{n=1}^{\infty }{\frac {4}{\pi ^{2}n^{2}}}(-1)^{n}cos(\pi n)x\!}$


Now problem 12:
${\displaystyle f(x)=1-{\frac {x^{2}}{4}}\!}$ from ${\displaystyle <-2\!}$ where ${\displaystyle p=2\!}$ We know that ${\displaystyle p=4=2L\!}$ so that ${\displaystyle L=2\!}$

We check is the function is even, odd or neither.
Since ${\displaystyle f(x)\!}$ satisfies the condition ${\displaystyle f(x)=f(-x)\!}$ we know that the function is even.
Given that the function is even and that ${\displaystyle b_{n}=0\!}$ for even functions, we exclude the ${\displaystyle b_{n}\!}$ term from the Fourier Series.

We find ${\displaystyle a_{0}\!}$:
${\displaystyle a_{0}={\frac {1}{2L}}\int _{-L}^{L}f(x)dx\!}$
Plugging in,
${\displaystyle a_{0}={\frac {1}{4}}\int _{-2}^{2}1-{\frac {x^{2}}{4}}dx={\frac {1}{4}}\left[x-{\frac {1}{12}}x^{3}\right]_{-2}^{2}={\frac {1}{4}}\left[{\frac {24-8}{12}}-{\frac {24+8}{12}}\right]={\frac {2}{3}}\!}$

We find ${\displaystyle a_{n}\!}$
${\displaystyle a_{n}={\frac {1}{L}}\int _{-L}^{L}f(x)cos({\frac {n\pi x}{L}})dx\!}$
${\displaystyle a_{n}={\frac {1}{2}}\int _{-2}^{2}(1-{\frac {x^{2}}{4}}cos(n\pi x)dx\!}$
Now we evaluate the integral by using integration by parts. This process is similar to the one shown in the solution for problem 11 above and therefore will be performed in Wolfram Alpha.
The following command was given in Wolfram Alpha: integral (1-(x^2/4))*cos(pi*x) from -2 to 2.
Wolfram Alpha yields the following
${\displaystyle {\frac {2}{\pi ^{2}n^{2}}}\!}$

Finally,
${\displaystyle f(x)=a_{0}+\sum _{n=1}^{\infty }a_{n}cos({\frac {\pi n}{L}})x\!}$

The Fourier series is:

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


### Part B

Solved by Francisco Arrieta

### Problem Statement

Find the Fourier series expansion for ${\displaystyle f(x)\!}$ on p. 9.8 as follows:

#### Part 1

Develop the Fourier series expansion of ${\displaystyle f({\bar {x}})\!}$

Plot ${\displaystyle f({\bar {x}})\!}$ and the truncated Fourier series ${\displaystyle f_{n}({\bar {x}})\!}$

${\displaystyle f_{n}({\bar {x}}):={\bar {a}}_{0}+\sum _{k=1}^{n}[{\bar {a}}_{k}\cos k\omega {\bar {x}}+{\bar {b}}_{k}\sin k\omega {\bar {x}}]\!}$

for n=0,1,2,4,8. Observe the values of ${\displaystyle f_{n}({\bar {x}})\!}$ at the points of discontinuities, and the Gibbs phenomenon. Transform the variable so to obtain the Fourier series expansion of ${\displaystyle f(x)\!}$

#### Solution

${\displaystyle p=2L=4\!}$
${\displaystyle L=2\!}$
${\displaystyle \omega ={\frac {2\pi }{p}}\!}$

${\displaystyle {\bar {a}}_{0}={\frac {1}{2L}}\int _{-L}^{L}f({\bar {x}})d{\bar {x}}\!}$

${\displaystyle {\bar {a}}_{0}={\frac {1}{4}}\int _{-2}^{2}f({\bar {x}})d{\bar {x}}\!}$
${\displaystyle {\bar {a}}_{0}={\frac {A}{2}}\!}$

${\displaystyle {\bar {a}}_{k}={\frac {1}{L}}\int _{-L}^{L}f({\bar {x}})\cos k\omega {\bar {x}}d{\bar {x}}\!}$

${\displaystyle {\bar {a}}_{k}={\frac {1}{2}}\int _{-2}^{2}f({\bar {x}})\cos {\frac {k\pi {\bar {x}}}{2}}d{\bar {x}}\!}$
${\displaystyle {\bar {a}}_{k}={\frac {2A}{k\pi }}\sin {\frac {k\pi }{2}}\!}$

Note:

If k is even ${\displaystyle {\bar {a}}_{k}=0\!}$

If k=1, 5, 9... ${\displaystyle {\bar {a}}_{k}={\frac {2A}{k\pi }}\!}$

If k=3, 7, 11... ${\displaystyle {\bar {a}}_{k}={\frac {-2A}{k\pi }}\!}$

${\displaystyle {\bar {b}}_{k}={\frac {1}{L}}\int _{-L}^{L}f({\bar {x}})\sin k\omega {\bar {x}}d{\bar {x}}\!}$

Note:

${\displaystyle {\bar {b}}_{k}=0\!}$ for n=1, 2...

Then Fourier series becomes a Fourier cosine series:

                                              ${\displaystyle f_{k}({\bar {x}})={\frac {A}{2}}+\sum _{k=1}^{n}({\frac {2A}{k\pi }}\cos {\frac {k\pi }{2}}{\bar {x}})\!}$


For n=0

                                              ${\displaystyle f_{k}({\bar {x}})={\frac {A}{2}}\!}$


For n=1

                                              ${\displaystyle f_{k}({\bar {x}})={\frac {A}{2}}+({\frac {2A}{\pi }}\cos {\frac {\pi }{2}}{\bar {x}})\!}$


For n=5

                                              ${\displaystyle f_{k}({\bar {x}})={\frac {A}{2}}+{\frac {2A}{\pi }}(\cos {\frac {\pi }{2}}{\bar {x}}-{\frac {1}{3}}\cos {\frac {3\pi }{2}}{\bar {x}}+{\frac {1}{5}}\cos {\frac {5\pi }{2}}{\bar {x}})\!}$


After transforming the variable of ${\displaystyle f({\bar {x}})\!}$

                                              ${\displaystyle f_{k}(x)={\frac {A}{2}}+\sum _{k=1}^{n}({\frac {2A}{k\pi }}\cos {\frac {k\pi }{2}}(x-1.25))\!}$


#### Part 2

Do the same as above, but using ${\displaystyle f({\tilde {x}})\!}$ to obtain the Fourier expansion of ${\displaystyle f(x)\!}$ ; compare to the result obtained above

#### Solution

${\displaystyle p=2L=4\!}$
${\displaystyle L=2\!}$
${\displaystyle \omega ={\frac {2\pi }{p}}\!}$

${\displaystyle {\tilde {a}}_{0}={\frac {1}{2L}}\int _{0}^{2L}f({\tilde {x}})d{\tilde {x}}\!}$

${\displaystyle {\tilde {a}}_{0}={\frac {1}{4}}\int _{0}^{4}f({\tilde {x}})d{\tilde {x}}\!}$
${\displaystyle {\tilde {a}}_{0}={\frac {A}{2}}\!}$

${\displaystyle {\tilde {a}}_{k}={\frac {1}{L}}\int _{0}^{2L}f({\tilde {x}})\cos k\omega {\tilde {x}}d{\tilde {x}}\!}$

${\displaystyle {\tilde {a}}_{k}={\frac {1}{2}}\int _{0}^{4}f({\tilde {x}})\cos k\omega {\tilde {x}}d{\tilde {x}}\!}$
${\displaystyle {\tilde {a}}_{k}={\frac {A}{k\pi }}\sin \pi k\!}$

Note:

${\displaystyle {\bar {b}}_{k}=0\!}$ for n=1, 2..

${\displaystyle {\tilde {b}}_{k}={\frac {1}{L}}\int _{0}^{2L}f({\tilde {x}})\sin k\omega {\tilde {x}}d{\tilde {x}}\!}$

${\displaystyle {\tilde {b}}_{k}={\frac {1}{2}}\int _{0}^{4}f({\tilde {x}})\sin k{\frac {\pi }{2}}{\tilde {x}}d{\tilde {x}}\!}$
${\displaystyle {\tilde {b}}_{k}={\frac {-A}{\pi k}}(\cos \pi k-1)\!}$

Note:

If k is even ${\displaystyle {\bar {a}}_{k}=0\!}$

If k=1, 3, 5... ${\displaystyle {\bar {a}}_{k}={\frac {2A}{k\pi }}\!}$

Then Fourier series becomes a Fourier sine series:

                                              ${\displaystyle f_{k}({\tilde {x}})={\frac {A}{2}}+\sum _{k=1}^{n}({\frac {2A}{k\pi }}\sin {\frac {k\pi }{2}}{\tilde {x}})\!}$


For n=0:

                                              ${\displaystyle f_{k}({\tilde {x}})={\frac {A}{2}}\!}$


For n=1:

                                              ${\displaystyle f_{k}({\tilde {x}})={\frac {A}{2}}+({\frac {2A}{\pi }}\sin {\frac {\pi }{2}}{\tilde {x}})\!}$


For n=5:

                                              ${\displaystyle f_{k}({\tilde {x}})={\frac {A}{2}}+{\frac {2A}{\pi }}(\sin {\frac {\pi }{2}}{\tilde {x}}+{\frac {1}{3}}\sin {\frac {3\pi }{2}}{\tilde {x}}+{\frac {1}{5}}\sin {\frac {5\pi }{2}}{\tilde {x}})\!}$


After transforming the variable of ${\displaystyle f({\bar {x}})\!}$

                                              ${\displaystyle f_{k}(x)={\frac {A}{2}}+\sum _{k=1}^{n}({\frac {2A}{k\pi }}\sin {\frac {k\pi }{2}}(x-.25))\!}$


## R6.3

### Problem Statement

Page 491, #15,17. Plot the truncated Fourier series for n=2,4,8.

### Solution

15.

${\displaystyle f(x)=\left\{{\begin{matrix}-x-\pi ,-\pi

Since ${\displaystyle f(-x)=-f(x)}$, the function is odd.

${\displaystyle a_{0}=(1/\pi )*[-1\int _{-\pi }^{-\pi /2}(x+\pi )dx+\int _{-\pi /2}^{\pi /2}(x)dx+\int _{\pi /2}^{\pi }(\pi -x)dx]}$
After simplification, ${\displaystyle a_{0}=0}$
. Using Equation (5) on page 490, the exapansion becomes;
${\displaystyle f(x)=8k/\pi ^{2}[sin(\pi *x/L)-sin(3\pi *x/L)/9...)}$
With ${\displaystyle L=\pi ,k=\pi /2}$ this becomes;
${\displaystyle f(x)=4/\pi (sinx-sin(3x)/9+sin(5x)/25-sin(6x)/36....)}$ for n is "odd".
This means when n is even, ${\displaystyle f(x)=0}$

17.
${\displaystyle f(x)=1-|x|,-1\leq x\leq 1}$

${\displaystyle f(x)=\left\{{\begin{matrix}1+x-\pi ,-1

${\displaystyle a_{0}=1/2[\int _{-1}^{0}(1+x)dx+\int _{0}^{1}(1-x)dx]}$
${\displaystyle a_{0}=1/2[1-1/2+1-1/2]}$

 ${\displaystyle a_{0}=1/2}$


${\displaystyle a_{n}=1/1[\int _{-1}^{0}(1+x)cos(n\pi *x/1)dx+\int _{0}^{1}(1-x)cos(n\pi *x/1)dx]}$
Simplifying results in;
${\displaystyle a_{n}=2[1/(n^{2}\pi ^{2})_{(}-1)^{n}/(n^{2}\pi ^{2})]}$
So,

${\displaystyle a_{n}=4/(n^{2}\pi ^{2})}$


when n is odd.
${\displaystyle b_{n}=1/1[\int _{-1}^{0}(1+x)sin(n\pi *x/1)dx+\int _{0}^{1}(1-x)sin(n\pi *x/1)dx]}$
Simplifying results in;

${\displaystyle b_{n}=0}$


${\displaystyle f(x)=1/2+\sum _{n=0}^{\infty }4/(n^{2}\pi ^{2})*cos(n\pi *x)}$

Since ${\displaystyle a_{n}=0}$ for even n, ${\displaystyle f(x)}$ becomes ${\displaystyle f(x)=1/2}$ for even n.

## R6.4

solved by Luca Imponenti

### Problem Statement

Consider the L2-ODE-CC (5) p.7b-7 with the window function f(x) p.9-8 as excitation:

${\displaystyle y''-3y'+2y=f(x)\!}$

and the initial conditions

${\displaystyle y(0)=1\ ,\ y'(0)=0\!}$

1. Find ${\displaystyle y_{n}(x)\!}$ such that:

${\displaystyle y_{n}''+ay_{n}'+by_{n}=r_{n}(x)\!}$

with the same initial conditions as above.

Plot ${\displaystyle y_{n}(x)\!}$ for ${\displaystyle n=2,4,8\!}$ for x in ${\displaystyle [0,10]\!}$

2. Use the matlab command ode45 to integrate the L2-ODE-CC, and plot the numerical solution to compare with the analytical solution.

Level 1: ${\displaystyle n=0,1\!}$

### Fourier Series

One period of the window function p9.8 is described as follows

${\displaystyle f(x)={\begin{cases}0&\ \ -1.75

From the above intervals one can see that the period, ${\displaystyle p=4\!}$ and therefore ${\displaystyle L=2\!}$ Applying the Euler formulas from ${\displaystyle -1.75}$ to ${\displaystyle 2.25\!}$ the Fourier coefficients are computed:

${\displaystyle a_{0}={\frac {1}{2L}}\int _{-1.75}^{2.25}f(x)\ dx\!}$

${\displaystyle a_{0}={\frac {1}{4}}(\int _{-1.75}^{0.25}0\ dx+\int _{0.25}^{2.25}A\ dx)\!}$

${\displaystyle a_{0}=+{\frac {1}{4}}(0+\int _{0.25}^{2.25}A\ dx)\!}$

${\displaystyle a_{0}={\frac {1}{4}}(2.25A-0.25A)\!}$

${\displaystyle a_{0}={\frac {A}{2}}\!}$

The integral from ${\displaystyle -1.75\!}$ to ${\displaystyle 0.25\!}$ can be omitted from this point on since it is always zero.

${\displaystyle a_{n}={\frac {1}{L}}\int _{0.25}^{2.25}f(x)cos({\frac {n\pi x}{L}})\ dx\!}$

${\displaystyle a_{n}={\frac {1}{2}}\int _{0.25}^{2.25}Acos({\frac {n\pi x}{2}})\ dx\!}$

${\displaystyle a_{n}={\frac {2A}{2n\pi }}(sin({\frac {2.25n\pi }{2}})-sin({\frac {0.25n\pi }{2}})\!}$

${\displaystyle a_{n}={\frac {A}{n\pi }}(sin({\frac {9n\pi }{8}})-sin({\frac {n\pi }{8}})\!}$

and

${\displaystyle b_{n}={\frac {1}{L}}\int _{0.25}^{2.25}f(x)sin({\frac {n\pi x}{L}})\ dx\!}$

${\displaystyle b_{n}={\frac {1}{2}}\int _{0.25}^{2.25}Asin({\frac {n\pi x}{2}})\ dx\!}$

${\displaystyle b_{n}={\frac {2A}{2n\pi }}(cos({\frac {2.25n\pi }{2}})-cos({\frac {0.25n\pi }{2}})\!}$

${\displaystyle b_{n}={\frac {A}{n\pi }}(Acos({\frac {n\pi }{8}})-Acos({\frac {9n\pi }{8}})\!}$

The coefficients give the Fourier series:

${\displaystyle f(x)=a_{0}+\sum _{n=1}^{\infty }[a_{n}cos({\frac {n\pi x}{L}})+b_{n}sin({\frac {n\pi x}{L}})]\!}$

${\displaystyle f(x)={\frac {A}{2}}+\sum _{n=1}^{\infty }[{\frac {A}{n\pi }}(sin({\frac {9n\pi }{8}})-sin({\frac {n\pi }{8}}))cos({\frac {n\pi x}{2}})\!}$

${\displaystyle +{\frac {A}{n\pi }}(cos({\frac {n\pi }{8}})-cos({\frac {9n\pi }{8}}))sin({\frac {n\pi x}{2}})]\!}$

### Homogeneous Solution

Considering the homogeneous case of our ODE:

${\displaystyle y''-3y'+2y=0\!}$

The characteristic equation is

${\displaystyle \lambda ^{2}-3\lambda +2=0\!}$

${\displaystyle (\lambda -1)(\lambda -2)=0\!}$

${\displaystyle \lambda _{1}=1,\lambda _{1}=2\!}$

Therefore our homogeneous solution is of the form

${\displaystyle y_{h}=c_{1}e^{x}+c_{2}e^{2x}\!}$

### Particular Solution

Considering the case with f(x) as excitation

${\displaystyle y''-3y'+2y={\frac {A}{2}}+\sum _{k=1}^{n}{\frac {A}{k\pi }}[(sin({\frac {9k\pi }{8}})-sin({\frac {k\pi }{8}}))cos({\frac {k\pi x}{2}})\!}$

${\displaystyle +(cos({\frac {k\pi }{8}})-cos({\frac {9k\pi }{8}}))sin({\frac {k\pi x}{2}})]\!}$

The solution will be of the form

${\displaystyle y_{n}=A_{0}+\sum _{k=1}^{n}A_{k}cos({\frac {k\pi x}{2}})+\sum _{k=1}^{n}B_{k}sin({\frac {k\pi x}{2}})\!}$

Taking the derivatives

${\displaystyle y_{n}'=-A_{n}{\frac {\pi }{2}}\sum _{k=2}^{n}ksin({\frac {k\pi x}{2}})+B_{n}{\frac {\pi }{2}}\sum _{k=2}^{n}kcos({\frac {k\pi x}{2}})\!}$

${\displaystyle y_{n}''=-A_{n}{\frac {\pi ^{2}}{4}}\sum _{k=3}^{n}k^{2}cos({\frac {k\pi x}{2}})-B_{n}{\frac {\pi ^{2}}{4}}\sum _{k=3}^{n}k^{2}sin({\frac {k\pi x}{2}})\!}$

Plugging these back into the ODE:

${\displaystyle -{\frac {\pi ^{2}}{4}}\sum _{k=3}^{n}A_{k}k^{2}cos({\frac {k\pi x}{2}})-{\frac {\pi ^{2}}{4}}\sum _{k=3}^{n}B_{k}k^{2}sin({\frac {k\pi x}{2}})-3[-{\frac {\pi }{2}}\sum _{k=2}^{n}A_{k}ksin({\frac {k\pi x}{2}})\!}$

${\displaystyle +{\frac {\pi }{2}}\sum _{k=2}^{n}B_{k}kcos({\frac {k\pi x}{2}})]+2[A_{0}+\sum _{k=1}^{n}A_{k}cos({\frac {k\pi x}{2}})+\sum _{k=1}^{n}B_{k}sin({\frac {k\pi x}{2}})]\!}$

${\displaystyle ={\frac {A}{2}}+\sum _{k=1}^{n}{\frac {A}{k\pi }}[(sin({\frac {9k\pi }{8}})-sin({\frac {k\pi }{8}}))cos({\frac {k\pi x}{2}})+(cos({\frac {k\pi }{8}})-cos({\frac {9k\pi }{8}}))sin({\frac {k\pi x}{2}})]\!}$

Setting the two constants equal

${\displaystyle 2A_{0}={\frac {A}{2}}\!}$

${\displaystyle A_{0}={\frac {A}{4}}\!}$

This is valid for all values of n. Since the coefficients of the excitation ${\displaystyle sin({\frac {9k\pi }{8}})-sin({\frac {k\pi }{8}})\!}$ and ${\displaystyle cos({\frac {k\pi }{8}})-cos({\frac {9k\pi }{8}})\!}$ are zero for all even n, then the coefficients ${\displaystyle A_{k}\!}$ and ${\displaystyle B_{k}\!}$ will also be zero, so we must only find these coefficients for odd n's. Now carrying out the sum to ${\displaystyle n=1\!}$ and comparing like terms yields the following sets of equations. Written in matrix form:

${\displaystyle {\begin{bmatrix}2&0\\\\0&2\end{bmatrix}}*{\begin{bmatrix}A_{1}\\B_{1}\end{bmatrix}}={\begin{bmatrix}\ {\frac {A}{\pi }}(sin({\frac {9\pi }{8}})-sin({\frac {\pi }{8}}))\\\ {\frac {A}{\pi }}(cos({\frac {\pi }{8}})-cos({\frac {9\pi }{8}}))\end{bmatrix}}\!}$

Assuming ${\displaystyle A=1\!}$ this matrix can be solved to obtain

${\displaystyle A_{1}=-0.1218\ ,\ B_{1}=0.2941\!}$

For the remaining coefficients to be solved all sums will be used so a more general equation may be written:

${\displaystyle {\begin{bmatrix}2-{\frac {(\pi k)^{2}}{4}}&{\frac {-3\pi k}{2}}\\{\frac {-3\pi k}{2}}&2-{\frac {(\pi k)^{2}}{4}}\end{bmatrix}}*{\begin{bmatrix}A_{k}\\B_{k}\end{bmatrix}}={\begin{bmatrix}\ {\frac {A}{\pi k}}(sin({\frac {9\pi k}{8}})-sin({\frac {\pi k}{8}}))\\\ {\frac {A}{\pi k}}(cos({\frac {\pi k}{8}})-cos({\frac {9\pi }{8}}))\end{bmatrix}}\!}$

Results of these calculations are shown below:

${\displaystyle A={\begin{bmatrix}A_{1}\\A_{2}\\.\\.\\A_{7}\\A_{8}\end{bmatrix}}={\begin{bmatrix}-0.1218\\0\\0.0084\\0\\0.0014\\0\\0.0001\\0\end{bmatrix}},\ B={\begin{bmatrix}B_{1}\\B_{2}\\.\\.\\B_{7}\\B_{8}\end{bmatrix}}={\begin{bmatrix}0.2941\\0\\0.0019\\0\\0.0014\\0\\0.0007\\0\end{bmatrix}}\!}$

The solution to the particular case can be written for all n (assuming A=1):

      ${\displaystyle y_{n}={\frac {1}{4}}+\sum _{k=1}^{n}A_{k}cos({\frac {k\pi x}{2}})+\sum _{k=1}^{n}B_{k}sin({\frac {k\pi x}{2}})\!}$


### General Solution

The general solution is

${\displaystyle y=y_{h}+y_{p}\!}$

where

${\displaystyle y_{h}=c_{1}e^{x}+c_{2}e^{2x}\!}$

Different coefficients ${\displaystyle c_{1}\ ,\ c_{2}\!}$ will be calculated for each n. These coefficients are easily solved for by applying the given initial conditions. Below are the calculations for n=2.

${\displaystyle y=c_{1}e^{x}+c_{2}e^{2x}+{\frac {1}{4}}+\sum _{k=1}^{2}A_{k}cos({\frac {k\pi x}{2}})+\sum _{k=1}^{2}B_{k}sin({\frac {k\pi x}{2}})\!}$

Applying the first initial condition ${\displaystyle y(0)=1\!}$

${\displaystyle y(0)=c_{1}+c_{2}+A_{1}+A_{2}=1\!}$

Taking the derivative

${\displaystyle y'=c_{1}e^{x}+2c_{2}e^{2x}-\sum _{k=2}^{2}{\frac {k\pi }{2}}A_{k}sin({\frac {k\pi x}{2}})+\sum _{k=2}^{2}{\frac {k\pi }{2}}B_{k}cos({\frac {k\pi x}{2}})\!}$

Applying the second initial condition ${\displaystyle y'(0)=0\!}$

${\displaystyle y'(0)=c_{1}+2c_{2}+{\frac {2\pi }{2}}B_{2}=0\!}$

Solving the two equations for two unknowns yields:

${\displaystyle c_{1}=2.2436\ ,\ c_{2}=-1.1218\!}$

So the general solution for n=2 is:

${\displaystyle y=2.2436e^{x}-1.1218e^{2x}+{\frac {1}{4}}+\sum _{k=1}^{2}A_{k}cos({\frac {k\pi x}{2}})+\sum _{k=1}^{2}B_{k}sin({\frac {k\pi x}{2}})\!}$

Below is a plot showing the general solutions for n=2,4,8:

### Matlab Plots

Using ode45 the following graph was generated for n=0:

and for n=1

## R6.5

Solved by: Gonzalo Perez

### Part R4.2, p.7c-26

For each value of n=3,5,9, re-display the expressions for the 3 functions ${\displaystyle y_{p,n}(x),y_{h,n}(x),y_{n}(x)\!}$, and plot these 3 functions separately over the interval ${\displaystyle [0,20\pi ]\!}$.

R4.2 p.7-26: Consider the L2-ODE-CC (5) p.7b-7 with ${\displaystyle sinx\!}$ as excitation:

${\displaystyle y''-3y'+2y=r(x)\!}$ (5)p.7-7

${\displaystyle r(x)=sinx\!}$ (1)p.9-15

and the initial conditions:

${\displaystyle y(0)=1,y'(0)=0.\!}$ (3b)p.3-7

Exact solution: ${\displaystyle y(x)=y_{h}(x)+y_{p}(x)\!}$ (2)p.9-15

Re-display the expressions for ${\displaystyle y_{p}(x),y_{h}(x),y(x)\!}$.

Superpose each of the above plot with that of the exact solution.

### Solution

The graphs are to be separately graphed as follows.

For n = 3, the code that will generate the graph looks like this:

For n = 6:

For n = 9:

### Part R4.3, p.7c-28

Understand and run the TA's code to produce a similar plot, but over a larger interval ${\displaystyle [0,10]\!}$. Do zoom-in plots about the points ${\displaystyle x=-0.5,0,+0.5\!}$ and comment on the accuracy of different approximations.

R4.3 p.7-28: Consider the L2-ODE-CC (5) p.7b-7 with ${\displaystyle log(1+x)\!}$ as excitation:

${\displaystyle y''-3y'+2y=r(x)\!}$ (5)p.7-7

${\displaystyle r(x)=log(1+x)\!}$ (1)p.7-28

and the initial conditions:

${\displaystyle y(-{\frac {3}{4}})=1,y'(-{\frac {3}{4}})=0\!}$ (2)p.7-28

### Solution

For n=4 (from x = 0 to x = 10):

For n=4 (zoom-in plots around x = -0.5):

For n=4 (zoom-in plots around x = 0):

For n=4 (zoom-in plots around x = +0.5):

For n=7 (from x = 0 to x = 10):

For n=11 (from x = 0 to x = 10):

Where the black line represents n=11 and the blue line represents log(1+x).

The problem asks for n=4, 7, and 11. The TA had up to n=16, but the problem does not ask for this. Manipulating the code and graphs to only account for these n values, n=16 has been disregarded.

Combined plots for n=7 and n=11 (zoom-in plots around x = -0.5):

Combined plots for n=7 and n=11 (zoom-in plots around x = 0):

Combined plots for n=7 and n=11 (zoom-in plots around x = 0.5):

### Part R4.4, p.7c-29

Understand and run the TA's code to produce a similar plot, but over a larger interval ${\displaystyle [0.9,10]\!}$, and for n=4,7. Do zoom-in plots about ${\displaystyle x=1,1.5,2,2.5\!}$ and comments on the accuracy of the approximations.

R4.4 p.7-29: Extend the accuracy of the solution beyond ${\displaystyle {\hat {x}}=1\!}$.

### Solution

The general code that can be used to graph the plots of n=4,7,11 is:

With the above code, we can add the following code to graph n=4.

For n = 4 (from x = 0.9 to x = 10):

For n = 7 (from x = 0.9 to x = 10):

For n=11 (from x = 0.9 to x = 10):

Repeating the same common part of the code, let's graph the other plots around x = 1, 1.5, 2, 2.5:

For n = 4, 7, 11 at x = 1:

For n = 4, 7, 11 at x = 1.5:

For n = 4, 7, 11 at x = 2:

For n = 4, 7, 11 at x = 2.5:

For the last part, the first (and unchanged TA's code) is the following:

The second part includes the change that had to be made in order to solve this problem:

## R6.6

### Problem Statement

Given: For the following differential equation: ${\displaystyle y_{p}''+4y_{p}'+3y_{p}=2e^{2x}cos(3x)\!}$

With a particular solution of the form: ${\displaystyle y_{p}=xe^{-2x}(Mcos(3x)+Nsin(3x))\!}$

Verify that this solution has a final expression of ${\displaystyle y_{p}=6e^{-2x}(Ncos(3x)-Msin(3x))\!}$ as follows:

1) Simplify the term ${\displaystyle y_{p}''\!}$
2) Simplify the 2nd term ${\displaystyle 4y_{p}'\!}$ and combine with the simplified first term
3) Finally add the 3rd term ${\displaystyle 13y_{p}\!}$
4) Find the final expression for ${\displaystyle y_{p}(x)\!}$

### Solution

1) To find the derivative and simplify ${\displaystyle y_{p}''\!}$ we will use www.wolframalpha.com[1].

The "Simplify" command will be exploited as well as the notation for taking a derivative in mathematica. The following was entered into www.wolframalpha.com:

Simplify[D[D[x*exp(-2x)*(Mcos(3x) + Nsin(3x)),x],x]]

The answer that was yielded is as follows:

${\displaystyle y_{p}''=-6Me^{-2x}sin(3x)+12Me^{-2x}xsin(3x)-4Me^{-2x}cos(3x)-5Me^{-2x}xcos(3x)\!}$
${\displaystyle -4Ne^{-2x}sin(3x)-5Ne^{-2x}xsin(3x)+6Ne^{-2x}cos(3x)-12Ne^{-2x}xcos(3x)\!}$

2) In the same fashion, ${\displaystyle 4y_{p}'\!}$ was evaluated and simplified using www.wolframalpha.com

The following was entered into www.wolframalpha.com:

simplify[4*[D[x*exp(-2x)*(Mcos(3x) + Nsin(3x)),x]]]

The answer that was yielded is as follows:

${\displaystyle 4y_{p}'=-12Me^{-2x}xsin(3x)+4Me^{-2x}cos(3x)-8Me^{-2x}xcos(3x)+4Ne^{-2x}sin(3x)-8Ne^{-2x}xsin(3x)+12Ne^{-2x}xcos(3x)\!}$

This term can be added to the previous, and then simplified yet again using www.wolframalpha.com

The following was entered into www.wolframalpha.com

Simplify[D[D[x*exp(-2x)*(Mcos(3x) + Nsin(3x)),x],x]+ 4*[D[x*exp(-2x)*(Mcos(3x) + Nsin(3x)),x]]

The answer that was yielded is as follows:

${\displaystyle y_{p}''+4y_{p}'=-6Me^{-2x}sin(3x)-13Me^{-2x}xcos(3x)-13Ne^{-2x}xsin(3x)+6Ne^{-2x}cos(3x)\!}$

3) The final term ${\displaystyle 13y_{p}\!}$ is now added to this result, as follows:

${\displaystyle y_{p}''+4y_{p}'+13y_{p}=-6Me^{-2x}sin(3x)-13Me^{-2x}xcos(3x)-13Ne^{-2x}xsin(3x)+6Ne^{-2x}cos(3x)+13Me^{-2x}xcos(3x)+13Ne^{-2x}xsin(3x)\!}$

${\displaystyle y_{p}''+4y_{p}'+13y_{p}=-6Me^{-2x}sin(3x)+(13-13)Me^{-2x}xcos(3x)+(13-13)Ne^{-2x}xsin(3x)+6Ne^{-2x}cos(3x)\!}$

${\displaystyle y_{p}''+4y_{p}'+13y_{p}=-6Me^{-2x}sin(3x)+6Ne^{-2x}cos(3x)\!}$

${\displaystyle y_{p}''+4y_{p}'+13y_{p}=6e^{-2x}(Ncos(3x)-Msin(3x))\!}$

4) As verified above, the final term is as follows:

${\displaystyle y_{p}(x)=6e^{-2x}(Ncos(3x)-Msin(3x))\!}$

1. www.wolframalpha.com

--Egm4313.s12.team11.sheider (talk) 22:30, 10 April 2012 (UTC)

## R6.7

Solved by Solved by Daniel Suh

#### Problem Statement

Find the separated Ordinary Differential Equations for the heat equation.

${\displaystyle {\frac {\partial u}{\partial t}}=\kappa {\frac {\partial ^{2}u}{\partial x^{2}}}\cdots (1)\!}$

${\displaystyle u(x,t)=F(x)\cdot G(t)\!}$

### Solution

${\displaystyle {\frac {\partial u}{\partial t}}=F(x)\cdot {\dot {G}}(t)\cdots (2)\!}$

${\displaystyle {\frac {\partial ^{2}u}{\partial x^{2}}}=F''(x)\cdot G(t)\cdots (3)\!}$

Combine ${\displaystyle (2)\!}$ and ${\displaystyle (3)\!}$ into ${\displaystyle (1)\!}$

${\displaystyle F(x)\cdot {\dot {G}}(t)=\kappa F''(x)\cdot G(t)\!}$

${\displaystyle {\frac {{\dot {G}}(t)}{\kappa G(t)}}={\frac {F''(x)}{F(x)}}=c\!}$ (constant)

Separate

          ${\displaystyle F''(x)-cF(x)=0\!}$
${\displaystyle G'(t)-\kappa cG(t)=0\!}$