The Computable Differential Equation Lecture ... - Bruce E. Shapiro
The Computable Differential Equation Lecture ... - Bruce E. Shapiro
The Computable Differential Equation Lecture ... - Bruce E. Shapiro
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
CHAPTER 8. BOUNDARY VALUE PROBLEMS 155<br />
Thus using u(b) (0) = 1.25041, u(b) (1) = 2, with our values for c (0) and c (1) we<br />
calculate<br />
Next<br />
gives<br />
m (1) = 2 − 1.25041<br />
1 − 0<br />
EulerIVP[f, 1, -0.33406, 1, 2., 100]<br />
= 0.74959 (8.12)<br />
c (2) = 1 + 1 − 2 = −0.33406 (8.13)<br />
0.74959<br />
{{1, 1}, {1.01,0.9966594}, {1.02, 0.993452206},...,<br />
{2.,1.0000059174753426}}<br />
which shows convergence at the boundary value to better than one part in 10 5 . <strong>The</strong><br />
three estimates are illustrated in figure 8.1.<br />
Now we put it all together and automate the shooting process.<br />
Shoot[f , ua , ub , a , b , n , MaxIterations :5, tolerance :10 −6 ]<br />
:= Module[{c, ya, ubObserved, ubObservedOld, cold, m},<br />
c = (ub - ua)/(b - a); (* first guess *)<br />
ya = {ua, c};<br />
s = EulerIVP[f, ya, a, b, n]; (* first shot *)<br />
ubObserved = Last[Last[s]];<br />
cold = c;<br />
c = c + 1; (* second guess *)<br />
Do[<br />
ubObservedOld = ubObserved;<br />
ya = ua, c;<br />
s = EulerIVP[f, ya, a, b, n]; (* next shot *)<br />
ubObserved = Last[Last[s]];<br />
If[Abs[ubObserved - ubObservedOld] < tolerance, Break[]];<br />
m = (ubObserved - ubObservedOld)/(c - cold) (* slope *)<br />
cold = c;<br />
c = cold + (ub - ubObserved)/m; (* next guess at c *); ,<br />
{MaxIterations}<br />
];<br />
Return[s];<br />
];<br />
<strong>The</strong> problem with this implementation is that it can miss solutions, if the BVP<br />
has multiple solutions. To fix this we will have to replace the linear slope correction<br />
with a full Newton root finder. At this point it is not yet clear what we are finding<br />
the root of, so we will need to develop the theory somewhat first before we can<br />
return to the shooting algorithm.<br />
c○2007, B.E.<strong>Shapiro</strong><br />
Last revised: May 23, 2007<br />
Math 582B, Spring 2007<br />
California State University Northridge