# Nonlinear shooting example calculation

How can we use the nonlinear shooting method with $h = 0.25$ to approx the solution to $y'' = 2y^3$, $-1 \leq x\leq 0$, $y(-1) = 1/2$, and $y(0) = 1/3$.

I tried to convert this to a first order system but the RK $4$ didnt look good. Also, I needed help by doing it via hand. Can someone please show or at least provide a setup?

We are given $(1)$:

$y'' = 2y^3$, $-1 \leq x\leq 0$, $y(-1) = 1/2$, and $y(0) = 1/3$, $h = 0.25.$

We are asked to use the nonlinear shooting method (I am not 100% sure of which algorithm you are using because you mention both Runge-Kutta 4-th and a linearized system, but do not mention if you are using the secant or Newton's with that - anyway, you can work those details).

From $(1)$, we have an exact solution (for comparison purposes) of:

$$y(x) = \frac{1}{x+3}.$$

Of course, we know $y(-1)$ and it should match what we get at the start and $y(0)$, which should match what we get at the end of the algorithm.

With the nonlinear shooting method, we need to approximate two IVPs from $y'' = f(x, y, y') = 2 y^3$, that are given by:

• $\displaystyle y'' = 2y^3$, $-1 \leq x\leq 0$, $y(-1) = 1/2$, and $y(0) = 1/3$, and

• $\displaystyle z'' = \frac{\partial f}{\partial y} z + \frac{\partial f}{\partial y'} z' = (6 y^2)z + (0)z' = 6y^2z$, $-1 \leq x \leq 0$, $z(-1) =0$, and $z'(-1) = 1.$

We are given:

$\displaystyle h = \frac{b-a}{N} = \frac{0 - (-1)}{N} = \frac{1}{N} = 0.25 = \frac{1}{4} \rightarrow N = 4.$

That is what you need for the Nonlinear Shooting Method.

If you further want to linearize this system as a first order system, you could write:

$y_1' = y_2$ with $y_1(-1) = \frac{1}{2}$, and

$y_2' = 2y_1^3$, with $y_2(-1) = t_k$,

where $y_1 = y$ and $y_2 = y'.$

If you are interested, you can actually see this example in Section 6.8.2 of Introduction To Numerical Analysis Using MATLAB by Rizwan Butt for the RK plus secant method Note that he has different limits, but this can help validate your approach to manual calculations if you don't want to code it up.

• Nice - I am lost when it comes to numerical methods...!! But I've got you to learn from; thanks! ;-) +1 – Namaste Apr 14 '13 at 0:41
• @BabakS. Always appreciate the support! :-) – Amzoti Apr 14 '13 at 5:16