



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Numerical Computing F’05 A. Kapila Assignment 5 Solutions
(a) i. Describe in words the distinction between a stable and an unstable solution of an ODE. State a mathematical criterion for determining the stability of a solution. Can the stability or instability of a solution change with time? ii. Classify each of the following ODEs as having unstable, stable or asymptotically stable solu- tions. A. y′^ = 2y + t. B. y′^ = 2y − t. C. y′^ = t − 2 y. D. y′^ = t/ 2. (b) For the initial-value problem y′^ = − 200 ty^2 , y(0) = 1, compute the solution at t = 0.1 by using (i) the Euler method, and (ii) the Taylor method of order 2. Show all steps and produce the final answers as numbers, not formulas.
(a) i. Let a solution y(t) to y′^ = f (t, y), t > t 0 , have a neighboring solution z(t). Then, y(t) is said to be stable if, given any > 0 , there exists a δ > 0 such that |y(t) − z(t)| < for t > t 0 if |y(t 0 ) − z(t 0 )| < δ. In other words, if the two solutions are initially close, they stay close for all t. The mathematical criterion for stability is ∂f /∂y ≤ 0. Since ∂f /∂y can change its value as the solution y(t) evolves, stability can change as well. ii. A. y′^ = 2y + t. Here, ∂f /∂y = 2 > 0. Hence unstable. B. y′^ = 2y − t. Here, ∂f /∂y = 2 > 0. Hence unstable. C. y′^ = t − 2 y. Here, ∂f /∂y = − 2 < 0. Hence asymptotically stable. D. y′^ = t/ 2. Here, ∂f /∂y = 0. Hence stable. (b) The Euler algorithm applied to the equation at hand gives
yn+1 = yn + hf (tn, yn) = yn + h[− 200 tny^2 n]
For n = 0, h = 0. 1 , one obtains
y 1 = y 0 + hf (t 0 , y 0 ) = 1 + 0.1[− 200 × 0 × 12 ] = 1.
The Taylor method of order 2 gives
yn+1 = yn + hf (tn, yn) +
h^2 2
[ft(tn, yn) + f (tn, yn)fy (tn, yn)]
= yn + h[− 200 tny n^2 ] + h^2 2
[− 200 y n^2 + {− 200 tny^2 n}{− 400 tnyn}]
Then,
y 1 = 1 + 0.1[− 200 × 0 × 12 ] +
(a) Write out the nonlinear algebraic equation for y 1. (b) Write out the Newton iteration for solving the nonlinear algebraic equation. (c) Obtain a starting guess for the Newton iteration by using one step of the Euler method. (d) Finally, compute an approximate value for y 1 by using one iteration of Newton’s method for the nonlinear algebraic equation.
(a) The backward-Euler algorithm is
yn+1 = yn + hf (tn+1, yn+1).
Here, f (t, y) = −y^2. Therefore we get
y 1 = y 0 − 0. 1 × y^21 = 1 − 0. 1 × y^21.
Let us denote y 1 by z. Then the above nonlinear algebraic equation becomes
F (z) ≡ z − 1 + 0. 1 z^2 = 0. (1)
(b) The Newton iteration for solving this nonlinear system is
zn+1 = zn −
F (zn) F ′(zn)
= zn −
zn − 1 + 0. 1 z^2 n 1 + 0. 2 zn
1 + 0. 1 z n^2 1 + 0. 2 zn
(c) One step of the Euler method gives
y 1 = y 0 + hf (t 0 , y 0 ).
Here, y 1 = 1 + 0.1(−1) = 0. 99. We take this value as z 0 , the starting guess for the Newton iteration (2). (d) The next iterate in Newton’s method is, from (2),
z 1 =
1 + 0. 1 z^20 1 + 0. 2 z 0 =
dy dt
= λy + (1 − λ) cos t − (1 + λ) sin t, y(0) = 1.
Its exact solution is independent of λ, and is sin t + cos t. Consider the numerical solution of this problem. Write a Matlab script that solves the above problem by using both the Euler method and the Taylor method of order 2, on the interval t ∈ [0, 5].. The script eulertaylor.m, and the associated function file odetaylor.m may be useful for this purpose. Keep in mind that these scripts will need to be modified in order to answer the following questions.
(a) For λ = 1, solve the problem numerically for h = 1/ 10 , 1 / 20 , 1 / 40 , 1 / 80 , 1 / 160 , and 1/ 320. Plot the exact solution and the Euler and Taylor numerical approximations on t ∈ [0, 5]. Plot the global error (i.e., the difference between the exact and numerical solutions) against h for each of the two numerical approximations; it may be best to use the log-log scale. i. What do you observe from the graphs at various h?