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

Report 4
Intermediate Engineering Analysis Section 7566 Team 11 Due date: March 14, 2012.

## R4.1
#### Problem Statement

Obtain equations (2), (3), (n-2), (n-1), (n), and set up the matrix A as in (1) p.7-21 for the general case, with the matrix coefficients for rows 1, 2, 3, (n-2), (n-1), n, filled in, as obtained from equations (1), (2), (3), (n-2), (n-1), (n).

#### Given

As shown in p.7-21, the first equation is:
$2C_{2}+ac_{1}+bc_{0}=d_{0}\!$ (1) p.7-21
According to p.7-20, the general form of the series is:
$\sum _{j=0}^{n-2}[c_{j+2}(j+2)(j+1)+ac_{j+1}+bc_{j}]x^{j}+ac_{n}nx^{n-1}+b[c_{n-1}x^{n-1}+c_{n}x^{n}]=\sum _{j=0}^{n}d_{j}x^{j}\!$ (2) p. 7-20
From (2) p.7-20, we can obtain n+1 equations for n+1 unknown coefficients ${c_{0},...,c_{n}}\!$.
After referring to p.7-22, it can be determined that the matrix to be set up is of the following form:
$A={\begin{bmatrix}X&&X&&X&&0&&0&0\\0&&X&&X&&0&&0&0\\0&&0&&X&&0&&0&0\\0&&0&&0&&X&&X&X\\0&&0&&0&&0&&X&X\\0&&0&&0&&0&&0&X\end{bmatrix}}\!$
where the rows signify the coefficients $c_{0},c_{1},c_{2},c_{n-2},c_{n-1},c_{n}\!$, and the columns signify $d_{0},d_{1},d_{2},d_{n-2},d_{n-1},d_{n}\!$.

#### Solution

Building the coefficient matrix as shown in p.7-22 of the class notes, we can begin to solve for the coefficients as follows:
Equation associated with $d_{0}\!$:
j=0: $d_{0}=2C_{2}+ac_{1}+bc_{0}\!$ (1)
Equation associated with $d_{1}\!$:
j=1: $d_{1}=6c_{3}+2ac_{2}+bc_{1}\!$ (2)
Equation associated with $d_{2}\!$:
j=2: $d_{2}=12c_{4}+3ac_{3}+bc_{2}\!$ (3)
Equation associated with $d_{n-2}\!$:
j=n-2: $d_{n-2}=[c_{n}(n)(n-1)+ac_{n-1}(n-1)+bc_{n-2}]\!$ (n-2)
Equation associated with $d_{n-1}\!$:
j=n-1: $d_{n-1}=ac_{n}n+bc_{n-1}\!$ (n-1)
Equation associated with $d_{n}\!$:
j=n: $d_{n}=bc_{n}\!$ (n)
Using all of the above equations, (1), (2), (3), (n-2), (n-1), (n), we can then determine the A matrix to be:
Solved by Gonzalo Perez

## R4.2
### Part 1

Solved by Jonathan Sheider

#### Problem Statement

