User:Egm6341.s11.team5/HW5

= Problem 5.1 - Runge Phenomenon = From [[media:Nm1.s11.mtg23.djvu|Mtg 23-1]], [[media:Nm1.s11.mtg26.djvu|Mtg 26-1]]

Given
1. $$ I=\int_{0}^{6}\frac{dx}{1+(x-3)^2}$$ 2. $$I=\int_{0}^{1}x^{1/3}dx$$ 3. $$I=\int_{0}^{2\pi}e^{sinx}dx$$

Find
1. Use the Composite Trapezoidal and the Composite Simpson's Rule to integrate the function. Find the error ratios. Plot $$f_{n}^{T}(x)$$ and $$f_{n}^{S}(x)$$ on the same axis as $$f(x)$$ to show the error as the area difference. 2. a)Integrate by Composite Trapezoidal and Composite Simpson's Rules using uniform discretization. b) Use non-uniform discretization. c) Use Gauss-Legendre quadrature. Find all the error ratios. 3. Integrate using uniform discretization and find the error ratios.

Solution
''' We solved this problem on our own. ''' 1. Given $$ I=\int_{0}^{6}\frac{dx}{1+(x-3)^2}$$, the results are shown on the following tables: The following is the plot of $$f(x)$$ and $$f_{n}^{T}(x)$$ on the same set of axis: The following GNU Octave code was used to obtain the results: Next, we have the plot of $$f(x)$$ and $$ f^{S}_{n}(x)$$: The code used to generate all of the results for Simpson's Rule: 2.The integration $$I=\int_{0}^{1}x^{1/3}dx$$ was done by uniform discretization (ie Simpson's and Trapezoidal rules) and is shown on the following table: The following codes were used: Finally, integrating using the Gauss-Legendre Quadrature: 3. Evaluating $$I_{0}^{2\pi}e^{sinx}dx$$, we get the following:

Author and proof-reader
[Author]cavalcanti

[Proof-reader]

= Problem 5.2 - Linear State Space Model with Random Noise = From [[media:Nm1.s11.mtg25.djvu|Mtg 25-2]]

Given

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

$$ $$ Where
 * $$ \mathbf{x_{k+1}}= \mathbf{F} \mathbf{x_{k}}+\mathbf{G} \mathbf{w_{k+1}}
 * $$ \mathbf{x_{k+1}}= \mathbf{F} \mathbf{x_{k}}+\mathbf{G} \mathbf{w_{k+1}}
 * $$\displaystyle (5-1)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\mathbf{F}&= \left[ \mathbf{I} +\Delta \mathbf{A} \right]\\ &= \left( {\begin{array}{*{20}{c}} 1&0\\ 0&1 \end{array}} \right) + .02\left( {\begin{array}{*{20}{c}} {-0.2}&1\\ { - 1}&{-0.2} \end{array}} \right)\end{align} $$ $$
 * $$\begin{align}
 * $$\begin{align}
 * $$\displaystyle (5-2)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

