User:Egm6341.s10.Team4.andy/HW7

= Problem 1: Linearization about Equilibrium Point $$\displaystyle \hat{x} = x_{max}$$ =

Given
Refer Lecture slide 38-4 for problem statement

The logistic equation for population dynamics is given by 38-3,


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

$$\displaystyle \dot{x}(t) = f(x) = rx \left(1-\frac{x}{x_{max}}\right) $$ $$
 * $$\displaystyle \longrightarrow (1)
 * }.
 * }.

Find
Linearize Equation (1) about the equilibrium point $$\displaystyle \hat{x} = x_{max}$$.

Solution
With a small perturbation $$\displaystyle y $$, the value of $$\displaystyle x $$ is given by,


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

$$\displaystyle \begin{align} x &= \hat{x} + y \\ &= x_{max} + y \end{align} $$
 * }.
 * }.


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

$$\displaystyle \begin{align} \Rightarrow \frac{dx}{dt} &= \frac{d(x_{max} + y)}{dt} \\ &= \frac{dy}{dt} \end{align} $$
 * }.
 * }.


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

$$\displaystyle \begin{align} \Rightarrow \frac{dy}{dt} &= r(x_{max}+y) \left(1-\frac{(x_{max}+y)}{x_{max}}\right) \\ &= r(x_{max}+y) \left(-\frac{y}{x_{max}}\right) \\ &= -r(y+\frac{y^2}{x_{max}})

\end{align} $$
 * }.
 * }.

Since, $$\displaystyle y $$ is a small perturbation compared to $$\displaystyle x_{max} $$,


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

$$\displaystyle \begin{align} \Rightarrow \frac{dy}{dt} &= -r(y+\cancelto{0}{\frac{y^2}{x_{max}}})\\ &= -ry \end{align} $$
 * }.
 * }.

And so, the solution


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

$$\displaystyle \begin{align} \Rightarrow y = y_0 e^{-rt} \Rightarrow &y(t) \to 0 \ as\ t \to \infty \\ \Rightarrow &x(t) \to x_{max} \ as\ t \to \infty \end{align} $$
 * }.
 * }.

Author
Solved and typed by - Egm6341.s10.Team4.andy 06:16, 23 April 2010 (UTC)

= Problem 7: Logistic Equation: Inconsistent (Trapezoidal) Simpson's rule & Newton-Raphson =

Given
Refer Lecture slide 41-2 for problem statement

The logistic equation for population dynamics is given by 38-3,


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

$$\displaystyle \dot{x}(t) = f(x) = rx \left(1-\frac{x}{x_{max}}\right) $$ $$
 * $$\displaystyle \longrightarrow (1)
 * }.
 * }.

Here, $$\displaystyle x_{max}=10;\ r = 1.2,\ $$ and $$\displaystyle t \in [0,10] $$

The analytical solution is given by,


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

$$\displaystyle x(t) = \frac{x_0x_{max}e^{rt}}{x_{max} + x_0(e^{rt}-1)} $$ $$
 * $$\displaystyle \longrightarrow (2)
 * }.
 * }.

Find
To solve logistic equation defined by Equation (1) for two initial conditions, $$\displaystyle x_0=2\ and\ x_0 = 7,\ $$, using Inconsistent(Trapezoidal) Simpson's rule given by,


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

$$\displaystyle z_{i+1} = z_{i} + \frac{h/2}{3} \left[f_i + 4f_{(i+1/2)} +f_{i+1}\right] $$ $$
 * $$\displaystyle \longrightarrow (3)
 * }.
 * }.

The Inconsistent rule (Trapezoidal) is given by,


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

$$\displaystyle z_{i+1/2} = \frac{1}{2} [z_{i} + z_{i+1}] $$
 * }.
 * }.

Solution
Consider the Equation (1) in which $$\displaystyle f_{(i+1/2)}$$ is a function of $$\displaystyle z_{i}$$ and $$\displaystyle z_{i+1}$$, where $$\displaystyle z_i, z_{i+1} \rightarrow$$ values of $$\displaystyle x$$ at $$\displaystyle t = t_i$$ and $$\displaystyle t = t_{i+1}$$.

Since, this is an initial value problem, $$\displaystyle z_i$$ is known. So, Equation (3) as a whole becomes a function of $$\displaystyle z_{i+1}$$ given by,


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

$$\displaystyle F(z_{i+1}) = 0 $$ $$
 * $$\displaystyle \longrightarrow (4)
 * }.
 * }.

We find the root $$\displaystyle z_{i+1}$$ of Equation (4) using Newton-Raphson method 40-3,


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

$$\displaystyle z_{i+1}^{(k+1)} = z_{i+1}^{(k)} - \left[\frac{dF(z_{i+1}^{(k)})}{dz}\right]^{-1} F(z_{i+1}^{(k)}) $$ $$
 * $$\displaystyle \longrightarrow (5)
 * }.
 * }.

The Newton-Raphson iteration, starting with an initial guess as $$\displaystyle z_{i+1}^{0} = z_{i}$$, is stopped once the absolute tolerance


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

$$\displaystyle \begin{align} AbsTol &= ||z_{i+1}^{(k+1)} - z_{i+1}^{(k)}|| \\ &\le 10^{-6} \end{align} $$
 * }.
 * }.

is satisfied.

In the below Matlab code, for each of the h values $$\displaystyle x_{Actual} $$ is the vector calculated from Equation (3) in order to calculate the error max (for reference), $$\displaystyle e_{Max} = || x_{Actual} - x ||_{\infty} $$ where $$\displaystyle x $$ is calculated from Inconsistent Simpson's rule - Newton Raphson Method described above, for the given interval $$\displaystyle t \in [0,10] $$.

 Matlab Code: 

$$\displaystyle x_0 = 2 $$ :- A comparison on $$\displaystyle h $$ values:



The plot for $$\displaystyle h \approxeq 0.001 $$:



$$\displaystyle x_0 = 7 $$ :- A comparison on $$\displaystyle h $$ values:



The plot for $$\displaystyle h \approxeq 0.001 $$:



Author
Solved and typed by - Egm6341.s10.Team4.andy 05:49, 23 April 2010 (UTC)

= Problem 13: Chebychev - Change of Variable =

Given
Refer Lecture slide 42-2 for problem statement

The integral for a function $$\displaystyle f(x)$$ is,


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

$$\displaystyle I = \int_{-1}^{+1}f(x)dx $$ $$
 * $$\displaystyle \longrightarrow (1)
 * }.
 * }.

between the interval $$\displaystyle x \in [-1,1]$$

Find
With a change of variable $$\displaystyle x = cos\theta$$, show that the integral in Equation (1) is,


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

$$\displaystyle I = \int_{0}^{\pi} f(cos\theta)sin\theta d\theta $$
 * }.
 * }.

Solution
With a change of variable $$\displaystyle x = cos\theta \Rightarrow dx = -sin\theta d\theta ; cos(\pi) = x = -1 \Rightarrow \theta = \pi; cos(0) = x = 1 \Rightarrow \theta = 0$$ Equation (1) is,


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

$$\displaystyle \begin{align}

I &= \int_{-1}^{1} f(x)dx \\ &= \int_{\pi}^{0} f(cos\theta) \left(-sin\theta d\theta \right) \\ &= - \int_{\pi}^{0}f(cos\theta) sin\theta d\theta \\ &= \int_{0}^{\pi}f(cos\theta) sin\theta d\theta \\

\end{align} $$
 * }.
 * }.

Author
Solved and typed by - Egm6341.s10.Team4.andy 06:32, 23 April 2010 (UTC)