Given: $y^{''}-3y^{'}+2y=sin(x)\!$
With initial conditions: $y(0)=1,y'(0)=0\!$
Using the Taylor series for sin(x), reproduce the graph in the lecture notes p.7-24.

#### Solution

The Taylor series expansion for sin(x) that is plotted with n = 13 is as follows: $y=x-{\frac {x^{3}}{3!}}+{\frac {x^{5}}{5!}}-{\frac {x^{7}}{7!}}+{\frac {x^{9}}{9!}}-{\frac {x^{11}}{11!}}+{\frac {x^{13}}{13!}}-{\frac {x^{15}}{15!}}+{\frac {x^{17}}{17!}}-{\frac {x^{19}}{19!}}+{\frac {x^{21}}{21!}}-{\frac {x^{23}}{23!}}+{\frac {x^{25}}{25!}}\!$
Using MatLab, the following Taylor series expansion was plotted and coded:
The plot created with n = 13 (i.e. 13 terms) is as follows:

### Part 2

Solved by Jonathan Sheider

#### Problem Statement

Given: $y^{''}-3y^{'}+2y=r(x)\!$
With initial conditions: $y(0)=1,y'(0)=0\!$
Letting $r(x)\!$ equal the truncated Taylor series of $sin(x)\!$, i.e. $r(x)=\sum _{k=0}^{n}{\frac {(-1)^{k}t^{2k+1}}{(2k+1)!}}\!$
Find the overall solution $y_{n}(x)\!$ for $n=3,5,9\!$ and plot these solutions on the interval from $[0,4\pi ]\!$

#### Solution

First finding the homogenous solution to the ODE:
The characteristic equation:
$\lambda ^{2}-3\lambda +2=0\!$
$(\lambda -2)(\lambda -1)=0\!$
Therefore, $\lambda =1,2\!$
And the homogenous solution is:
$y_{h}=c_{1}e^{x}+c_{2}e^{2x}\!$
Next the particular solution will be evaluated.
For n = 3:
The excitation is therefore: $r_{x}=x-{\frac {x^{3}}{3!}}+{\frac {x^{5}}{5!}}-{\frac {x^{7}}{7!}}\!$
Therefore the particular solution has a form:
$y_{p}=K_{7}x^{7}+K_{6}x^{6}+K_{5}x^{5}+K_{4}x^{4}+K_{3}x^{3}+K_{2}x^{2}+K_{1}x+K_{0}\!$
Differentiating:
$y_{p}^{'}=7K_{7}x^{6}+6K_{6}x^{5}+5K_{5}x^{4}+4K_{4}x^{3}+3K_{3}x^{2}+2K_{2}x+1K_{1}\!$
$y_{p}^{''}=42K_{7}x^{5}+30K_{6}x^{4}+20K_{5}x^{3}+12K_{4}x^{2}+6K_{3}x+2K_{2}\!$
Plugging these values into the ODE and equating them to the excitation:
$42K_{7}x^{5}+30K_{6}x^{4}+20K_{5}x^{3}+12K_{4}x^{2}+6K_{3}x+2K_{2}\!$
$-3(7K_{7}x^{6}+6K_{6}x^{5}+5K_{5}x^{4}+4K_{4}x^{3}+3K_{3}x^{2}+2K_{2}x+1K_{1})\!$ $+2(K_{7}x^{7}+K_{6}x^{6}+K_{5}x^{5}+K_{4}x^{4}+K_{3}x^{3}+K_{2}x^{2}+K_{1}x+K_{0})=x-{\frac {x^{3}}{3!}}+{\frac {x^{5}}{5!}}-{\frac {x^{7}}{7!}}\!$
$42K_{7}x^{5}+30K_{6}x^{4}+20K_{5}x^{3}+12K_{4}x^{2}+6K_{3}x+2K_{2}\!$
$-21K_{7}x^{6}-18K_{6}x^{5}-15K_{5}x^{4}-12K_{4}x^{3}-9K_{3}x^{2}-6K_{2}x-3K_{1}\!$ $+2K_{7}x^{7}+2K_{6}x^{6}+2K_{5}x^{5}+2K_{4}x^{4}+2K_{3}x^{3}+2K_{2}x^{2}+2K_{1}x+2K_{0}=x-{\frac {x^{3}}{3!}}+{\frac {x^{5}}{5!}}-{\frac {x^{7}}{7!}}\!$
To solve this, we will use an upper triangular matrix, and solve using Matlab. The matrix is as follows:
${\begin{bmatrix}2&-3&2&0&0&0&0&0\\0&2&-6&6&0&0&0&0\\0&0&2&-9&12&0&0&0\\0&0&0&2&-12&20&0&0\\0&0&0&0&2&-15&30&0\\0&0&0&0&0&2&-18&42\\0&0&0&0&0&0&2&-21\\0&0&0&0&0&0&0&2\end{bmatrix}}{\begin{bmatrix}K_{0}\\K_{1}\\K_{2}\\K_{3}\\K_{4}\\K_{5}\\K_{6}\\K_{7}\end{bmatrix}}={\begin{bmatrix}0\\1\\0\\-{\frac {1}{3!}}\\0\\{\frac {1}{5!}}\\0\\-{\frac {1}{7!}}\end{bmatrix}}\!$
The answer is calculated in Matlab:
Therefore: $y_{p}={\frac {-1}{10080}}x^{7}+{\frac {-1}{960}}x^{6}+{\frac {-1}{320}}x^{5}+{\frac {-1}{128}}x^{4}+{\frac {-19}{192}}x^{3}+{\frac {-51}{128}}x^{2}+{\frac {-51}{128}}x+{\frac {-51}{256}}\!$
The final solution is then found to be: $y_{n}=c_{1}e^{x}+c_{2}e^{2x}+{\frac {-1}{10080}}x^{7}+{\frac {-1}{960}}x^{6}+{\frac {-1}{320}}x^{5}+{\frac {-1}{128}}x^{4}+{\frac {-19}{192}}x^{3}+{\frac {-51}{128}}x^{2}+{\frac {-51}{128}}x+{\frac {-51}{256}}\!$
Evaluating at the initial conditions, we have:
$y_{n}(0)=c_{1}+c_{2}+{\frac {-51}{256}}=1\!$
$y_{n}^{'}(0)=c_{1}+2c_{2}+{\frac {-51}{128}}=0\!$
Solving this system of equations, we find:
$c_{1}=2,c_{2}={\frac {-205}{256}}\!$
Therefore the final solution is:
$y_{n}=2e^{x}+{\frac {-205}{256}}e^{2x}+{\frac {-1}{10080}}x^{7}+{\frac {-1}{960}}x^{6}+{\frac {-1}{320}}x^{5}+{\frac {-1}{128}}x^{4}+{\frac {-19}{192}}x^{3}+{\frac {-51}{128}}x^{2}+{\frac {-51}{128}}x+{\frac {-51}{256}}\!$
Plotting this equation in Matlab yields:
For n = 5:
The excitation is therefore: $r_{x}=x-{\frac {x^{3}}{3!}}+{\frac {x^{5}}{5!}}-{\frac {x^{7}}{7!}}+{\frac {x^{9}}{9!}}-{\frac {x^{11}}{11!}}\!$
Therefore the particular solution has a form:
$y_{p}=K_{11}x^{11}+K_{10}x^{10}+K_{9}x^{9}+K_{8}x^{8}+K_{7}x^{7}+K_{6}x^{6}+K_{5}x^{5}+K_{4}x^{4}+K_{3}x^{3}+K_{2}x^{2}+K_{1}x+K_{0}\!$
Differentiating:
$y_{p}^{'}=11K_{11}x^{10}+10K_{10}x^{9}+9K_{9}x^{8}+8K_{8}x^{7}+7K_{7}x^{6}+6K_{6}x^{5}+5K_{5}x^{4}+4K_{4}x^{3}+3K_{3}x^{2}+2K_{2}x+1K_{1}\!$
$y_{p}^{''}=110K_{11}x^{9}+90K_{10}x^{8}+72K_{9}x^{7}+56K_{8}x^{6}+42K_{7}x^{5}+30K_{6}x^{4}+20K_{5}x^{3}+12K_{4}x^{2}+6K_{3}x+2K_{2}\!$
Plugging these values into the ODE and equating them to the excitation, and then solving them by using a upper triangular matrix as before (just as in the n=3 example) in Matlab:
Therefore: $y_{p}={\frac {-1}{79833600}}x^{11}+{\frac {-1}{4838400}}x^{10}+{\frac {-1}{967680}}x^{9}+{\frac {-1}{215040}}x^{8}+{\frac {-7}{59419}}x^{7}+{\frac {-17}{15360}}x^{6}\!$
$+{\frac {-17}{5120}}x^{5}+{\frac {-17}{2048}}x^{4}+{\frac {-307}{3072}}x^{3}+{\frac {-819}{2048}}x^{2}+{\frac {-819}{2048}}x+{\frac {-819}{4096}}\!$
The final solution is then found to be: $y_{n}=c_{1}e^{x}+c_{2}e^{2x}+{\frac {-1}{79833600}}x^{11}+{\frac {-1}{4838400}}x^{10}+{\frac {-1}{967680}}x^{9}+{\frac {-1}{215040}}x^{8}+{\frac {-7}{59419}}x^{7}+{\frac {-17}{15360}}x^{6}\!$ $+{\frac {-17}{5120}}x^{5}+{\frac {-17}{2048}}x^{4}+{\frac {-307}{3072}}x^{3}+{\frac {-819}{2048}}x^{2}+{\frac {-819}{2048}}x+{\frac {-819}{4096}}\!$
Evaluating at the initial conditions, we have:
$y_{n}(0)=c_{1}+c_{2}+{\frac {-819}{4096}}=1\!$
$y_{n}^{'}(0)=c_{1}+2c_{2}+{\frac {-819}{2048}}=0\!$
Solving this system of equations, we find:
$c_{1}=2,c_{2}={\frac {-3277}{4096}}\!$
Therefore the final solution is:
$y_{n}=2e^{x}+{\frac {-3277}{4096}}e^{2x}+{\frac {-1}{79833600}}x^{11}+{\frac {-1}{4838400}}x^{10}+{\frac {-1}{967680}}x^{9}+{\frac {-1}{215040}}x^{8}+{\frac {-7}{59419}}x^{7}+{\frac {-17}{15360}}x^{6}\!$ $+{\frac {-17}{5120}}x^{5}+{\frac {-17}{2048}}x^{4}+{\frac {-307}{3072}}x^{3}+{\frac {-819}{2048}}x^{2}+{\frac {-819}{2048}}x+{\frac {-819}{4096}}\!$
Plotting this equation in Matlab yields:
For n = 9:
The excitation is therefore: $r_{x}=x-{\frac {x^{3}}{3!}}+{\frac {x^{5}}{5!}}-{\frac {x^{7}}{7!}}+{\frac {x^{9}}{9!}}-{\frac {x^{11}}{11!}}+{\frac {x^{13}}{13!}}-{\frac {x^{15}}{15!}}+{\frac {x^{17}}{17!}}-{\frac {x^{19}}{19!}}\!$
Therefore the particular solution has a form:
$y_{p}=K_{19}x^{19}+K_{18}x^{18}+K_{17}x^{17}+K_{16}x^{16}+K_{15}x^{15}+K_{14}x^{14}+K_{13}x^{13}+K_{12}x^{12}+K_{11}x^{11}+K_{10}x^{10}\!$
$+K_{9}x^{9}+K_{8}x^{8}+K_{7}x^{7}+K_{6}x^{6}+K_{5}x^{5}+K_{4}x^{4}+K_{3}x^{3}+K_{2}x^{2}+K_{1}x+K_{0}\!$
Differentiating:
$y_{p}^{'}=19K_{19}x^{18}+18K_{18}x^{17}+17K_{17}x^{16}+16K_{16}x^{15}+15K_{15}x^{14}+14K_{14}x^{13}+13K_{13}x^{12}+12K_{12}x^{11}+11K_{11}x^{10}+10K_{10}x^{9}\!$ $+9K_{9}x^{8}+8K_{8}x^{7}+7K_{7}x^{6}+6K_{6}x^{5}+5K_{5}x^{4}+4K_{4}x^{3}+3K_{3}x^{2}+2K_{2}x+1K_{1}\!$
$y_{p}^{''}=342K_{19}x^{17}+306K_{18}x^{16}+272K_{17}x^{15}+240K_{16}x^{14}+210K_{15}x^{13}+182K_{14}x^{12}+156K_{13}x^{11}+132K_{12}x^{10}+110K_{11}x^{9}+90K_{10}x^{8}\!$
$+72K_{9}x^{7}+56K_{8}x^{6}+42K_{7}x^{5}+30K_{6}x^{4}+20K_{5}x^{3}+12K_{4}x^{2}+6K_{3}x+2K_{2}\!$
Plugging these values into the ODE and equating them to the excitation, and then solving them by using an upper triangular matrix as before (just as in the n=3 example) in Matlab:
Therefore: $y_{p}={\frac {-1}{2.433E17}}x^{19}+{\frac {-1}{8.536E15}}x^{18}+{\frac {-1}{9.485E14}}x^{17}+{\frac {-1}{1.112E14}}x^{16}+{\frac {-1}{2.202E12}}x^{15}+{\frac {-1}{1.094E11}}x^{14}\!$
$+{\frac {-1}{1.563E10}}x^{13}+{\frac {-1}{2.404E9}}x^{12}+{\frac {-1}{6.657E7}}x^{11}+{\frac {-1}{4.537E6}}x^{10}+{\frac {-1}{9.074E5}}x^{9}+{\frac {-4}{8.066E5}}x^{8}+{\frac {-38}{3.192E5}}x^{7}\!$ $+{\frac {-73}{657010}}x^{6}+{\frac {-218}{65401}}x^{5}+{\frac {-218}{65401}}x^{4}+{\frac {-3441}{49157}}x^{3}+{\frac {-1198}{4061}}x^{2}+{\frac {-1431}{8177}}x+{\frac {145}{4462}}\!$
The final solution is then found to be: $y_{n}=c_{1}e^{x}+c_{2}e^{2x}+{\frac {-1}{2.433E17}}x^{19}+{\frac {-1}{8.536E15}}x^{18}+{\frac {-1}{9.485E14}}x^{17}+{\frac {-1}{1.112E14}}x^{16}+{\frac {-1}{2.202E12}}x^{15}+{\frac {-1}{1.094E11}}x^{14}\!$
$+{\frac {-1}{1.563E10}}x^{13}+{\frac {-1}{2.404E9}}x^{12}+{\frac {-1}{6.657E7}}x^{11}+{\frac {-1}{4.537E6}}x^{10}+{\frac {-1}{9.074E5}}x^{9}+{\frac {-4}{8.066E5}}x^{8}+{\frac {-38}{3.192E5}}x^{7}\!$ $+{\frac {-73}{657010}}x^{6}+{\frac {-218}{65401}}x^{5}+{\frac {-218}{65401}}x^{4}+{\frac {-3441}{49157}}x^{3}+{\frac {-1198}{4061}}x^{2}+{\frac {-1431}{8177}}x+{\frac {145}{4462}}\!$
Evaluating at the initial conditions, we have:
$y_{n}(0)=c_{1}+c_{2}+{\frac {145}{4462}}=1\!$
$y_{n}^{'}(0)=c_{1}+2c_{2}+{\frac {-1431}{8177}}=0\!$
Solving this system of equations, we find:
$c_{1}=1.76,c_{2}=-0.7925\!$
Therefore the final solution is:
$y_{n}=1.76e^{x}+-0.7925e^{2x}+{\frac {-1}{2.433E17}}x^{19}+{\frac {-1}{8.536E15}}x^{18}+{\frac {-1}{9.485E14}}x^{17}+{\frac {-1}{1.112E14}}x^{16}+{\frac {-1}{2.202E12}}x^{15}+{\frac {-1}{1.094E11}}x^{14}\!$
$+{\frac {-1}{1.563E10}}x^{13}+{\frac {-1}{2.404E9}}x^{12}+{\frac {-1}{6.657E7}}x^{11}+{\frac {-1}{4.537E6}}x^{10}+{\frac {-1}{9.074E5}}x^{9}+{\frac {-4}{8.066E5}}x^{8}+{\frac {-38}{3.192E5}}x^{7}\!$ $+{\frac {-73}{65701}}x^{6}+{\frac {-218}{65401}}x^{5}+{\frac {-218}{65401}}x^{4}+{\frac {-3441}{49157}}x^{3}+{\frac {-1198}{4061}}x^{2}+{\frac {-1431}{8177}}x+{\frac {145}{4462}}\!$
Plotting this equation in Matlab yields:
Note: On the interval from $0\!$ to $4\pi \!$, the resulting plots of the solutions, on such a large scale (note that the Y-axis is forced to be on the order of $10^{10}\!$!) each plot looks almost exactly identical. It is not until you are able to zoom in a lot do you see the very slight change in the curve of each plot on this interval.
--Egm4313.s12.team11.sheider (talk) 01:09, 14 March 2012 (UTC)

### Part 3

Solved by Daniel Suh

#### Problem Statement

Using the particular solution from Table 2.1 on Kreyszig, find the overall solution $y(x)\!$, and plot it compared with $y_{n}(x)\!$ for n = 3,5,9
$y''-3y'+2y=r(x)\!$ $r(x)=sin(x)\!$ Initial Conditions: $y(0)=1\!$, $y'(0)=0\!$

#### Homogenous Solution

To find $y_{h}(x)\!$, $y''-3y'+2y=r(x)\!$ $\lambda ^{2}-3\lambda +2=0\!$ $(\lambda -2)(\lambda -1)=0\!$ $\lambda _{1}=2,\lambda _{2}=1\!$ $y_{h}(x)=c_{1}e^{2x}+c_{2}e^{x}\!$

#### Particular Solution

To find $y_{p}(x)\!$, Using Table 2.1, we find that for $r(x)=sin(x)\!$, $y_{p}=Kcos(\omega x)+Msin(\omega x)\!$ $y'_{p}=-Ksin(\omega x)+Mcos(\omega x)\!$ $y''_{p}=-Kcos(\omega x)-Msin(\omega x)\!$
Plugging it back into the equation, $(-Kcos(x)-Msin(x))-3(-Ksin(x)+Mcos(x))+2(Kcos(x)+Msin(x))=sin(x)\!$ $(3K+M)sin(x)+(K-3M)cos(x)=sin(x)\!$
Solving for coefficients, $(3K+M)=1\!$ $(K-3M)=0\!$ $K={\frac {3}{10}}\!$ $M={\frac {1}{10}}\!$ $y_{p}(x)={\frac {3}{10}}cos(x)+{\frac {1}{10}}sin(x)\!$

#### Overall Solution

$y(x)=y_{h}(x)+y_{p}(x)\!$ $y(x)=c_{1}e^{2x}+c_{2}e^{x}+{\frac {3}{10}}cos(x)+{\frac {1}{10}}sin(x)\!$
Solving with initial conditions, $y(x)=c_{1}e^{2x}+c_{2}e^{x}+{\frac {3}{10}}cos(x)+{\frac {1}{10}}sin(x)\!$ $y'(x)=2c_{1}e^{2x}+c_{2}e^{x}-{\frac {3}{10}}sin(x)+{\frac {1}{10}}cos(x)\!$
$1=c_{1}+c_{2}+{\frac {3}{10}}\!$ $0=2c_{1}+c_{2}+{\frac {1}{10}}\!$ $c_{1}={\frac {-4}{5}}\!$ $c_{2}={\frac {3}{2}}\!$
$y(x)={\frac {-4}{5}}e^{2x}+{\frac {3}{2}}e^{x}+{\frac {3}{10}}cos(x)+{\frac {1}{10}}sin(x)\!$ $\!$

#### Plot

Plotting in matlab yields:
As shown on the graph, the two plots are exactly the same.
Created by [Daniel Suh] 20:43, 13 March 2012 (UTC)

## R4.3
#### Part 1

Solved by Francisco Arrieta

##### Problem Statement

    Develop $\log(x+1)\!$ in Taylor Series about $x=0\!$ to reproduce the figure on page 7-25

##### Given

    $f(x)=\sum _{n=0}^{\infty }{\frac {f^{(n)}({\hat {x}})}{n!}}(x-{\hat {x}})^{n}\!$

##### Solution

For n=4:
    $\log(x+1)={\frac {x}{\log(10)}}-{\frac {x^{2}}{\log(10^{2})}}+{\frac {x^{3}}{\log(10^{3})}}-{\frac {x^{4}}{\log(10^{4})}}\!$
For n=7:
    $\log(x+1)={\frac {x}{\log(10)}}-{\frac {x^{2}}{\log(10^{2})}}+{\frac {x^{3}}{\log(10^{3})}}-{\frac {x^{4}}{\log(10^{4})}}+{\frac {x^{5}}{\log(10^{5})}}-{\frac {x^{6}}{\log(10^{6})}}+{\frac {x^{7}}{\log(10^{7})}}\!$
For n=11:
    $\log(x+1)={\frac {x}{\log(10)}}-{\frac {x^{2}}{\log(10^{2})}}+{\frac {x^{3}}{\log(10^{3})}}-{\frac {x^{4}}{\log(10^{4})}}+{\frac {x^{5}}{\log(10^{5})}}-{\frac {x^{6}}{\log(10^{6})}}+{\frac {x^{7}}{\log(10^{7})}}-{\frac {x^{8}}{\log(10^{8})}}+{\frac {x^{9}}{\log(10^{9})}}-{\frac {x^{10}}{\log(10^{10})}}+{\frac {x^{11}}{\log(10^{11})}}\!$
For n=16:
    $\log(x+1)={\frac {x}{\log(10)}}-{\frac {x^{2}}{\log(10^{2})}}+{\frac {x^{3}}{\log(10^{3})}}-{\frac {x^{4}}{\log(10^{4})}}+{\frac {x^{5}}{\log(10^{5})}}-{\frac {x^{6}}{\log(10^{6})}}+{\frac {x^{7}}{\log(10^{7})}}-{\frac {x^{8}}{\log(10^{8})}}+{\frac {x^{9}}{\log(10^{9})}}-{\frac {x^{10}}{\log(10^{10})}}+{\frac {x^{11}}{\log(10^{11})}}\!$
                   $-{\frac {x^{12}}{\log(10^{12})}}+{\frac {x^{13}}{\log(10^{13})}}-{\frac {x^{14}}{\log(10^{14})}}+{\frac {x^{15}}{\log(10^{15})}}-{\frac {x^{16}}{\log(10^{16})}}\!$
Using MATLAB
--Egm4313.s12.team11.arrieta (talk) 00:44, 14 March 2012 (UTC)

### Part 2

Solved by: --Egm4313.s12.team11.vargas.aa (talk) 01:28, 14 March 2012 (UTC)

#### Problem Statement

Given: $y''-3y'+2y=r(x)\!$
where $r(x)=\log(1+x)\!$
With initial conditions: $y(-{\frac {3}{4}})=1,y'(-{\frac {3}{4}})=0\!$
Find the overall solution $y_{n}(x)\!$ for $n=4,7,11\!$ and plot these solutions on the interval from $[-{\frac {3}{4}},3]\!$

#### Solution

First we find the homogeneous solution to the ODE: The characteristic equation is: $\lambda ^{2}-3\lambda +2=0\!$
$(\lambda -2)(\lambda -1)=0\!$ Then, $\lambda =1,2\!$ Therefore the homogeneous solution is: $y_{h}=C_{1}e^{2x)+c_{2}e^{x}\!$
Now to find the particulate solution For n=4
$r(x)=\sum _{0}^{n}-{\frac {(-1)^{n}x^{n}}{n\ln(10)}}\!$
$r(x)={\frac {x}{\ln(10)}}-{\frac {x^{2}}{2\ln(10)}}+{\frac {x^{3}}{3\ln(10)}}-{\frac {x^{4}}{4\ln(10)}}\!$
We can then use a matrix to organize the known coefficients:
${\begin{bmatrix}2&-3&2&0&0\\0&2&-6&6&0\\0&0&2&-9&12\\0&0&0&2&-12\\0&0&0&0&2\\\end{bmatrix}}{\begin{bmatrix}K_{0}\\K_{1}\\K_{2}\\K_{3}\\K_{4}\end{bmatrix}}={\begin{bmatrix}0\\{\frac {1}{ln(10)}}\\{\frac {1}{2ln(10)}}\\{\frac {1}{3ln(10)}}\\{\frac {1}{4ln(10)}}\end{bmatrix}}\!$
Then, using MATLAB and the backlash operator we can solve for these unknowns:
Therefore $y_{p4}=4.0444+3.7458x+1.5743x^{2}+0.3981x^{3}+0.0543x^{4}\!$
Superposing the homogeneous and particulate solution we get $y_{n}=4.0444+3.7458x+1.5743x^{2}+0.3981x^{3}+0.0543x^{4}+C_{1}e^{2x}+C_{2}e^{x}\!$
Differentiating: $y'_{n}=3.7458+3.1486x+1.1943x^{2}+0.2172x^{3}+2C_{1}e^{2x}+C_{2}e^{x}\!$ Evaluating at the initial conditions: $y(-0.75)=0.9698261719+0.231301601C_{!}+0.4723665527C_{2}=1\!$ $y'(-0.75)=1.9645125+0.4462603203C_{1}+0.4723665527C_{2}\!$
We obtain: $C_{1}=-4.46\!$ $C_{2}=0.055\!$
Finally we have: $y_{n}=4.0444+3.7458x+1.5743x^{2}+0.3981x^{3}+0.0543x^{4}-4.46e^{2x}+0.055e^{x}\!$
For n=7
$r(x)=\sum _{0}^{n}-{\frac {(-1)^{n}x^{n}}{n\ln(10)}}\!$
$r(x)={\frac {x}{\ln(10)}}-{\frac {x^{2}}{2\ln(10)}}+{\frac {x^{3}}{3\ln(10)}}-{\frac {x^{4}}{4\ln(10)}}+{\frac {x^{5}}{5\ln(10)}}-{\frac {x^{6}}{6\ln(10)}}+{\frac {x^{7}}{7\ln(10)}}\!$
We can then use a matrix to organize the known coefficients:
${\begin{bmatrix}2&-3&2&0&0&0&0&0\\0&2&-6&6&0&0&0&0\\0&0&2&-9&12&0&0&0\\0&0&0&2&-12&20&0&0\\0&0&0&0&2&-15&30&0\\0&0&0&0&0&2&-18&42\\0&0&0&0&0&0&2&-21\\0&0&0&0&0&0&0&2\\\end{bmatrix}}{\begin{bmatrix}K_{0}\\K_{1}\\K_{2}\\K_{3}\\K_{4}\\K_{5}\\K_{6}\\K_{7}\end{bmatrix}}{\begin{bmatrix}0\\{\frac {1}{ln(10)}}\\{\frac {1}{2ln(10)}}\\{\frac {1}{3ln(10)}}\\{\frac {1}{4ln(10)}}\\{\frac {1}{5ln(10)}}\\{\frac {1}{6ln(10)}}\\{\frac {1}{7ln(10)}}\end{bmatrix}}\!$
Then, using MATLAB and the backlash operator we can solve for these unknowns:
Therefore $y_{p7}=377.4833+375.3933x+185.6066x^{2}+60.5479x^{3}+14.4946x^{4}+2.6492x^{5}+0.3619x^{6}+0.0310x^{7}\!$
Superposing the homogeneous and particulate solution we get $y_{n}=377.4833+375.3933x+185.6066x^{2}+60.5479x^{3}+14.4946x^{4}+2.6492x^{5}+0.3619x^{6}+0.0310x^{7}+C_{1}e^{2x}+c_{2}e^{x}\!$
Differentiating: $y'_{n}=375.3933+371.213x+181.644x^{2}+57.9784x^{3}+13.46x^{4}+2.1714x^{5}+0.214x^{6}+2C_{1}e^{2x}+C_{2}e^{x}\!$ Evaluating at the initial conditions: $y(-0.75)=178.816+0.2231301601C_{!}+0.4723665527C_{2}=1\!$ $y'(-0.75)=178.413+0.4462603203C_{1}+0.4723665527C_{2}\!$
We obtain: $C_{1}=-2.6757\!$ $C_{2}=-375.173\!$
Finally $y_{n}=377.4833+375.3933x+185.6066x^{2}+60.5479x^{3}+14.4946x^{4}+2.6492x^{5}+0.3619x^{6}+0.0310x^{7}+-2.6757e^{2x}-375.173e^{x}\!$
For n=11 $r(x)=\sum _{0}^{n}-{\frac {(-1)^{n}x^{n}}{n\ln(10)}}\!$
$r(x)={\frac {x}{\ln(10)}}-{\frac {x^{2}}{2\ln(10)}}+{\frac {x^{3}}{3\ln(10)}}-{\frac {x^{4}}{4\ln(10)}}+{\frac {x^{5}}{5\ln(10)}}-{\frac {x^{6}}{6\ln(10)}}+{\frac {x^{7}}{7\ln(10)}}\!$
We can then use a matrix to organize the known coefficients:
${\begin{bmatrix}K_{0}\\K_{1}\\K_{2}\\K_{3}\\K_{4}\\K_{5}\\K_{6}\\K_{7}\\K_{8}\\K_{9}\\K_{10}\\K_{11}\end{bmatrix}}={\begin{bmatrix}0\\{\frac {1}{ln(10)}}\\{\frac {1}{2ln(10)}}\\{\frac {1}{3ln(10)}}\\{\frac {1}{4ln(10)}}\\{\frac {1}{5ln(10)}}\\{\frac {1}{6ln(10)}}\\{\frac {1}{7ln(10)}}\\{\frac {1}{8ln(10)}}\\{\frac {1}{9ln(10)}}\\{\frac {1}{10ln(10)}}\\{\frac {1}{11ln(10)}}\end{bmatrix}}\!$
Then, using MATLAB and the backlash operator we can solve for these unknowns:
Therefore $y_{p11}=1753158.594+1752673.419x+875851.535x^{2}+291627.134x^{3}+72745.1129x^{4}+14484.362x^{5}+2392.510x^{6}+335.632x^{7}+40.417x^{8}\!$ $+4.1499x^{9}+0.3474x^{10)+0.0197x^{11)\!$
Superposing the homogeneous and particulate solution we get $y_{n}=1753158.594+1752673.419x+875851.535x^{2}+291627.134x^{3}+72745.1129x^{4}+14484.362x^{5}+2392.510x^{6}+335.632x^{7}+40.417x^{8}\!$ $+4.1499x^{9}+0.3474x^{10)+0.0197x^{11)+C_{1}e^{2x}+C_{2}e^{x)\!$
Differentiating: $y'_{n}=0.2167x^{1}0+3.474x^{9}+37.3491x^{8}+323.336x^{7}+2349.42x^{6}+14355.1x^{5}+72421.8x^{4}+290980.x^{3}+874881.x^{2}\!$ $+1.7517x10^{6}x+1.75267x10^{6}+2C_{1}e^{2x}+C_{2}e^{x}\!$ Evaluating at the initial conditions: $y(-0.75)=828254+0.2231301601C_{!}+0.4723665527C_{2}=1\!$ $y'(-0.75)=828145+0.4462603203C_{1}+0.4723665527C_{2}=0\!$
We obtain: $C_{1}=-484.022\!$ $C_{2}=-1753750\!$
Finally $y_{n}=1753158.594+1752673.419x+875851.535x^{2}+291627.134x^{3}+72745.1129x^{4}+14484.362x^{5}+2392.510x^{6}+335.632x^{7}+40.417x^{8}\!$ $+4.1499x^{9}+0.3474x^{10)+0.0197x^{11)-484.022e^{2x}-1753750e^{x}\!$

### Part 3

Plot for part 2 and part 3. Please note that because of the broad scale, it is almost impossible to distinguish between the graphs for n=4,7,11 nad the ODE45 operator. Only when zoomed in is there any noticeable difference

## R4.4
### Part 1
#### Problem Statement

Find n sufficiently high so that $y_{n}(x_{1}),y'_{n}(x_{1})$ do not differ from the numerical solution by more than $10^{-5}$ at $x_{1}=0.9$

#### Solution

Using a program in MATLAB that iteratively added terms onto the taylor series of $log(1+x)$, terms were added until the error between the exact answer and the series was less than $10^{-5}$.
It was found after trial and error that $n=39$ for the error to be of a magnitude of $10^{-5}$. This error found was 9.7422e-005
Similarly, for $y'_{n}(x_{1})$.
It was found after trial and error that $n=74$ for the error to be of a magnitude of $10^{-5}$. This error found was 9.3967e-005

### Part 2
#### Problem Statement

Develop $log(1+x)$ in Taylor series about ${\hat {x}}=1$ for $n=4,7,11$ and plot these truncated series vs. the exact function. What is now the domain of convergence by observation?

#### Solution

A MATLAB program was created, which calculated the Taylor series of each n value, along with the exact function, then plotted these together to show the comparison of all the series. Below is the Taylor series for $n=7$ expanded at ${\hat {x}}=1$. ${\frac {x-1}{2\,\ln \!\left(10\right)}}-{\frac {{\left(x-1\right)}^{2}}{8\,\ln \!\left(10\right)}}+{\frac {{\left(x-1\right)}^{3}}{24\,\ln \!\left(10\right)}}-{\frac {{\left(x-1\right)}^{4}}{64\,\ln \!\left(10\right)}}+{\frac {{\left(x-1\right)}^{5}}{160\,\ln \!\left(10\right)}}-{\frac {{\left(x-1\right)}^{6}}{384\,\ln \!\left(10\right)}}+{\frac {\ln \!\left(2\right)}{\ln \!\left(10\right)}}$
It can be seen by observation that the domain of convergence has shifted to the right one unit.
--egm4313.s12.team11.gooding (talk) 03:48, 14 March 2012 (UTC)

## Part 3=

Solved by Luca Imponenti
Find $y_{n}(x)\!$ , for $n=4,7,11\!$ such that:
       $y_{n}''-3y_{n}'+2y_{n}=r_{n}(x)\!$
for $x\!$ in $[0.9,3]\!$ with the initial conditions found.
Plot $y_{n}(x)\!$ for $n=4,7,11\!$ for $x\!$ in $[0.9,3]\!$.

#### Homogeneous Solution

The homogeneous case is shown below:
       $y''_{h}-3y'_{h}+2y_{h}=0\!$
This equation has the following roots:
$\lambda _{1}=1,\lambda _{2}=2\!$
Which gives yields the homogeneous solution
       $y_{h}=c_{1}e^{x}+c_{2}e^{2x}\!$

#### General Solution, n=4

Using the taylor series approximation from earlier with $n=4\!$ we have
$r_{4}(x)=log(2)+{\frac {(x-1)}{2ln(10)}}-{\frac {(x-1)^{2}}{8ln(10)}}+{\frac {(x-1)^{3}}{24ln(10)}}-{\frac {(x-1)^{4}}{64ln(10)}}\!$
We know the particular solution, $y_{p4}(x)\!$, ve will have this form:
$y_{p4}(x)=a_{4}(x-1)^{4}+a_{3}(x-1)^{3}+a_{2}(x-1)^{2}+a_{1}(x-1)+a_{0}\!$
taking the derivatives of this solution
$y'_{p4}(x)={\frac {d}{dx}}y_{p4}(x)=4a_{4}(x-1)^{3}+3a_{3}(x-1)^{2}+2a_{2}(x-1)+a_{1}\!$
and
$y''_{p4}(x)={\frac {d}{dx}}y'_{p4}(x)=12a_{4}(x-1)^{3}+6a_{3}(x-1)^{2}+2a_{2}\!$
Plugging the above equations into the original ODE yields the following matrix equation:
       ${\begin{bmatrix}2&0&0&0&0\\-12&2&0&0&0\\12&-9&2&0&0\\0&6&-6&2&0\\0&0&2&-3&2\end{bmatrix}}*{\begin{bmatrix}a_{4}\\a_{3}\\a_{2}\\a_{1}\\a_{0}\end{bmatrix}}={\begin{bmatrix}-{\frac {1}{64ln(10)}}\\{\frac {1}{24ln(10)}}\\-{\frac {1}{8ln(10)}}\\{\frac {1}{2ln(10)}}\\log(2)\end{bmatrix}}\!$
The unknown vector $a\!$ can be easily solved by forward substitution,the following values were calculated in matlab:
$a_{4}=-.0034,a_{3}=-.0113,a_{2}=-.0577,a_{1}=-.1624,a_{0}=.1624\!$
So the particular solution $y_{p4}\!$ is
$y_{p4}=0.1624-0.1624*(x-1)-.0577*(x-1)^{2}-.0113*(x-1)^{3}-.0034*(x-1)^{4}\!$
We can now find the general solution for n=4, $y_{4}(x)\!$.
$y_{4}(x)=y_{h}(x)+y_{p4}(x)\!$
$y_{4}(x)=c_{1}e^{x}+c_{2}e^{2x}+0.1624-0.1624*(x-1)\!$ $-.0577*(x-1)^{2}-.0113*(x-1)^{3}-.0034*(x-1)^{4}\!$
Solving using the initial conditions yields;

#### General Solution, n=7

Using the taylor series approximation from earlier with $n=7\!$ we have
$r_{7}(x)=log(2)+{\frac {(x-1)}{2ln(10)}}-{\frac {(x-1)^{2}}{8ln(10)}}+{\frac {(x-1)^{3}}{24ln(10)}}-{\frac {(x-1)^{4}}{64ln(10)}}+{\frac {(x-1)^{5}}{160ln(10)}}-{\frac {(x-1)^{6}}{384ln(10)}}+{\frac {(x-1)^{7}}{896ln(10)}}\!$
In a similar fashion we construct a matrix equation for n=7:
       ${\begin{bmatrix}2&0&0&0&0&0&0&0\\-21&2&0&0&0&0&0&0\\42&-18&2&0&0&0&0&0\\0&30&-15&2&0&0&0&0\\0&0&20&-12&2&0&0&0\\0&0&0&12&-9&2&0&0\\0&0&0&0&6&-6&2&0\\0&0&0&0&0&2&-3&2\end{bmatrix}}*{\begin{bmatrix}a_{7}\\a_{6}\\a_{5}\\a_{4}\\a_{3}\\a_{2}\\a_{1}\\a_{0}\end{bmatrix}}={\begin{bmatrix}{\frac {1}{896ln(10)}}\\-{\frac {1}{384ln(10)}}\\{\frac {1}{160ln(10)}}\\-{\frac {1}{64ln(10)}}\\{\frac {1}{24ln(10)}}\\-{\frac {1}{8ln(10)}}\\{\frac {1}{2ln(10)}}\\log(2)\end{bmatrix}}\!$
Solving:
$a_{7}=.0002,a_{6}=.0020,a_{5}=.0141,a_{4}=.0725,a_{3}=.3034,a_{2}=.9029,a_{1}=1.9072,a_{0}=2.1084\!$
So the particular solution $y_{p7}\!$ is
$y_{p7}=2.1084+1.9072*(x-1)+.9029*(x-1)^{2}+.3034*(x-1)^{3}+.0725*(x-1)^{4}+.0141*(x-1)^{5}+.0020*(x-1)^{6}+.0002*(x-1)^{7}\!$
We can now find the general solution for n=7, $y_{7}(x)\!$.
$y_{7}(x)=y_{h}(x)+y_{p7}(x)\!$
$y_{7}(x)=c_{1}e^{x}+c_{2}e^{2x}+2.1084+1.9072*(x-1)+.9029*(x-1)^{2}+\!$
$.3034*(x-1)^{3}+.0725*(x-1)^{4}+.0141*(x-1)^{5}+.0020*(x-1)^{6}+.0002*(x-1)^{7}\!$
Solving using our initial conditions yields

#### General Solution, n=11

Using the taylor series approximation from earlier with $n=11\!$ we have
$r_{11}(x)=log(2)+{\frac {(x-1)}{2ln(10)}}-{\frac {(x-1)^{2}}{8ln(10)}}+{\frac {(x-1)^{3}}{24ln(10)}}-{\frac {(x-1)^{4}}{64ln(10)}}+{\frac {(x-1)^{5}}{160ln(10)}}-{\frac {(x-1)^{6}}{384ln(10)}}+\!$
${\frac {(x-1)^{7}}{896ln(10)}}-{\frac {(x-1)^{8}}{2048ln(10)}}+{\frac {(x-1)^{9}}{4608ln(10)}}-{\frac {(x-1)^{10}}{10240ln(10)}}+{\frac {(x-1)^{11}}{22528ln(10)}}\!$
Finally, we write out the matrix equation for n=11:
$A*{\begin{bmatrix}a_{11}\\a_{10}\\a_{9}\\a_{8}\\a_{7}\\a_{6}\\a_{5}\\a_{4}\\a_{3}\\a_{2}\\a_{1}\\a_{0}\end{bmatrix}}={\begin{bmatrix}{\frac {1}{22528ln(10)}}\\-{\frac {1}{10240ln(10)}}\\{\frac {1}{4608ln(10)}}\\-{\frac {1}{2048ln(10)}}\\{\frac {1}{896ln(10)}}\\-{\frac {1}{384ln(10)}}\\{\frac {1}{160ln(10)}}\\-{\frac {1}{64ln(10)}}\\{\frac {1}{24ln(10)}}\\-{\frac {1}{8ln(10)}}\\{\frac {1}{2ln(10)}}\\log(2)\end{bmatrix}}\!$
Solving the system in matlab:
$a_{11}=0,a_{10}=.0002,a_{9}=.0019,a_{8}=.0181,a_{7}=.15,a_{6}=1.0675,a_{5}=6.4597,\!$
$a_{4}=32.4318,a_{3}=130.0033,a_{2}=390.3968,a_{1}=781.289,a_{0}=781.6873\!$
So the particular solution $y_{p11}\!$ is
$y_{p11}=781.6873+781.289*(x-1)+390.3968*(x-1)^{2}+130.0033*(x-1)^{3}+32.4318*(x-1)^{4}+\!$
$6.4597*(x-1)^{5}+1.0675*(x-1)^{6}+.15*(x-1)^{7}+.0181*(x-1)^{8}+.0019*(x-1)^{9}+.0002*(x-1)^{10}\!$
We can now find the general solution for n=11, $y_{1}1(x)\!$.
$y_{11}(x)=y_{h}(x)+y_{p11}(x)\!$
$y_{11}(x)=c_{1}e^{x}+c_{2}e^{2x}+781.6873+781.289*(x-1)\!$
$+390.3968*(x-1)^{2}+130.0033*(x-1)^{3}+32.4318*(x-1)^{4}\!$
$6.4597*(x-1)^{5}+1.0675*(x-1)^{6}+.15*(x-1)^{7}+.0181*(x-1)^{8}+.0019*(x-1)^{9}+.0002*(x-1)^{10}\!$
Solving using our initial conditions yields

#### Plot

$y_{4}\!$ shown in red
$y_{7}\!$ shown in blue
$y_{11}\!$ shown in green

### Part 4

Solved by Luca Imponenti
Use the matlab command ode45 to integrate numerically $y''-3y'+2y=r(x)\!$ with $r(x)=log(1+x)\!$
and the initial conditions from Part 3 to obtain the numerical solution for y(x).
Plot y(x) in the same figure as above.

#### Matlab Solution

The numerical solution calculated using the matlab ode45 command is shown below:

#### Plot

Plotting the aboved vector of y-values,along with the results from earlier yields the following graph:
where the answer calculated in matlab is shown in yellow.
Egm4313.s12.team11.imponenti (talk) 08:04, 14 March 2012 (UTC)