1\\ 1\end{array}} \right) $$ $$
 * $$G =\alpha \left( {\begin{array}{*{20}{c}}
 * $$G =\alpha \left( {\begin{array}{*{20}{c}}
 * $$\displaystyle (5-3)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

{x_{k}^1}\\ {x_{k}^2}\end{array}} \right), \mathbf{x_{0}} =  \left( {\begin{array}{*{20}{c}} {3}\\ {-2}\end{array}} \right) $$ $$
 * $$\mathbf{x_{k}} = \left( {\begin{array}{*{20}{c}}
 * $$\mathbf{x_{k}} = \left( {\begin{array}{*{20}{c}}
 * $$\displaystyle (5-4)
 * }
 * }

And$$ \mathbf{w_{k}}$$ is a series of random values according to some given distribution

Find
Find and Plot $$\mathbf{x_{k}}$$ for $$k=1,2,3...N$$ with $$\alpha=0.5,1,2$$. With no noise, Gaussian random noise, and Cauchy random noise. Highlighting the initial condition and equlibrium point.

Solution




Matlab code used to generate the data and plots.



The Cauchy random variable generating equation was found using the Mathematica command:

In: InverseCDF[CauchyDistribution[m,b],y]

Out: $$b \tan \left(\pi \left(y-\frac{1}{2}\right)\right)+m$$

where m is the mean, b is the half height, and y is the random variable.

The Equlibrium point was found by:

$$\lim_{k\to \infty } \, F^k.x = \left( \begin{array}{c} 0. \\ 0. \end{array} \right)$$

Author and proof-reader
[Author] J Davis 21:15, 21 March 2011 (UTC)

[Proof-reader]

= Problem 5.3 -Cauchy's heavy tails = From [[media:Nm1.s11.mtg26.djvu|Mtg 26-2]]

Given
Quartile points:$$Q_1,Q_2,Q_3$$ $$P(x<Q_1)=0.25=\int_{-\infty}^{Q_1} f(x)dx=F(Q_1)$$ $$P(x<Q_3)=0.75=\int_{-\infty}^{Q_3} f(x)dx=F(Q_3)$$ Cauchy's pdf $$=C(x_0,\gamma):=\frac{\gamma}{\pi[{\gamma}^{2}+{(x-x_0)}^2]}$$ Gauss(normal)pdf $$=N(\mu ,\sigma )= \frac{1}{\sigma \sqrt[]{2\pi}}exp(\frac{(-1){(x-\mu)}^{2}}{2{\sigma}^{2}})$$

Find
1.Find {$$Q_1,Q_3$$} for $$ C (x_0,\gamma)$$. 2.Find {$$Q_1,Q_3$$} for $$ N (\mu,\sigma)$$. 3.Let $$x_0=\mu=0$$  and  $${\gamma}^{c}=1$$. Find $${\sigma}^{1}$$st     of  $${\gamma}^{G}=1$$. where $${\gamma}^{c}$$ is the half width of  $$C (x_0,{\gamma}^{c})$$ and  $${\gamma}^{G}$$  is the half width of  $$N (\mu,\sigma)$$. Plot $$C (0,1)$$ and   $$N (0,{\sigma}^{1})$$. 4.Find {$${Q_1}^{c},{Q_3}^{c}$$} for $$ C (x_0,\gamma)$$ and $$C (0,1)$$. Find {$${Q_1}^{G},{Q_3}^{G}$$} for $$ N (\mu,\sigma)$$ and $$N (0,{\sigma}^{1})$$. Plot {$${Q_1}^{c},{Q_3}^{c}$$} for $$ C (0,1)$$  and  {$${Q_1}^{G},{Q_3}^{G}$$} for  $$N (0,{\sigma}^{1})$$   on the same plot and comment on the results.

Solution
1. To find Q1, we take the integral: $$\int_{-\infty}^{Q1}\frac{\gamma}{\pi \left( \gamma^{2} +(x-x_{0})^{2} \right)}dx = \frac{1}{\pi}\left[ tan^{-1} \left( \frac{x-x_{0}}{\gamma} \right) \right]_{-\infty}^{Q1} = \frac{1}{\pi}tan^{-1} \left( \frac{Q1-x_{0}}{\gamma} \right) + \frac{1}{2} $$ Since we are looking for the first quartile, we set the results equal to 0.25: $$ \frac{1}{\pi}tan^{-1} \left( \frac{Q1-x_{0}}{\gamma} \right) + \frac{1}{2} = \frac{1}{4}$$ $$ \frac{1}{\pi}tan^{-1} \left( \frac{Q1-x_{0}}{\gamma}  \right) = \frac{1}{4} - \frac{1}{2} $$ $$ \frac{1}{\pi}tan^{-1} \left( \frac{Q1-x_{0}}{\gamma} \right) = - \frac{1}{4} $$ $$ tan^{-1} \left( \frac{Q1-x_{0}}{\gamma}  \right) =-\frac{\pi}{4} $$ $$ \frac{Q1-x_{0}}{\gamma} = tan \left( - \frac{\pi}{4} \right) $$ $$ \frac{Q1-x_{0}}{\gamma} = -1$$ $$ Q1 - x_{0}= -\gamma$$


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

$$\displaystyle Q1 = -\gamma + x_{0} $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |


 * style= |

We use a similar approach to find Q3. $$ \frac{1}{\pi}tan^{-1} \left( \frac{Q3-x_{0}}{\gamma} \right) + \frac{1}{2} = \frac{3}{4}$$ $$ \frac{1}{\pi}tan^{-1} \left( \frac{Q3-x_{0}}{\gamma}  \right) = \frac{3}{4} - \frac{1}{2} $$ $$ \frac{1}{\pi}tan^{-1} \left( \frac{Q3-x_{0}}{\gamma} \right) = \frac{1}{4} $$ $$ tan^{-1} \left( \frac{Q3-x_{0}}{\gamma}  \right) =\frac{\pi}{4} $$ $$ \frac{Q3-x_{0}}{\gamma} = tan \left(  \frac{\pi}{4} \right) $$ $$ \frac{Q3-x_{0}}{\gamma} = 1$$ $$ Q3 - x_{0}= \gamma$$
 * }
 * }


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

$$\displaystyle Q3 = \gamma + x_{0}$$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style= |

2. We use a similar approach: $$ \int_{-\infty}^{Q1}\frac{1}{\sigma \sqrt{2\pi}}e^{\left( \frac{(-1)(x-\mu)^2}{2\sigma^{2}} \right)} dx = \frac{1}{2} \left[ 1+erf \left( \frac{Q1- \mu}{\sqrt{2 \sigma^{2}}} \right) \right]$$ $$\frac{1}{2} \left[ 1+erf \left( \frac{Q1- \mu}{\sqrt{2 \sigma^{2}}} \right) \right]=\frac{1}{4}$$ $$ 1+erf \left( \frac{Q1- \mu}{\sqrt{2 \sigma^{2}}} \right)=\frac{1}{2}$$ $$ erf \left( \frac{Q1- \mu}{\sqrt{2 \sigma^{2}}} \right)=-\frac{1}{2}$$ $$ \frac{Q1- \mu}{\sqrt{2 \sigma^{2}}} =erf^{-1} \left(-\frac{1}{2} \right)$$
 * }
 * }
 * {| style="width:20%" border="0"

$$\displaystyle Q1 =\mu +(\sqrt{2 \sigma^{2}})erf^{-1} \left(-\frac{1}{2} \right)$$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style= |

$$\frac{1}{2} \left[ 1+erf \left( \frac{Q3- \mu}{\sqrt{2 \sigma^{2}}} \right) \right]=\frac{3}{4}$$ $$ 1+erf \left( \frac{Q3- \mu}{\sqrt{2 \sigma^{2}}} \right)=\frac{1}{4}$$ $$ erf \left( \frac{Q3- \mu}{\sqrt{2 \sigma^{2}}} \right)=\frac{1}{4}$$ $$ \frac{Q3- \mu}{\sqrt{2 \sigma^{2}}} =erf^{-1} \left(\frac{1}{4} \right)$$
 * }
 * }
 * {| style="width:20%" border="0"

$$\displaystyle Q3 =\mu +(\sqrt{2 \sigma^{2}})erf^{-1} \left(\frac{1}{4} \right)$$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style= |

3.
 * }
 * }

