User:Egm4313.s12.team8/R6

=R6.1 - Prove Periodicity=

Problem Statement
Given $$\displaystyle f(x)=a_{0}+\sum_{n=1}^{\infty }[a_{n}cos(n\omega x)+b_{n}sin(n\omega x)]$$: (1) Find the (smallest) period of $$\displaystyle cos(n\omega x) $$ and $$\displaystyle sin(n\omega x) $$. (2) Show that these functions also have period $$\displaystyle p $$. (3) Show that the constant $$\displaystyle a_{0} $$ is also a periodic function with period $$\displaystyle p $$.

Solution (1)
We know that the period of a normal $$\displaystyle sin(x) $$ or $$\displaystyle cos(x) $$ is $$\displaystyle 2\pi $$. When there are values or variables being multiplied by this $$\displaystyle x $$ variable, the period becomes $$\displaystyle 2\pi $$ divided by the values or variables. We know that: $$\displaystyle \omega=\frac{\pi }{L}=\frac{2 \pi}{p}$$    (6.1.1) Where $$\displaystyle p $$ is the period. Using this relation, along with our variable $$\displaystyle n $$, we can solve for the period of $$\displaystyle cos(n\omega x) $$ and $$\displaystyle sin(n\omega x) $$ as follows: $$\displaystyle p=\frac{2\pi }{\tfrac{n\pi }{L}}$$ $$\displaystyle p=\frac{L\pi}{n} $$    (6.1.2) Since the period will be smallest at $$\displaystyle n=1$$, plugging into equation (6.1.2) shows that the smallest period of $$\displaystyle cos(n\omega x) $$ and $$\displaystyle sin(n\omega x) $$ is: $$\displaystyle p=L\pi $$    (6.1.3)

Solution (2)
We are also given that: $$\displaystyle \omega =\frac{2\pi}{p}$$    (6.1.4) Using this relation, we can solve for the period again as follows: $$\displaystyle p=\frac{2\pi}{\frac{n2\pi}{p}}$$ $$\displaystyle p=\frac{p}{n}$$    (6.1.5) We know that the period is smallest at $$\displaystyle n=1$$, and plugging this value into (6.1.5) proves that: $$\displaystyle p=p $$    (6.1.6)

Solution (3)
We know that, starting at 0: $$\displaystyle \widetilde{a}_{0}=\frac{1}{2L}\int_{0}^{2L}f(\widetilde{x})d\widetilde{x} $$    (6.1.7) Where the period is represented by 0 to 2L. We are also given that: $$\displaystyle \frac{\pi}{L}=\frac{2\pi}{p} $$    (6.1.8) Rearranging (6.1.8) allows us to solve for L: $$\displaystyle L=\frac{p}{2}$$     (6.1.9) Multiplying (6.1.9) by 2 allows us to find the period of $$\displaystyle a_{0}$$, as follows: $$\displaystyle 2L=p$$    (6.1.10) This shows that $$\displaystyle a_{0}$$ is indeed a periodic function with a period of $$\displaystyle p$$. This also shows that at any given $$\displaystyle x$$ value or period throughout the periodic function, $$\displaystyle a_{0}$$ holds its constant value.

=R6.2 - Fourier Series Expansion=

Problem Statement
Find the Fourier Series Expansion for f(x) as follows:

1. Determine if f(x) is even, odd, or neither. Develop the Fourier Series Expansion of $$f(\bar{x})$$. Plot $$f(\bar{x})$$ and the truncated Fourier Series $$f_{n}(\bar{x})$$.

$$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.

Observe the values of $$f_{n}(\bar{x})$$ at the points of discontinuities and the Gibbs phenomenon. Transform the variable so to obtain the Fourier Series Expansion for f(x).

2. Repeat 1 but using $$f_{n}(\tilde{x})$$ to obtain the Fourier Series Expansion of f(x). Compare results for n=0,1.

$$f(x)=x^2 ,(-1<x<1), p=2 $$ $$f(x)=1-\frac{x^2}{4} ,(-2<x<2), p=4$$

Part 1
To determine if f(x) is even or odd, substitute -x in for x. If f(x)=f(-x) then the function is even.

