Moler Ch7 solutions

Moler Ch7 solutions - Solution Manual for: Numerical...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Solution Manual for: Numerical Computing with MATLAB by Cleve B. Moler John L. Weatherwax * July 25, 2007 Chapter 7 (Ordinary Differential Equations) Problem 7.1 Defining the vector y as y = v u v u (1) Then we have for its time derivative the following dy dt = v u v u = y 3 y 4- y 2 1+ t 2 + cos( r )- y 1 1+ t 2- sin( r ) (2) Where r given in terms of components of y is r = q y 2 4 + y 2 3 (3) Given the initial conditions in terms of u , v , u , and v we have y = 1 (4) * wax@alum.mit.edu 1 Problem 7.2 See the matlab code in the file prob 7 2.m . Problem 7.3 The algorithm BS23 can be represented by the following sequence of steps s 1 = f ( t n , y n ) (5) s 2 = f ( t n + h 2 , y n + h 2 s 1 ) (6) s 3 = f ( t n + 3 4 h, y n + 3 4 s 2 ) (7) y n +1 = y n + h 9 (2 s 1 + 3 s 2 + 4 s 3 ) (8) Part (a): The specific ODEs (and their exact solutions) to consider are given by dy dt = 1 y = t + C (9) dy dt = t y = t 2 2 + C (10) dy dt = t 2 y = t 3 3 + C (11) dy dt = t 3 y = t 4 4 + C (12) For the first system, dy/dt = 1, so f ( t, y ) = 1 then the BS23 procedure gives the following s 1 = 1 (13) s 2 = 1 (14) s 3 = 1 (15) y n +1 = y n + h 9 (2 + 3 + 4) = y n + h (16) Does this equal the true solution at t n + h ? We evaluate the above to obtain y ( t n + h ) = ( t n + h ) + C = t n + C + h = y n + h (17) and the answer is yes. For the second function f ( t, y ) = t we see that the BS23 procedure is s 1 = t n (18) s 2 = t n + h 2 (19) s 3 = t n + 3 4 h (20) y n +1 = y n + h 2 (2 t n + 3( t n + h 2 ) + 4( t n + 3 4 h )) (21) Simplifying this last equation we have = y n + h 9 (9 t n + ( 3 2 + 3) h ) (22) = y n + ht n + h 9 ( 9 2 ) h (23) = y n + ht n + h 2 2 (24) Again we ask, does this equal the true solution at t n +1 ? Lets check by evaluating y ( t n +1 ) = y ( t n + h ) = 1 2 ( t n + h ) 2 + C = t 2 n 2 + C + ht n + h 2 2 = y ( t n ) + ht n + h 2 2 (25) and we see that the answer is yes. For the second function f ( t, y ) = t 2 , then the BS23 gives s 1 = t 2 n (26) s 2 = ( t n + h 2 ) 2 (27) s 3 = ( t n + 3 4 h ) 2 (28) y n +1 = y n + h 9 (2 t 2 n + 3( t n + h 2 ) 2 + 4( t n + 3 4 h ) 2 ) (29) Now simplifying the last equation we have y n +1 = y n + h 9 (2 t 2 n + (3 + 6) ht n + ( 3 4 + 9 4 ) h 2 ) (30) = y n + h 9 (9 t 2 n + 9 2 ht n + 12 4 h 2 ) (31) = y n + ht 2 n + h 2 t n + h 3 1 3 (32) Does this equal the exact solution at t n + h ? To decide we compute y ( t n + h ) = ( t n...
View Full Document

Page1 / 9

Moler Ch7 solutions - Solution Manual for: Numerical...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online