Since $$x_0=\mu=0$$

Sigma with half width at 1. Plot MATLAB CODE: % Hw5_3 % plot C(0,1) and N(0,sigma) clear; close all; clc; x0=0; r=1;       % for Cauchy pdf u=0; s=0.849322; % for Gauss pdf x=[-10:0.01:10]; Fc=zeros(1,length(x)); Fg=zeros(1,length(x)); for i=1:length(x) Fg(i)= (1/(s*sqrt(2*pi)))*exp(-((x(i)-u)^2)/(2*s^2)); Fc(i)= r./(pi*(r.^2 + (x(i)-x0).^2)); end figure(1); hold on; plot(x,Fg,'b'); plot(x,Fc,'r'); legend('N(0,sigma),Gauss pdf','C(0,1),Cauchy pdf')

4.

Plot MATLAB CODE: % hw5_4 % plot C(0,1) and N(0,sigma) clear; close all; clc; x0=0; r=1;       % for Cauchy pdf u=0; s=0.849322; % Gauss pdf x=[-10:0.01:10]; Fc=zeros(1,length(x)); Fg=zeros(1,length(x)); for i=1:length(x) Gcdf(i)= normcdf(x(i),0,1); % Returns the cdf of distribution with mean and standard deviation Ccdf(i)= 0.5 + atan(x(i))./pi; % cdf for Cauchy distribution for x0=0, gamma=1, figure(1); hold on; plot(x,Gcdf,'b'); plot(x,Ccdf,'r'); legend('N(0,sigma),Gauss cdf','C(0,1),Cauchy cdf')