$$f(-x)=(-x)^2=x^2=f(x)$$ $$f(-x)=1-\frac{(-x)^2}{4}=1-\frac{x^2}{4}=f(x)$$

Therefore both functions are even.

According to the book, the Fourier Series for even functions reduces to a Fourier cosine series.

$$f(x)= a_0 + \sum_{n=1}^\infty[a_n \cos \frac{n \pi}{L} x]$$

$$a_0= \frac{1}{L} \int_{0}^{L} f(x)dx$$

$$a_n= \frac{2}{L} \int_{0}^{L} f(x)\cos \frac{n \pi x}{L} dx$$

From the Figure shown in the Problem Statement, $$f(\bar{x})$$ has a period of p=4. Therefore L=2, $$\omega = \frac{2 \pi}{p}$$.

$$a_0= \frac{1}{2} \int_{0}^{2} f(\bar{x})d \bar{x}$$

$$a_0= \frac{A}{2}$$

$$a_n= \frac{2}{2} \int_{0}^{2} f(\bar{x})\cos \frac{n \pi \bar{x}}{2} d \bar{x}$$

$$a_n= \frac{2A}{k \pi} \sin \frac{k \pi}{2}$$

$$f_k(\bar{x})= \frac{A}{2} + \sum_{k=1}^n[(\frac{2A}{k \pi} \sin \frac{k \pi}{2}) \cos \frac{k \pi}{2} \bar{x}]$$

For n=0:

$$f_0(\bar{x})= \frac{A}{2}$$

For n=1:

$$f_1(\bar{x})= \frac{A}{2} + \frac{2A}{\pi} \cos \frac{\pi}{2} \bar{x}$$

$$\bar{x} = x - 1.25$$

$$f_k(x)= \frac{A}{2} + \frac{A}{\pi}\sin (\frac{\pi (x-1.25)}{2})$$

Let A=1

Part 2
From the Figure shown in the Problem Statement, $$f(\tilde{x})$$ has a period of p=4. Therefore L=2, $$\omega = \frac{2 \pi}{p}$$.

$$a_0= \frac{1}{2L} \int_{0}^{2L} f(\tilde{x})d \tilde{x}$$

$$a_0= \frac{1}{4} \int_{0}^{4} f(\tilde{x})d \tilde{x}$$

$$a_0= \frac{A}{2}$$

$$a_n= \frac{1}{L} \int_{0}^{2L} f(\tilde{x})\cos (n \omega \tilde{x}) d \tilde{x}$$

$$a_n= \frac{1}{2} \int_{0}^{4} f(\tilde{x})\cos (\frac{n \pi \tilde{x}}{2}) d \tilde{x}$$

$$a_n= \frac{1}{2} f(\tilde{x})\cos (\frac{n \pi \tilde{x}}{2}) \mid _0^4 = \frac{A}{n \pi} \sin (\pi k)$$

$$b_n= \frac{1}{L} \int_{0}^{2L} f(\tilde{x})\sin (n \omega \tilde{x}) d \tilde{x}$$

$$b_n= \frac{1}{2} \int_{0}^{4} f(\tilde{x})\sin (\frac{n \pi \tilde{x}}{2}) d \tilde{x}$$

$$b_n= \frac{1}{2} f(\tilde{x})\sin (\frac{n \pi \tilde{x}}{2}) \mid _0^4 = \frac{A}{n \pi}(1 - \cos (\pi k))$$

Since $$f(\tilde{x})$$ is an odd function the Fourier series reduces to a Fourier sine series.

