Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Numerical Analysis, Exercises for lecture 13 [§10.1–4, 10.7] 1. Consider the Bernoulli differential equation initial value problem y 0 + xy = xy 3 , y(0) = 0.5 (a) Find the value of y(0.5) using Heun’s method (by hand) with step size h = 0.25. (b) Repeat using your Matlab/Octave implementation of the classical RungeKutta method. (c) Repeat using Matlab’s ode45 or Octave’s lsode. (d) Repeat using the exact solution formula y(x) = √ 1 . 1 + 3ex2 2. Solve the initial value problem u00 + 2u0 + 100u = 0, u(0) = 1.1, u0 (0) = −11 using Matlab’s ode45 or Octave’s lsode. Plot u over the interval [0, 6]. 3. Prove: the local truncation error of the following method is at least O(h3 ): k1 = f (xn , yn ), k2 = f (xn + 21 h, yn + 21 hk1 ), yn+1 = yn + hk2 Model quiz questions (A) Compute the solution of the initial value problem y 0 = x + y, y(0) = 10 at the point x = 1 using Euler’s method with step h = 0.5. Answer: y(1) ≈ (B) Write the differential equation u000 + 3xu = 4 as a set of first-order differential equations. 1 0.5 Exercise Answers 1. (a) 0.45388, (b) 0.45398 0 2. −0.5 −1 Quiz Solutions 0 2 4 6 (A) Euler’s method is yn+1 = yn + hf (xn , yn ). With y 0 = f (x, y) = x + y, h = 0.5, x0 = 0 and y0 = 10, Euler’s method gives y(0.5) ≈ y1 = y0 + h · (x0 + y0 ) = 10 + 0.5 · (0 + 10) = 15 x1 = x0 + h = 0 + 0.5 = 0.5 y(1) ≈ y2 = y1 + h · (x1 + y1 ) = 15 + 0.5 · (0.5 + 15) = 22.75 (B) Introducing the variables y1 = u, y2 = u0 and y3 = u00 , we have y10 = u0 = y2 , y20 = u00 = y3 , and y30 = u000 = 4−3xu = 4−3xy1 . That is, y10 = y2 , y20 = y3 , y30 = 4 − 3xy1