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

Report 6

## R 6.1

### Question

Find the (smallest) period of ${\displaystyle cosn\omega x}$ and ${\displaystyle sinn\omega x}$.
Show that these functions also have a period p.
Show that the constant ${\displaystyle a_{o}}$ is also a periodic function with period p.

### Solution

Given (1) p.9-2: ${\displaystyle f(x+np)=f(x)}$ for all ${\displaystyle n(...,-2,-1,0,1,2...)}$ and where p is the period.
The smallest period occurs when n=1 thus we can use the equation as: ${\displaystyle f(x+p)=f(x)}$

For ${\displaystyle f(x)=cos(n\omega x)}$ we have:
${\displaystyle f(x+p)=cosn\omega (x+p)=cos(n\omega x+n\omega p)=cos(n\omega x)cos(n\omega p)-sin(n\omega x)sin(n\omega p)}$
Thus, ${\displaystyle cos(n\omega x)cos(n\omega p)-sin(n\omega x)sin(n\omega p)=cosn\omega x}$
${\displaystyle cos(n\omega x)cos(n\omega p)=cos(n\omega x)(1)}$
${\displaystyle cos(n\omega p)=1}$
${\displaystyle n\omega p=2\pi }$

${\displaystyle p={\frac {2\pi }{n\omega }}}$, smallest period occurs when n=1 so, ${\displaystyle p={\frac {2\pi }{\omega }}}$


For ${\displaystyle f(x)=sin(n\omega x)}$ we have:
${\displaystyle f(x+p)=sinn\omega (x+p)=sin(n\omega x+n\omega p)=sin(n\omega x)cos(n\omega p)-cos(n\omega x)sin(n\omega p)}$< br /> Thus, ${\displaystyle sin(n\omega x)cos(n\omega p)-cos(n\omega x)sin(n\omega p)=sin(n\omega x)}$
${\displaystyle sin(n\omega x)cos(n\omega p)=sin(n\omega x)(1)}$
${\displaystyle cos(n\omega p)=1}$
${\displaystyle n\omega p=2\pi }$

${\displaystyle p={\frac {2\pi }{n\omega }}}$, smallest period occurs when n=1 so, ${\displaystyle p={\frac {2\pi }{\omega }}}$


From (1) p9-5, we know that ${\displaystyle \omega ={\frac {2\pi }{p}}}$
Then, ${\displaystyle p={\frac {2\pi }{\omega }}={\frac {2\pi }{\frac {2\pi }{p}}}=p}$
Thus, the period of both of these functions is also ${\displaystyle p}$.

From (1) p.9-7, we know ${\displaystyle a_{o}={\frac {1}{2L}}\int _{0}^{2L}f(x)dx={\frac {1}{p}}}$
Also, ${\displaystyle a_{o}={\frac {1}{2\pi }}\int _{0}^{2\pi }f(x)dx={\frac {1}{p}}}$

Thus, ${\displaystyle p=2\pi }$ showing  ${\displaystyle a_{o}}$ is a periodic function with period ${\displaystyle p}$.


## R 6.2

### Question

Is the given function even or odd or either even nor odd? Find its Fourier series. Show details of your work.