$$f_k(\tilde{x})= \frac{A}{2} + \sum_{k=1}^n ([\frac{A}{k \pi}(1 - \cos (\pi k)] \sin [\frac{k \pi \tilde{x}}{2}])$$

For n=0:

$$f_0(\tilde{x})= \frac{A}{2}$$

For n=1:

$$f_1(\tilde{x})= \frac{A}{2} + \frac{A}{\pi}\sin (\frac{\pi \tilde{x}}{2})$$

$$\tilde{x} = x - 0.25$$

$$f_1(x)= \frac{A}{2} + \frac{A}{\pi}\sin (\frac{\pi (x-.25)}{2})$$

Let A=1

=R6.3 - Two Fourier Series=

Problem Statement
K 2011 p. 491 numbers 15 and 17

-State whether the function is even, odd, or neither

-Find it's Fourier series

-Plot the truncated Fourier series for n = 2, 4, and 8

Problem #15
$$ \displaystyle f(x)=-x-\pi $$ on $$ \displaystyle (-\pi,-\pi/2) $$

$$ \displaystyle f(x)=x $$ on $$ \displaystyle (-\pi/2,\pi/2) $$

$$ \displaystyle f(x)=-x+\pi $$ on $$ \displaystyle (\pi/2,\pi) $$

This function is an odd function.

This is proven by the fact that $$ \displaystyle f(-x)=-f(x) $$

Since this is an odd function and of period $$ \displaystyle 2\pi $$ its Fourier series reduces to the Fourier sine series shown here:

$$ \displaystyle f(x)=\sum_{n = 1}^{\infty} b_n\sin(nx) $$

Where the coefficient equals:

$$ \displaystyle b_n=\frac{2}{\pi}\int_{0}^{\pi}f(x)\sin(nx)dx $$

$$ \displaystyle b_n=\frac{2}{\pi}(\int_{0}^{\pi/2}x\sin(nx)dx + \int_{\pi/2}^{\pi}(-x+\pi)\sin(nx)dx) $$

$$ \displaystyle b_n=\frac{2}{\pi}(\int_{0}^{\pi/2}x\sin(nx)dx - \int_{\pi/2}^{\pi}x\sin(nx)dx + \int_{\pi/2}^{\pi}\pi\sin(nx)dx) $$

Using integration by parts and then cancelling like terms:

$$ \displaystyle b_n=\frac{2}{\pi}(\frac{2\sin(\frac{\pi}{2}n)}{n^2}) $$

Plugging this back into the function equation:

$$ \displaystyle f(x)=\sum_{n = 1}^{\infty}(\frac{4\sin(\frac{\pi}{2}n)}{\pi n^2})\sin(nx) $$

Expanding this, one obtains:

$$ \displaystyle f(x)=\frac{4}{\pi}(\sin x-\frac{1}{9}\sin3x+\frac{1}{25}\sin5x-...) $$

If n=2

$$ \displaystyle f(x)=\frac{4}{\pi}(\sin x) $$

If n=4

$$ \displaystyle f(x)=\frac{4}{\pi}(\sin x-\frac{1}{9}\sin3x) $$

If n=8

$$ \displaystyle f(x)=\frac{4}{\pi}(\sin x-\frac{1}{9}\sin3x+\frac{1}{25}\sin5x-\frac{1}{49}\sin7x) $$

Problem #17
$$ \displaystyle f(x)=x+1 $$ on $$ \displaystyle (-1,0) $$

$$ \displaystyle f(x)=-x+1 $$ on $$ \displaystyle (0,1) $$

This function is an even function.

This is proven by the fact that $$ \displaystyle f(-x)=f(x) $$

Since this is an even function and of period 2 its Fourier series reduces to the Fourier cosine series shown here:

$$ \displaystyle f(x)=a_0 + \sum_{n = 1}^{\infty} a_n\cos(n\pi x) $$

Where the coefficients are equal to:

$$ \displaystyle a_0=\int_{0}^{1}f(x)dx $$

$$ \displaystyle a_n=2\int_{0}^{1}f(x)\cos(n\pi x)dx $$

$$ \displaystyle a_0=\int_{0}^{1}(1-x) $$

$$ \displaystyle a_0=\frac{1}{2} $$

$$ \displaystyle a_n=2\int_{0}^{1}(1-x)\cos(n\pi x)dx $$

$$ \displaystyle a_n=2(\int_{0}^{1}\cos(n\pi x)dx - \int_{0}^{1}x\cos(n\pi x)dx ) $$

Using integration by parts and evaluating on the interval:

$$ \displaystyle a_n=2(\frac{1-\cos(n\pi)}{n^{2} \pi^{2}}) $$

Plugging this back into the function equation:

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

Expanding this, one obtains:

$$ \displaystyle f(x)=\frac{1}{2} + \frac{4}{\pi^2}(\cos \pi x+ \frac{1}{9}\cos3 \pi x+ \frac{1}{25}\cos5\pi x+...) $$

If n=2

$$ \displaystyle f(x)=\frac{1}{2} + \frac{4}{\pi^2}(\cos \pi x) $$

If n=4

$$ \displaystyle f(x)=\frac{1}{2} + \frac{4}{\pi^2}(\cos \pi x+ \frac{1}{9}\cos3 \pi x) $$

If n=8

$$ \displaystyle f(x)=\frac{1}{2} + \frac{4}{\pi^2}(\cos \pi x+ \frac{1}{9}\cos3 \pi x+ \frac{1}{25}\cos5\pi x+ \frac{1}{49}\cos7\pi x) $$

Problem #15
>> x=linspace(-pi,pi)

>> y2=(4/pi)*sin(x)

>> y4=(4/pi)*(sin(x)-(1/9)*sin(3*x))

>> y8=(4/pi)*(sin(x)-(1/9)*sin(3*x)+(1/25)*sin(5*x)-(1/49)*sin(7*x))

>> plot(x,y2,x,y4,x,y8)

Where y2 is blue, y4 is green and y8 is red

Problem #17
>> x=linspace(-1,1)

>> f2=.5+(4/pi^2)*cos(pi*x)

>> f4=.5+(4/pi^2)*(cos(pi*x)+(1/9)*cos(3*pi*x))

>> f8=.5+(4/pi^2)*(cos(pi*x)+(1/9)*cos(3*pi*x)+(1/25)*cos(5*pi*x)+(1/49)*cos(7*pi*x))

>> plot(x,f2,x,f4,x,f8)

Where f2 is blue, f4 is green and f8 is red

=R6.4 - Solve an ODE with a Fourier Series Excitation=

Problem Statement
Consider the L2-ODE-CC with the window function from R6.2, $$f(x)$$, as excitation:
 * $$y'' - 3y' + 2y = r(x)$$
 * $$r(x) = f(x)$$

And the initial conditions:
 * $$y(0) = 1,\;y'(0) = 0$$

Part 1
Find $$y_n(x)$$ such that:
 * $$y_n'' + a y_n' + b y_n = r_n(x)$$

with the same initial conditions.

Plot $$y_n(x)$$ for $$n=0,1$$, for $$x \in \left[ 0, \, 10 \right]$$.

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

Part 1
From R6.2, we know that our excitation functions are given by:
 * $$r_0(x) = f_0(x) = \frac{A}{2}$$
 * $$r_1(x) = f_1(x)= \frac{A}{2} + \frac{A}{\pi}\sin (\frac{\pi (x-.25)}{2})$$

Case $$n = 0$$
Setting $$n=0$$ yields the following:

$$r_0(x) = \frac12 A$$

So the ODE takes the form:

$$y''(x)-3y'(x)+2y(x)=A/2$$

Inputting into Wolfram Alpha with the initial conditions:

$$y(0)=1$$ and $$y'(0)=0$$

Yields the solution:

$$ y_{0}(x) = \frac14 (A (e^x-1)^2-4 e^x (e^x-2))$$

Case $$n = 1$$
Setting $$n=1$$ yields the following:

$$r_1(x) = \frac12 A + \frac{A}{\pi} \sin{\frac{\pi \left(x - \frac14 \right)}2}$$

So the ODE takes the form:

$$y''(x)-3y'(x)+2y(x)=\frac12 A + \frac{A}{\pi} \sin{\frac{\pi \left(x - \frac14 \right)}2}$$

Inputting into Wolfram Alpha with the initial conditions:

$$y(0)=1$$ and $$y'(0)=0$$

Yields the solution:

$$ y_{1}(x) = -0.598093 A e^x+0.283756 A e^{2x}+0.019468 A sin(1.5708 x)+0.0643367 A cos(1.5708 x)+0.25 A+2e^x-e^{2 x}$$

Part 2
Using the following Matlab function and inputs allows us to compare the analytical and numerical solutions:


 * [[Image:Egm4313.s12.team8.r6.4.y0.png]]


 * [[Image:Egm4313.s12.team8.r6.4.y1.png]]


 * [[Image:Egm4313.s12.team8.r6.4.y+y0+y1.png]]


 * [[Image:Egm4313.s12.team8.r6.4.y+y0+y1.zoomed.png]]

The zoomed plot shows, as expected, an increase in accuracy as n increases from 0 to 1.

=R6.5 - Analyzing Accuracy of Different Approximations=

Problem Statement
$$ \displaystyle \text{Part 1. R4.2, p7c-26} $$ $$ \displaystyle y_n(x)=y_{h,n}(x)+y_{p,n}(x) $$ $$ \displaystyle \text{For each of n=3,5,9, redisplay the expressions for } $$ $$ \displaystyle \text{the 3 functions } y_{p,n}(x), y_{h,n}(x), y_n(x), \text{ and plot these } $$ $$ \displaystyle \text{3 functions separately over the interval } \left[ 0,20 \pi \right]. $$

$$ \displaystyle \text{Exact solution: } y(x) = y_h(x)+y_p(x) $$ $$ \displaystyle \text{Redisplay the expressions for } y_p(x), y_h(x), y(x) $$

$$ \displaystyle \text{Superpose each of the above plot with that of the}$$ $$ \displaystyle \text{exact solution.} $$

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

$$ \displaystyle \text{Part 3. R4.4, p7c-29} $$ $$ \displaystyle \text{Understand and run the TA's code to produce} $$ $$ \displaystyle \text{a similar plot, but over a larger interval } \left[ 0.9, 10 \right], \text{ and } $$ $$ \displaystyle \text{for } n=4,7. \text{ Do zoom-in plots about } x = 1, 1.5, 2, 2.5 $$ $$ \displaystyle \text{and comment on the accurace of the approximations.} $$

Solution
$$ \displaystyle \text{Part 1.}$$

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

$$ \displaystyle \text{Homogeneous solution: } $$ $$ \displaystyle y_{h,3}(x)=2e^x-0.8008e^{2x} $$

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

$$ \displaystyle \text{n = 5} $$ $$ \displaystyle \text{Particular solution: } $$ $$ \displaystyle y_{p,5}(x)=-1.2526*10^{-8}x^{11}-2.0668*10^{-7}x^{10}-1.0334*10^{-6}x^9 \cdots $$ $$ \displaystyle -4.6503*10^{-6}x^8-1.1781*10^{-4}x^7-0.0011x^6-0.0033x^5 \cdots $$ $$ \displaystyle -0.0083x^4-0.0999x^3-0.3999x^2-0.3999x-0.2000 $$

$$ \displaystyle \text{Homogeneous solution: } $$ $$ \displaystyle y_{h,5}(x)=2.0001e^x-0.8001e^{2x} $$

$$ \displaystyle \text{General solution: } $$ $$ \displaystyle y_{5}(x)=2.0001e^x-0.8001e^{2x}-1.2526*10^{-8}x^{11}-2.0668*10^{-7}x^{10} \cdots $$ $$ \displaystyle -1.0334*10^{-6}x^9-4.6503*10^{-6}x^8-1.1781*10^{-4}x^7-0.0011x^6 \cdots $$ $$ \displaystyle -0.0033x^5-0.0083x^4-0.0999x^3-0.3999x^2-0.3999x-0.2000 $$

$$ \displaystyle \text{n = 9} $$ $$ \displaystyle \text{Particular solution: } $$ $$ \displaystyle y_{p,9}(x)=-4.1103*10^{-18}x^{19}-1.1714*10^{-16}x^{18}-1.0543*10^{-15}x^{17} \cdots $$ $$ \displaystyle -8.9615*10^{-15}x^{16}-4.5405*10^{-13}x^{15}-9.1408*10^{-12}x^{14} \cdots $$ $$ \displaystyle -6.3985*10^{-11}x^{13}-4.1590*10^{-10}x^{12}-1.5021*10^{-8}x^{11} \cdots $$ $$ \displaystyle -2.2040*10^{-7}x^{10}-1.1020*10^{-6}x^{9}-4.9591*10^{-6}x^{8} \cdots $$ $$ \displaystyle -1.1904*10^{-4}x^7-0.0011x^6-0.0033x^5-0.0083x^4 \cdots $$ $$ \displaystyle -0.1000x^3-0.4000x^2-0.4000x-0.2000 $$

$$ \displaystyle \text{Homogeneous solution: } $$ $$ \displaystyle y_{h,9}(x)=2e^x-0.8e^{2x} $$

$$ \displaystyle \text{General solution: } $$ $$ \displaystyle y_{9}(x)=2e^x-0.8e^{2x}-4.1103*10^{-18}x^{19}-1.1714*10^{-16}x^{18} \cdots $$ $$ \displaystyle -1.0543*10^{-15}x^{17}-8.9615*10^{-15}x^{16}-4.5405*10^{-13}x^{15} \cdots $$ $$ \displaystyle -9.1408*10^{-12}x^{14}-6.3985*10^{-11}x^{13}-4.1590*10^{-10}x^{12} \cdots $$ $$ \displaystyle -1.5021*10^{-8}x^{11}-2.2040*10^{-7}x^{10}-1.1020*10^{-6}x^{9} \cdots $$ $$ \displaystyle -4.9591*10^{-6}x^{8}-1.1904*10^{-4}x^7-0.0011x^6 \cdots $$ $$ \displaystyle -0.0033x^5-0.0083x^4-0.1000x^3-0.4000x^2-0.4000x-0.2000 \cdots $$

$$ \displaystyle \text{Exact Overall solution: } $$ $$ \displaystyle y(x)=1.5e^x-0.8e^{2x}+0.3 \cos x+0.1 \sin x $$

$$ \displaystyle \text{Part 2.}$$ $$ \displaystyle \text{The following plot displays the Taylor series of } log(1+x) $$ $$ \displaystyle \text{ about } \hat{x} = 0.$$

$$ \displaystyle \text{The zoom-in about } x = -0.5 \text{ is displayed below. Here, we can}$$ $$ \displaystyle \text{see the plot broken, showing the inaccuracy beyond this point. }$$



$$ \displaystyle \text{The zoom-in about } x = 0 \text{ is displayed below. Here, we can}$$ $$ \displaystyle \text{see that the plot is very exact, displaying the accuracy at x = 0.}$$

$$ \displaystyle \text{The zoom-in about } x = 0.5 \text{ is displayed below. Here, we can}$$ $$ \displaystyle \text{see that the plot has begun to veer off the exact solution.}$$



$$ \displaystyle \text{Part 3.}$$ $$ \displaystyle \text{The following plot displays the Taylor series of } log(1+x) $$ $$ \displaystyle \text{ about } \hat{x} = 1.$$

$$ \displaystyle \text{The zoom-in about } x = 1 \text{ is displayed below. }$$



$$ \displaystyle \text{The zoom-in about } x = 1.5 \text{ is displayed below. }$$



$$ \displaystyle \text{The zoom-in about } x = 2 \text{ is displayed below. }$$

$$ \displaystyle \text{The zoom-in about } x = 2.5 \text{ is displayed below. }$$

$$ \displaystyle \text{It is noted that the plots begin to diverge from the exact}$$ $$ \displaystyle \text{solution beginning (ever so slightly) at x = 1. }$$

=R6.6 - Verify Particular Solution to ODE=

Problem Statement
Verify the following:
 * $$6 e^{-2x} ( n \cos{3x} - m \sin{3x} )$$

As the left hand side to the following ODE:
 * $$y_p'' + 4 y_p' + 13y_p = 2 e^{-2x} \cos{3x}$$

Where:
 * $$y_p(x) = x e^{-2x} ( m \cos{3x} + n \sin{3x} )$$

Then, solve for m and n.

Solution
First, we find and simplify each term of the left hand side:
 * $$\begin{array}{rl}

y_p &= x e^{-2x} ( m \cos{3x} + n \sin{3x} ) \\ &= e^{-2x} ( m x \cos{3x} + n x \sin{3x} ) \\ 13 y_p &= e^{-2x} ( 13 m x \cos{3x} + 13 n x \sin{3x} ) \\ &\\ y_p' &= e^{-2 x} x (3 n \cos{3 x}-3 m \sin{3 x})+e^{-2 x} (m \cos{3 x}+n \sin{3 x})-2 e^{-2 x} x (m \cos{3 x}+n \sin{3 x}) \\ &= e^{-2 x} ((-2 m x+m+3 n x) \cos{3 x}+ (-3 m x-2 n x+n)\sin{3 x}) \\ 4 y_p' &= e^{-2 x} ((-8 m x+4m+12 n x) \cos{3 x}+ (-12 m x-8 n x+4n)\sin{3 x}) \\ &\\ y_p'' &= e^{-2 x} (3 n \cos{3 x}-3 m \sin{3 x}) \\ &\;\;+\left(e^{-2 x}-2 e^{-2 x} x\right) (3 n \cos  (3 x)-3 m \sin{3 x})\\ &\;\;+e^{-2 x} x (-9 m \cos{3 x}-9 n \sin{3 x})\\ &\;\;-2 e^{-2 x} (m  \cos{3 x}+n \sin{3 x})\\ &\;\;+4 e^{-2 x} x (m \cos{3 x}+n \sin{3 x})\\ &\;\;-2 e^{-2 x} (x (3 n \cos{3 x}-3 m \sin{3 x})+m \cos{3 x}+n \sin{3 x}) \\ &= e^{-2 x} ( (-5 x m - 4 m - 12 x n + 6 n) \cos{3 x} + (12 m x - 6 m - 5 x n - 4 n) \sin{3 x}) \end{array}$$

Then, we combine the three terms and simplify:
 * $$\begin{array}{rl}

y_p'' + 4 y_p' + 13 y_p &= e^{-2 x} ( (-5 x m - 4 m - 12 x n + 6 n) \cos{3 x} + (12 m x - 6 m - 5 x n - 4 n) \sin{3 x}) \\ &\;\;+e^{-2 x} ((-8 m x+4m+12 n x) \cos{3 x}+ (-12 m x-8 n x+4n)\sin{3 x}) + e^{-2x} ( 13 m x \cos{3x} + 13 n x \sin{3x} ) \\ &= 6 e^{-2x} ( n \cos{3x} - m \sin{3x} )\end{array}$$

This verifies the given left hand side. To solve for m and n, we set this equal to the right hand side of the ODE:
 * $$\begin{array}{rcl}

6 e^{-2x} ( n \cos{3x} - m \sin{3x} ) &=& 2 e^{-2x} \cos{3x} \\ 6 ( n \cos{3x} - m \sin{3x} ) &=& 2 \cos{3x} \\ n \cos{3x} - m \sin{3x} &=& \frac13 \cos{3x} \end{array}$$

Therefore:
 * $$\begin{array}{rl}

n &= \frac13 \\ m &= 0 \\ y_p(x) &= \frac13 x e^{-2x} \sin{3x} \end{array}$$

=R6.7 - Seperate ODE for Different Variables=

Problem Statement
Find the seperated ODEs for the heat equation

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

Solution
Assume $$\ u(x,t)=F(x)\cdot G(t)$$

where:

$$\ F(x)=f(x)$$, a function of only x

$$\ G(t)=f(t)$$, a function of only t

Finding first and second partial derivatives of u with restpect to x gives:

$$\ \frac{\partial u}{\partial x}=F'(x) \cdot G(t)$$

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

Finding first and second partial derivates of u with respect to t gives:

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

$$\ \frac{\partial^2 u}{\partial ^2t}=F(x) \cdot \ddot{G}(t)$$

Plugging these into the heat equation gives:

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

Combining like terms gives:

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

where c is a constant

$$\ \frac{\dot G(t)}{\kappa G(t)}=c   => \dot G(t)=c \kappa G(t)  =>  \dot G(t)-c \kappa G(t)=0$$

$$\ \frac{F(x)}{F(x)}=c    => F(x)=cF(x)     =>    F''(x)-cF(x)=0$$

$$\ \dot G(t)-c \kappa G(t)=0$$

$$\ F''(x)-cF(x)=0$$

=Team Contributions=