User:EGM6341.s11.TEAM1.Sujin.HW7

Problem 3: Solving the Logistic Equation Using Inconsistent Trap-Simpson's rule & Newton-Raphson
 Solved without assistance 

Given
Refer Lecture slide 41-1 for problem statement

The logistic equation for population dynamics is given by


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

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

(7.1)
 * 
 * }

Here, $$\displaystyle x_{max}=15;\ r = 1.4,\ $$ and $$\displaystyle t \in [0,20] $$

The analytical solution is given by the S10 lecture note38-3 as following;


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

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

(7.2)
 * 
 * }

Logistic equation defined by eqn 7.1 for two initial conditions, $$\displaystyle x_0=3\ and\ x_0 = 9,\ $$, can be solved by using Inconsistent(trapez.) Simpson's rule given by the s10 lecture note 38-3,


 * {| 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

(7.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}] $$

(7.4)
 * 
 * }

Solution
By considering the eqn 7.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}$$. This is an initial value problem, $$\displaystyle z_i$$ is known. So, eqn 7.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

(7.5) $$\displaystyle z_{i+1}$$ of eqn 7.5 can be found by using Newton-Raphson method
 * 
 * }
 * {| 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

(7.6) The Newton-Raphson iteration, starting with an initial guess as $$\displaystyle z_{i+1}^{0} = z_{i}$$, is stopped once the absolute tolerance reaches appropriate criterion.
 * 
 * }


 * {| 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} $$
 * }
 * }

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



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