${\displaystyle 11.f(x)=x^{2},\;(-1
${\displaystyle 12.f(x)=1-{\frac {x^{2}}{4}},\;(-2

### Author

Solved and uploaded by William Knapper

## R 6.3

### Question

K 2011 p.491 pbs 15,17
Find if the graph is for an even or odd problem and then find the fourier series. Graph the resulting equations.
Problem 15:

Problem 17:

### Solution

For problem 15:
f(-x) = -f(x), therefore the graph shows an odd function. Similarly, L = ${\displaystyle \pi }$.
Therefore we can use the Euler formula for an odd function:
${\displaystyle f(x)=\sum _{n=1}^{\infty }b_{n}\sin(nx)}$
${\displaystyle b_{n}={\frac {2}{\pi }}\int _{0}^{\pi }f(x)\sin(nx)dx}$
During ${\displaystyle [0,{\frac {\pi }{2}}]}$, f(x) = x. During ${\displaystyle [{\frac {\pi }{2}},\pi ]}$, ${\displaystyle f(x)=\pi -x}$
Therefore, ${\displaystyle b_{n}={\frac {2}{\pi }}(\int _{0}^{\frac {\pi }{2}}x\sin(nx)dx+\int _{\frac {\pi }{2}}^{\pi }(\pi -x)\sin(nx)dx)}$
Using integration by parts shows ${\displaystyle b_{n}}$ to be:
${\displaystyle b_{n}={\frac {2}{\pi n^{2}}}(2\sin({\frac {\pi }{2}}n)-\sin(\pi n))}$
when, for the first integral:
${\displaystyle u=x,du=dx,dv=\sin(nx)dx,andv=-{\frac {1}{n}}\cos(nx)}$
and for the second integral (where u, du, v, and dv are not the same as the first integral):
${\displaystyle u=\pi -x,du=-dx,dv=-\sin(nx)dx,andv={\frac {1}{n}}\cos(nx)}$
Therefore, when n is odd, ${\displaystyle b_{n}=+or-{\frac {4}{\pi n^{2}}}}$ and when n is even, ${\displaystyle b_{n}=0}$
Therefore, the fourier series' are as follows:
For n=2 -> ${\displaystyle f(x)={\frac {4}{\pi }}\sin(x)}$
For n=4 -> ${\displaystyle f(x)={\frac {4}{\pi }}\sin(x)+{\frac {4}{\pi 9}}\sin(3x)}$
For n = 8 -> ${\displaystyle f(x)={\frac {4}{\pi }}\sin(x)+{\frac {4}{\pi 9}}\sin(3x)+{\frac {4}{\pi 25}}\sin(5x)+{\frac {4}{\pi 49}}\sin(7x)}$
A graph of the fourier series' is shown below:

For Problem 17: ${\displaystyle f(-x)=f(x)}$ Therefore, it is an even function and L = 1. Similarly, because it's an even function, the Euler equations for an even function can be used:
${\displaystyle f(x)=a_{0}+\sum _{n=1}^{\infty }a_{n}\cos(nx)}$
${\displaystyle a_{0}={\frac {1}{\pi }}\int _{0}^{\pi }f(x)dx}$
${\displaystyle a_{n}={\frac {2}{\pi }}\int _{0}^{\pi }f(x)\cos(nx)dx}$
During [0,1], ${\displaystyle f(x)=1-x}$
Therefore:
${\displaystyle a_{0}=\int _{0}^{1}(1-x)dx={\frac {1}{2}}}$
However, the period is not 2${\displaystyle \pi }$, so in ${\displaystyle a_{n}}$ ${\displaystyle \cos(nx)}$ is replaced with ${\displaystyle cos(n\pi x)}$ to shift the function to a period of 2${\displaystyle \pi }$. Similarly, ${\displaystyle {\frac {2}{\pi }}}$ is replaced with ${\displaystyle {\frac {2}{1}}}$ since L = 1.
Therefore:
${\displaystyle a_{n}=2\int _{0}^{1}(f(x)\cos(n\pi x))dx=2\int _{0}^{1}((1-x)\cos(n\pi x))dx}$
Letting ${\displaystyle u=1-x,du=-dx,dv=\cos(n\pi x)dx,v={\frac {1}{n\pi }}\sin(n\pi x)}$ where u, du, v, and dv are not the same as was used in number 15 above.
Integration by parts then yields:
${\displaystyle a_{n}=2({\frac {-1}{n^{2}\pi ^{2}}}(\cos(n\pi )+{\frac {1}{n^{2}\pi ^{2}}})}$
${\displaystyle Therefore,whennisodd,[itex]a_{n}={\frac {4}{n^{2}\pi ^{2}}}}$ and when n is even, ${\displaystyle a_{n}=0}$
Therefore, the fourier series's are as follows:
For n = 2 -> ${\displaystyle f(x)={\frac {1}{2}}+{\frac {4}{\pi ^{2}}}\cos(\pi x)}$
For n = 4 -> ${\displaystyle f(x)={\frac {1}{2}}+{\frac {4}{\pi ^{2}}}\cos(\pi x)+{\frac {4}{9\pi ^{2}}}\cos(3\pi x)}$
For n = 8 -> ${\displaystyle f(x)={\frac {1}{2}}+{\frac {4}{\pi ^{2}}}\cos(\pi x)+{\frac {4}{9\pi ^{2}}}\cos(3\pi x)+{\frac {4}{25\pi ^{2}}}\cos(5\pi x)+{\frac {4}{49\pi ^{2}}}\cos(7\pi x)}$

### Author

This problem was solved and uploaded by John North

## R 6.4

### Question

Consider the L2-ODE-CC with the window function f(x) from p9-8 as excitation:

${\displaystyle \ y''-3y'+2y=r(x)\ }$ where r(x) = 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 n = 3, 6, 9 for x in [0, 10]

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

Level 1: n = 0,1

### Solution

${\displaystyle \ \lambda ^{2}-3\lambda +2=0=>(\lambda -2)(\lambda -1)=0\ }$

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

The Fourier series of a periodic function

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

For an odd function the Fourier series will be the following:

${\displaystyle \ f(x)=\sum _{n=1}^{\infty }b_{n}\ }$ sin(nωx) ${\displaystyle \ =\sum _{n=1}^{\infty }b_{n}sin({\frac {n*pi}{L}}x)dx\ }$

The independent variable t will be used to shift x to the left

${\displaystyle \ t=x-{\frac {1}{4}}\ }$

The period of oscillation and frequency of oscillation will be as follows:

${\displaystyle \ p=2L=4\ }$

ω = π/2


where ${\displaystyle \ b_{n}={\frac {2}{L}}\int _{0}^{L}f(x)sin({\frac {n*pi}{L}}x)dx={\frac {1}{2}}\int _{0}^{2}f(x)sin({\frac {n*pi}{2}}x)dx\ }$

which comes to be: ${\displaystyle \ b_{n}={\frac {A}{n*pi}}\ }$ (1 - cosnπ)

${\displaystyle \ y''-3y'+2y=r(x)\ }$ = 1/2 + (2/nπ) sin(nπ/2}t

The homogeneous equation for Y will be as follows:

${\displaystyle \ Y_{h}=C_{1}e^{2x}+C_{2}e^{x}\ }$

${\displaystyle \ Y=Y_{h}+Y_{p}=C_{1}e^{2x}+C_{2}e^{x}+C_{3}\ }$

### Author

This problem was solved and uploaded by Mike Wallace

## R 6.5

### Question

Redo R4.2 to redisplay the particular solution, the homogenous solution, and the exact solution for n = 3,5,9 over the interval [0,20π]

Redisplay the particular solution, the homogenous solution, and the exact solution. Superpose each solution with the exact solution.

Redo R4.3 with the TA code over the interval [0.10]. Zoom in about x = -0.5, 0, and 0.5 and comment on the accuracy of different approximations.

Redo R4.4 with the TA code over the interval [0.9,10] for n = 4, 7. Zoom in about x = 1, 1.5, 2, 2.5 and comment on the accuracy of different approximations.

### Solution

#### R 4.2 redo

The re-displayed functions for the homogenous solutions are:

${\displaystyle \displaystyle y_{3h}(x)=2e^{x}-0.8008e^{2x}\ }$

${\displaystyle \displaystyle y_{5h}(x)=2.0001e^{x}-0.8001e^{2x}\ }$

${\displaystyle \displaystyle y_{9h}(x)=2e^{x}-0.8e^{2x}\ }$

The re-displayed functions for the particular solutions are:

${\displaystyle \displaystyle y_{3p}(x)=-9.9206*10^{-5}x^{7}-0.0010x^{6}-0.0031x^{5}-0.0078x^{4}-0.0990x^{3}-0.3984x^{2}-0.3984x-0.1992\ }$

${\displaystyle \displaystyle y_{5p}(x)=-1.2526*10^{-8}x^{11}-2.0668*10^{-7}x^{10}-1.0334*10^{-6}x^{9}-4.6503*10^{-6}x^{8}-1.1781*10^{-4}x^{7}\ }$

${\displaystyle \displaystyle -0.0011x^{6}-0.0033x^{5}-0.0083x^{4}-0.0999x^{3}-0.3999x^{2}-0.399x-0.2000\ }$

${\displaystyle \displaystyle y_{9p}(x)=-4.1103*10^{-18}x^{19}-1.1714*10^{-16}x^{18}-1.0543*10^{-15}x^{17}-8.9615*10^{-15}x^{16}\ }$

${\displaystyle \displaystyle -4.5405*10^{-13}x^{15}-9.1408*10^{-12}x^{14}-6.3985*10^{-11}x^{13}-4.1590*10^{-10}x^{12}-1.5021*10^{-8}x^{11}-2.2040*10^{-7}x^{10}}$

${\displaystyle \displaystyle -1.1020*10^{-6}x^{9}-4.9591*10^{-6}x^{8}-1.1904*10^{-4}x^{7}-0.0011x^{6}-0.0033x^{5}-0.0083x^{4}-0.1000x^{3}-0.4000x^{2}-0.4000x-0.2000\ }$

The re-displayed functions for the general solutions are:

${\displaystyle \displaystyle y_{3}(x)=2e^{x}-0.8008e^{2x}-9.9206*10^{-5}x^{7}-0.0010x^{6}-0.0031x^{5}-0.0078x^{4}-0.0990x^{3}-0.3984x^{2}-0.3984x-0.1992\ }$

${\displaystyle \displaystyle y_{5}(x)=2.0001e^{x}-0.8001e^{2x}-1.2526*10^{-8}x^{11}-2.0668*10^{-7}x^{10}-1.0334*10^{-6}x^{9}-4.6503*10^{-6}x^{8}\ }$

${\displaystyle \displaystyle -1.1781*10^{-4}x^{7}-0.0011x^{6}-0.0033x^{5}-0.0083x^{4}-0.0999x^{3}-0.3999x^{2}-0.399x-0.2000\ }$

${\displaystyle \displaystyle y_{9}(x)=2e^{x}-0.8e^{2x}-4.1103*10^{-18}x^{19}-1.1714*10^{-16}x^{18}-1.0543*10^{-15}x^{17}-8.9615*10^{-15}x^{16}\ }$

${\displaystyle \displaystyle -4.5405*10^{-13}x^{15}-9.1408*10^{-12}x^{14}-6.3985*10^{-11}x^{13}-4.1590*10^{-10}x^{12}-1.5021*10^{-8}x^{11}\ }$

${\displaystyle \displaystyle -2.2040*10^{-7}x^{10}-1.1020*10^{-6}x^{9}-4.9591*10^{-6}x^{8}-1.1904*10^{-4}x^{7}-0.0011x^{6}\ }$

${\displaystyle \displaystyle -0.0033x^{5}-0.0083x^{4}-0.1000x^{3}-0.4000x^{2}-0.4000x-0.2000\ }$

Plot for ${\displaystyle \displaystyle y_{3}(x)\ }$

Plot for ${\displaystyle \displaystyle y_{5}(x)\ }$

Plot for ${\displaystyle \displaystyle y_{9}(x)\ }$

#### R 4.3 Redo

Matlab code:

x = 0:0.01:10;

y = log(1+x);

EDU>> x1 = 0:0.01:10;

EDU>> y1 = zeros(1,1001);

EDU>> for i = 1:4

for j = 1:1001

y1(j) = y1(j) - ((-x1(j))^i)/i;

end

end

EDU>> y2 = zeros(1,1001);

EDU>> for i = 1:7

for j = 1:1001

y2(j) = y2(j) - ((-x1(j))^i)/i;

end

end

EDU>> y3 = zeros(1,1001);

EDU>> for i = 1:11

for j = 1:1001

y3(j) = y3(j) - ((-x1(j))^i)/i;

end

end

EDU>> y4 = zeros(1,1001);

EDU>> for i = 1:16

for j = 1:1001

y4(j) = y4(j) - ((-x1(j))^i)/i;

end

end

EDU>> h = plot(x,y);

orange = [1 0.5 0.2];

EDU>> set(h,'Color',orange);

EDU>> hold on;

EDU>> plot(x1,y1,'r');

EDU>> plot(x1,y2,'g');

EDU>> plot(x1,y3,'b');

EDU>> plot(x1,y4,'c');

legend('log(1+x)','T_4','T_7','T_1_1','T_1_6');

EDU>> grid on;

EDU>> axis([0 10 -10 10])

This plot makes it appear that only the 16 term approximation is in the window at point 0. This is, therefore, the most accurate of the other n solution approximations.

This plot makes it appear that most of the approximations are very accurate and close to the exact solution. The only approximation that appears to deviate a little after 0.5 is the n = 4 approximation.

#### R 4.4 redo

Matlab code:

syms x

EDU>> f = log(x+1);

EDU>> fT1 = taylor(f,5,1);

EDU>> fT2 = taylor(f,8,1);

X = 0.9:0.1:10;

Y(:,1) = subs(fT1,'x',X);

EDU>> Y(:,2) = subs(fT2,'x',X);

EDU>> Y(:,3) = log(1+X);

EDU>> figure

EDU>> plot(X,Y);

axis([0.9 10 -10 10])

This shows that neither of the approximations are very close about x = 1 to the exact solution.

This shows that the n = 7 approximation is close about x = 1.5 to the exact solution.

This shows that all the approximations are very close to the exact solution about x = 2.

This shows that the approximations are very close about x = 2.5, however, the n = 4 approximation is beginning to deviate and soon will not be a good approximation.

### Author

This problem was solved and uploaded by David Herrick

## R 6.6

### Question

Given ${\displaystyle \displaystyle y_{p}''+4y_{p}'+13y_{p}=2e^{-2x}cos(3x)}$

(1) Simplify the first term ${\displaystyle \displaystyle y_{p}''}$ on the lhs
(2) Simplify the second term ${\displaystyle \displaystyle 4y_{p}'}$ and combine with the simplified first term
(3) Finally, add the third term ${\displaystyle \displaystyle 13y_{p}}$

### Solution

From Lecture Notes Sec.10 p.10-3:
Particular solution is of the form ${\displaystyle \displaystyle y_{p}(x)=xe^{-2x}[Mcos(3x)+Nsin(3x)]}$
From Lecture Notes Sec.10 p.10-3:
${\displaystyle \displaystyle y_{p}^{'}(x)=e^{-2x}[sin(3x)(-3mx-2nx+n)+cos(3x)(-2mx+m+3nx)]}$
${\displaystyle \displaystyle y_{p}^{''}(x)=e^{-2x}[sin(3x)[6m(2x-1)-n(5x+4)]-cos(3x)[m(5x+4)+6n(2x-1)]]}$
We want to substitute these derivatives back into the original ODE and verify that Wolfram Alpha's solution of ${\displaystyle \displaystyle 6e^{-2x}[ncos(3x)-msin(3x)]}$ is correct.

(1)

${\displaystyle \displaystyle y_{p}^{''}=e^{-2x}[sin(3x)[6m(2x-1)-n(5x+4)]-cos(3x)[m(5x+4)+6n(2x-1)]]}$
${\displaystyle \displaystyle y''_{p}=e^{-2x}[12mxsin(3x)-6msin(3x)-5nxsin(3x)-4nsin(3x)-5mxcos(3x)-4mcos(3x)-12nxcos(3x)+6ncos(3x)]}$

(2)

${\displaystyle \displaystyle y_{p}^{'}=e^{-2x}[sin(3x)(-3mx-2nx+n)+cos(3x)(-2mx+m+3nx)]}$
${\displaystyle \displaystyle 4y'p=e^{-2x}[-12mxsin(3x)-8nxsin(3x)+4nsin(3x)-8mxcos(3x)+4mcos(3x)+12nxcos(3x)]}$
${\displaystyle \displaystyle y''_{p}+4y'_{p}=e^{-2x}[-6msin(3x)-13nxsin(3x)-13mxcos(3x)+6ncos(3x)]}$

(3)

${\displaystyle \displaystyle 13y_{p}=e^{-2x}[13mxcos(3x)+13nxcos(3x)]}$
${\displaystyle \displaystyle y''_{p}+4y'_{p}+13y_{p}=e^{-2x}[-6msin(3x)+6ncos(3x)]}$

Comparing this to Wolfram Alpha's answer:

${\displaystyle \displaystyle 6e^{-2x}[ncos(3x)-msin(3x)]=6e^{-2x}[ncos(3x)-msin(3x)]}$


### Author

Solved and uploaded by Joshua House

## R 6.7

### Question

(1) Find the separated ODEs for the heat equation

${\displaystyle \displaystyle {\frac {\partial u}{\partial t}}=\kappa {\frac {\partial ^{2}u}{\partial x^{2}}}}$

### Solution

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

Then:

${\displaystyle \displaystyle {\frac {\partial u(x,t)}{\partial t}}=F(x)\cdot {\dot {G}}(t)}$
${\displaystyle \displaystyle {\frac {\partial ^{2}u(x,t)}{\partial x^{2}}}=F''(x)\cdot {G}(t)}$

Substituting partial derivatives back into original PDE:

${\displaystyle \displaystyle F(x)\cdot {\dot {G}}(t)=\kappa F''(x)\cdot G(t)}$
${\displaystyle \displaystyle {\frac {{\dot {G}}(t)}{\kappa G(t)}}={\frac {F''(x)}{F(x)}}=c}$
* Where "c" is a constant, because if both sides were variables then they would never be equal one another (each side would be a function of a different variable.) Kreysig 2011, pp.546

Multiplying by the denominators to get two separate ODEs:

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


### Author

Solved and uploaded by Joshua House