Author and proof-reader
[Author] cavalcanti , Raghunathan

[Proof-reader]

= Problem 5.4- Mass, spring, damper analysis = From [[media:Nm1.s11.mtg29.djvu|Mtg 29-1]]

Given
Diagram of the mass, spring, damper under consideration From [[media:Nm1.s11.mtg29.djvu|Mtg 29-1]]

Also the step size, h, equals 0.02

Find
1) Determine the equation of motion of the system in terms of d, c, k, m and, u 2)$$\mathbf{x} = \left\{ {\begin{array}{*{20}{c}} d\\ {\dot d} \end{array}} \right\} = \left\{ {\begin{array}{*{20}{c}} \\

\end{array}} \right\}$$, Find F and G 3)Find $$c_{cr}$$ in terms of k and m such that the system is critically damped 4)Let k=1, m=0.5, $$\mathbf{x_{0}}={\left\lfloor {\begin{array}{*{20}{c}} {0.8}&{ - 0.4} \end{array}} \right\rfloor ^T}$$ a)For u=0, plot $$\mathbf{x_{k}}$$ for $$c = \frac{1}{2}{c_{cr}},{c_{cr}},\frac{3}{2}{c_{cr}}$$ b)For u=0.5 gaussian noise and $$c=\frac{3}{2}{c_{cr}}$$, plot $$\mathbf{x_{k}}$$ c)For u=0.5 cauchy noise and $$c=\frac{3}{2}{c_{cr}}$$, plot $$\mathbf{x_{k}}$$

5.4.1: Equation of Motion
The force of the spring is given by


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

$$ $$
 * $$F_s=-kx
 * $$F_s=-kx
 * $$\displaystyle (4-1)
 * }
 * }

The force of the damper is given by


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

$$ $$
 * $$F_d=-c\dot x
 * $$F_d=-c\dot x
 * $$\displaystyle (4-2)
 * }
 * }

The force of inertia is given by


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

$$ $$ The external force on the system is $$F_e=u$$ The total force on the system, the force balance, is given by
 * $$F_I=m\ddot x
 * $$F_I=m\ddot x
 * $$\displaystyle (4-3)
 * }
 * }


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

$$ $$ Substituting,
 * $$F_I=F_c+F_s+F_e
 * $$F_I=F_c+F_s+F_e
 * $$\displaystyle (4-4)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$ $$
 * $$m\ddot x=-c\dot x-kx+u
 * $$m\ddot x=-c\dot x-kx+u
 * $$\displaystyle (4-5)
 * }
 * }

Rearranging we see that the equation of motion is given by
 * {| style="width:100%" border="0" align="left"

$$ $$
 * $$\ddot x=-\frac{c}{m}\dot x-\frac{k}{m}x+\frac{1}{m}u
 * $$\ddot x=-\frac{c}{m}\dot x-\frac{k}{m}x+\frac{1}{m}u
 * $$\displaystyle (4-6)
 * }
 * }

5.4.2: Find F and G
We can now designate states such that


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

{x^1} = d\\ {x^2} = \dot d \end{array} $$ $$ Then
 * $$\begin{array}{l}
 * $$\begin{array}{l}
 * $$\displaystyle (4-7)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\dot x^1\\ {\dot x^2} \end{array}} \right ) = \left ( {\begin{array}{*{20}{c}} \\
 * $$\dot \mathbf{x}=\left ( {\begin{array}{*{20}{c}}
 * $$\dot \mathbf{x}=\left ( {\begin{array}{*{20}{c}}

\end{array}} \right ) $$ $$ Putting this into matrix form
 * $$\displaystyle (4-8)
 * }
 * }


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

0&1\\ { - \frac{k}{m}}&{ - \frac{c}{m}} \end{array}} \right) \left( {\begin{array}{*{20}{c}} \\
 * $$\dot x = \left( {\begin{array}{*{20}{c}}
 * $$\dot x = \left( {\begin{array}{*{20}{c}}

\end{array}} \right) + \left( {\begin{array}{*{20}{c}} 0\\ {\frac{1}{m}} \end{array}} \right)u $$ $$
 * $$\displaystyle (4-9)
 * }
 * }


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

$$ $$ Where
 * $$\dot \mathbf{x}= \mathbf{A} \mathbf{x} + \mathbf{B}u
 * $$\dot \mathbf{x}= \mathbf{A} \mathbf{x} + \mathbf{B}u
 * $$\displaystyle (4-10)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

0&1\\ { - \frac{k}{m}}&{ - \frac{c}{m}} \end{array}} \right) $$
 * $$\mathbf{A}=\left( {\begin{array}{*{20}{c}}
 * $$\mathbf{A}=\left( {\begin{array}{*{20}{c}}
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

0\\ {\frac{1}{m}} \end{array}} \right) $$
 * $$\mathbf{B}=\left( {\begin{array}{*{20}{c}}
 * $$\mathbf{B}=\left( {\begin{array}{*{20}{c}}
 * }
 * }

According to equations (1)-(4) of slide 29-7 equation 4-10 can be written as
 * {| style="width:100%" border="0" align="left"

$$ $$
 * $$ \mathbf{x_{k+1}}= \underbrace{\left[ \mathbf{I} + h \mathbf{A} \right]}_{\color{blue}\mathbf{F}} \mathbf{x_{k}} + \underbrace{h \mathbf{B}}_{\color{blue}\mathbf{G}}u
 * $$ \mathbf{x_{k+1}}= \underbrace{\left[ \mathbf{I} + h \mathbf{A} \right]}_{\color{blue}\mathbf{F}} \mathbf{x_{k}} + \underbrace{h \mathbf{B}}_{\color{blue}\mathbf{G}}u
 * $$\displaystyle (4-11)
 * }
 * }

So therefore


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

$$ $$
 * $$F = \left[ \mathbf{I} + h \mathbf{A} \right]
 * $$F = \left[ \mathbf{I} + h \mathbf{A} \right]
 * $$\displaystyle (4-12)
 * }
 * }

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

$$ $$ where I is the identity matrix, and A, B, and h are defined above
 * $$G = h \mathbf{B}
 * $$G = h \mathbf{B}
 * <p style="text-align:right;">$$\displaystyle (4-13)
 * }
 * }

5.4.3: Finding $$c_{cr}$$
Critical damping occurs when the damping ratio is equal to 1. For systems like this one the damping ratio, according to Wikipedia, is given as


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

$$ $$
 * $$\varsigma = \frac{c}
 * $$\varsigma = \frac{c}
 * <p style="text-align:right;">$$\displaystyle (4-14)
 * }
 * }

Therefore to determine c such that critical damping occurs we simply solve c in terms of m and k, setting the damping ratio equal to one. If we do this we will end up with


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

1 = \frac\\ {c_{cr}} = 2\sqrt {mk} \end{array} $$ $$
 * $$\begin{array}{l}
 * $$\begin{array}{l}
 * <p style="text-align:right;">$$\displaystyle (4-15)
 * }
 * }

5.4.4: Plotting
Using the given values for the constants we are able to use the definitions of A and B along with equations (4-12) and (4-13) to find the values of the F and G matrices. Substituting we get,


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

F &= \left[ \mathbf{I} + h \mathbf{A} \right]\\ &= \left( {\begin{array}{*{20}{c}} 1&0\\ 0&1 \end{array}} \right) + .02\left( {\begin{array}{*{20}{c}} 0&1\\ { - 2}&{2c} \end{array}} \right)\\ &= \left( {\begin{array}{*{20}{c}} 1&.02\\ {-0.04}&{1.04c}\end{array}}\right)\end{align}$$ $$
 * $$\begin{align}
 * $$\begin{align}
 * <p style="text-align:right;">$$\displaystyle (4-16)
 * }
 * }


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

0\\ {\frac{1}{m}} \end{array}} \right) = \left( {\begin{array}{*{20}{c}} 0\\ {0.04} \end{array}} \right) $$ $$
 * $$G = .02\left( {\begin{array}{*{20}{c}}
 * $$G = .02\left( {\begin{array}{*{20}{c}}
 * <p style="text-align:right;">$$\displaystyle (4-17)
 * }
 * }

5.4.4a:$$c=0.5c_{cr}$$
Taking into account $$c = \frac{1}{2}{c_{cr}},{c_{cr}},\frac{3}{2}{c_{cr}}$$ and no input force the equation becomes, respectively,


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

1&.02\\ {-0.04}&{0.7354}\end{array}}\right) \mathbf{x_{k}} $$ $$
 * $$\mathbf{x_{k+1}}=\left( {\begin{array}{*{20}{c}}
 * $$\mathbf{x_{k+1}}=\left( {\begin{array}{*{20}{c}}
 * <p style="text-align:right;">$$\displaystyle (4-18)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

1&.02\\ {-0.04}&{1.4708}\end{array}}\right) \mathbf{x_{k}} $$ $$
 * $$\mathbf{x_{k+1}}=\left( {\begin{array}{*{20}{c}}
 * $$\mathbf{x_{k+1}}=\left( {\begin{array}{*{20}{c}}
 * <p style="text-align:right;">$$\displaystyle (4-19)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

1&.02\\ {-0.04}&{2.206}\end{array}}\right) \mathbf{x_{k}} $$ $$
 * $$\mathbf{x_{k+1}}=\left( {\begin{array}{*{20}{c}}
 * $$\mathbf{x_{k+1}}=\left( {\begin{array}{*{20}{c}}
 * <p style="text-align:right;">$$\displaystyle (4-20)
 * }
 * }

The results here are as we would expect. For the under-damped case, $$c=0.5c_{cr}$$ there is overshoot in both the position and the velocity graphs. Overshoot meaning that the value went past the final value and oscillated around the steady state value for a period of time. The critically damped case, $$c=c_{cr}$$ quickly rose to the steady state value and did not overshoot. And the over-damped system, $$c=1.5c_{cr}$$, did not overshoot but rose less quickly than the critically damped case.

5.4.4b: Gaussian noise
Using Gaussian noise as the forcing function for this system and using the over damped value for c the plot of x becomes



Notice that because of the Gaussian noise the system does not come to a steady state value as in the previous example. The system continuously fluctuates, though as time progresses the system fluctuates closely around the steady state values show in figure 1. The Gaussian noise causes instability in the system.

5.4.4c: Cauchy noise
Using Cauchy noise as the forcing function for this system and again using the over damped value for c, the plot of x becomes



Comparing the system's reaction to Cauchy noise and Gaussian noise we can see that the oscillations due to Cauchy noise are much more pronounced than the Gaussian oscillations. This is due to the heavy tails of the Cauchy distribution. The heavy tails cause the system to react to much greater changes in input, which causes the large magnitude spikes seen in figure 3.

Author and proof-reader
[Author] Reiss

[Proof-reader]

= Problem 5.5 - Modify MATLAB code = From [[media:Nm1.s11.mtg30.djvu|Mtg 30-1]]

Given
HW*2.4: The following function was given: $$ f(x)=\frac{e^{x}-1}{x}$$. The integral was calculated as:$$ I=\int_{a}^{b}f(x)dx$$, where $$[a,b]=[-1,1]$$

Find
1. Modify the MATLAB code from the previous homework assignment to make it more efficient. 2. Do a Romberg table; compare to previous results.

Solution
''' We solved this problem on our own. ''' 1. The problem was previously solved by hand as seen in | 2.4. The actual value for this integral was found to be 2.1145018 | WA. The following results were obtained using the Octave code:

2. The Romberg table is as follows: The following Octave code was used:

Author and proof-reader
[Author] cavalcanti

[Proof-reader]

= Problem 5.6 - Comparison of corrected trapezoidal rules with other integration method = From [[media:Nm1.s11.mtg30.djvu|Mtg 30-1]]

Given

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

\begin{align} f(x)&=\frac{e^x-1}{x} \text{, } x \in [-1,1] \\ I&=\int_{-1}^{1} \! f(x) \, \mathrm{d}x \end{align} $$ $$.
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (5-1)
 * }
 * }

Find
Find and compare $$\displaystyle I_n $$ using the corrected trapezoidal rules ($$\displaystyle CT_k(n)$$), k=1,2,3, for n = 2,4,8,16, until the error is of order of $$\displaystyle 10^{-6} $$.

Solution
The high order corrected trapezoidal rules are defined by the following equation.
 * {| style="width:100%" border="0" align="left"

I_n=CT_k(n)=CT_{k-1}(n)+a_k h^{2k} $$ $$ where,
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (5-2)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\begin{align} a_i &= d_i \left[ f^{(2i-1)}(b)-f^{(2i-1)}(a) \right] \\ d_i &= -\frac{B_{2i}}{(2i)!} \text{ :  } d_1 = -\frac{1}{12} \text{,    } d_2 = \frac{1}{720} \text{,    } d_3 = -\frac{1}{30240} \end{align} $$ $$ ,where $$\displaystyle B_{2i} $$ is Bernoulli numbers. The corrected trapezoidal rules with k=1,2,3 are expressed as follows.
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (5-3)
 * }
 * }


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

\begin{align} CT_1(n) &= CT_0(n) + a_1 h^2 \\ &= T_o(n) + a_1 h^2 \\ CT_2(n) &= CT_1(n) + a_2 h^4 \\ CT_3(n) &= CT_2(n) + a_3 h^6 \\ \end{align} $$ $$ ,where $$\displaystyle T_0(n) $$ is the integration with the composite trapezoidal rule.  Table:  Observation:
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (5-4)
 * }
 * }
 * At $$\displaystyle n=2$$, the method achieved the error reduced to an order of $$\displaystyle \Theta(10^{-6}$$).

Matlab code:
 * {| style="width:100%" border="0" align="left"

.
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }

Author and proof-reader
[Author] Shin [Proof-reader]

= Problem 5.7 - Pros and Cons of Integration Methods = From [[media:Nm1.s11.mtg30.djvu|Mtg 30-1]]

Given
The following integration methods: 1. Taylor Series 2. Composite Simpson's Rule 3. Composite Trapezoidal Rule 4. Romberg (Richardson) 5. $$cT_{k}(n)$$

Find
Discuss the pros and cons of the five given integration methods.

Author and proof-reader
[Author] cavalcanti

[Proof-reader]

= Problem 5.8 - Proof of Higher Order Trapezoidal Rule Error(HOTRE)= From [[media:Nm1.s11.mtg30.djvu|Mtg 30-2,3,7]]

Given
,where $$\begin{align} x_k := a+kh, \; \ h :=(b-a)/n, \; \ x(t)= \frac{x_k+x_{k+1}}{2} + t \cdot \frac{h}{2}, \; \ t \in [-1,+1] \end{align}$$ $$ x(-1) = x_k, \qquad x(0)= \frac{(x_k + x_{k+1})}{2}, \qquad x(+1) = x_{k+1} $$ ,where $$\begin{align} g_k(t):=f(x(t)) \; \ x \in [x_k,x_{k+1}] \end{align}$$

Find
 Proove that (8-1) and (8-2) are same 

Solution
 Therefore, (8-1) will be changed as same as (8-2) 


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

$$\displaystyle E_n^T=\dfrac{h}{2} \sum_{k=0}^{n-1} \left[ \int_{-1}^{+1}g_k(t)dt- \left\{g_k(-1)+g_k(+1) \right\} \right] $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |


 * style= |


 * }
 * }

Find
 Proove (8-3) 

Solution
 Using Integration by parts, 

$$\displaystyle\begin{align} \int_{a}^{b} u {v}^{'}= [uv]_{a}^{b} - \int_{a}^{b} {u}^{'} v \end{align}$$

 In this problem, u = -t, v = g(t), a = -1, b = +1  $$\displaystyle\begin{align} (8-3) \rightarrow [(-t) \cdot g(t)]_{-1}^{+1} - \int_{-1}^{+1} (-1) \cdot g(t) dt \end{align}$$

$$\displaystyle\begin{align} \rightarrow [-g(+1)-g(-1)] - \int_{-1}^{+1} (-1) \cdot g(t) dt \ = \ \int_{-1}^{+1} g(t) dt - [g(+1) + g(-1)] \end{align}$$

 Therefore, clearly we can proove (8-3) 

Given
where $$\displaystyle \begin{align} \; g_k^{(i)}(t)=\frac{d^i}{dt^i} g_k^{(t)}, \;x \in [x_k, x_{k+1}] \end{align}$$

Find
 Proove (8-4) 

Solution
 Therefore, clearly we can proove (8-4) 

Given

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

p_{5}(t) = -\frac{t^5}{120} + \frac{t^3}{36} + \underbrace{\alpha}_{c_{5}} t + \underbrace{\beta}_{c_{6}} $$ $$
 * $$ \displaystyle
 * $$ \displaystyle
 * <p style="text-align:right;">$$\displaystyle (8-5)
 * }


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


 * with,
 * }
 * {| style="width:100%" border="0" align="left"

p_{5}(0) =0, \qquad p_{5}(\pm 1) = 0 $$ $$.
 * $$ \displaystyle
 * <p style="text-align:right;">$$\displaystyle (8-6)
 * }

Find
$$\displaystyle c_5 \, \ c_6 $$

Solution

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

$$ \displaystyle p_{5}(0) = -\frac{0}{120} + \frac{0}{36} + c_{5} (0) + c_{6} = 0 $$
 *  Plug (8-6) into (8-5) 
 * }
 * }


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

\therefore c_{6} = 0 $$ <br\>
 * $$ \displaystyle
 * }


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

p_{5}(1) = -\frac{1}{120} + \frac{1}{36} + c_{5} \cdot (1) = 0 $$
 * $$ \displaystyle
 * }


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

\therefore c_{5} = \frac{3}{360} - \frac{10}{360} = -\frac{7}{360} $$ <br\>
 * $$ \displaystyle
 * }


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

p_{5}(-1) = -\frac{-1}{120} + \frac{-1}{36} + c_{5} \cdot (-1) = 0 $$
 * $$ \displaystyle
 * }


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

\therefore c_{5} = -\frac{-3}{360} + \frac{-10}{360} = -\frac{7}{360} $$ <br\>
 * $$ \displaystyle
 * }


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

$$ \displaystyle c_6 = 0 \, \ c_5 = -\frac{7}{360} $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * }


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

.
 * }

Author and proof-reader
[Author] Oh

[Proof-reader]

= References =

= Contributing members =