“JUST THE MATHS” SLIDES NUMBER 17.8 NUMERICAL MATHEMATICS 8 (Numerical solution) of (ordinary differential equations (C)) by A.J.Hobson 17.8.1 Runge’s method
UNIT 17.8 NUMERICAL MATHEMATICS 8 NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS (C) 17.8.1 Runge’s Method We solve the differential equation, d y d x = f ( x, y ), subject to the condition that y = y 0 when x = x 0 . Consider the graph of the solution passing through the two points, A( x 0 , y 0 ) and B( x 0 + h, y 0 + k ). B y ✻ C k A B 0 h h ✲ x 2 2 O M N We can say that d y � x 0 + h � x 0 + h d x d x = f ( x, y )d x. x 0 x 0 That is, � x 0 + h y B − y A = f ( x, y )d x. x 0 1
Reminder: f ( x, y ) is the gradient at points on the solution curve. B y ✻ C k A B 0 h h ✲ x 2 2 O M N Suppose we knew the values of f ( x, y ) at A,B and C, where C is the intersection with the curve of the perpen- dicular bisector of MN. Then, by Simpson’s Rule for approximate integration, f ( x, y )d x = h/ 2 � x 0 + h 3 [ f (A) + f(B) + 4f(C)] . x 0 (i) The value of f (A) This is already given, namely, f ( x 0 , y 0 ). 2
(ii) The Value of f (B) B ✟ B 2 ✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟ ✟ ✟✟✟✟✟ ✏ ✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏ B 1 A B 0 If the tangent at A meets B 0 B in B 1 , then the gradient at A is given by B 1 B 0 = f ( x 0 , y 0 ) . AB 0 Therefore, B 1 B 0 = AB 0 f ( x 0 , y 0 ) = hf ( x 0 , y 0 ) . Calling this value k 1 as an initial approximation to k , k 1 = hf ( x 0 , y 0 ) . 3
B ✟ B 2 ✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟✟ ✟ ✟✟✟✟✟ ✏ ✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏ B 1 A B 0 As a rough approximation to the gradient of the solution curve passing through B, we now take the gradient of the solution curve passing through B 1 . Its value is f ( x 0 + h, y 0 + k 1 ) . For a better approximation, assume that a straight line of gradient f ( x 0 + h, y 0 + k 1 ), drawn at A, meets B 0 B in B 2 a point nearer to B than B 1 . Letting B 0 B 2 = k 2 , k 2 = hf ( x 0 + h, y 0 + k 1 ) . The co-ordinates of B 2 are ( x 0 + h, y 0 + k 2 ). The gradient of the solution curve through B 2 is taken as a closer approximation than before to the gradient of the solution curve through B. 4
The gradient of the solution curve through B 2 is f ( x 0 + h, y 0 + k 2 ) . (iii) The Value of f (C) B ✏ B 1 ✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏✏ C k 1 C 1 A B 0 Let C 1 be the intersection of the ordinate through C and the tangent at A. Then C 1 is the point x 0 + h 2 , y 0 + k 1 . 2 The gradient at C 1 of the solution curve through C 1 is x 0 + h 2 , y 0 + k 1 . f 2 We take this to be an approximation to the gradient at C for the arc, AB. 5
We saw earlier that � x 0 + h y B − y A = f ( x, y )d x. x 0 Therefore, y B − y A = h 6[ f (A) + f(B) + 4f(C)] . That is, y = y 0 + h x 0 + h 2 , y 0 + k 1 . f ( x 0 , y 0 ) + f ( x 0 + h, y 0 + k 2 ) + 4 f 6 2 PRACTICAL LAYOUT If d y d x = f ( x, y ) and y = y 0 when x = x 0 , then the value of y when x = x 0 + h is determined by the following sequence of calculations: 1. k 1 = hf ( x 0 , y 0 ). 2. k 2 = hf ( x 0 + h, y 0 + k 1 ). 3. k 3 = hf ( x 0 + h, y 0 + k 2 ). � � 2 , y 0 + k 1 x 0 + h 4. k 4 = hf . 2 5. k = 1 6 ( k 1 + k 3 + 4 k 4 ). 6. y ≃ y 0 + k . 6
EXAMPLE Solve the differential equation d y d x = 5 − 3 y at x = 0 . 1 given that y = 1 when x = 0 Solution We use x 0 = 0, y 0 = 1 and h = 0 . 1. 1. k 1 = 0 . 1(5 − 3) = 0 . 2 2. k 2 = 0 . 1(5 − 3[1 . 2]) = 0 . 14 3. k 3 = 0 . 1(5 − 3[1 . 14]) = 0 . 158 4. k 4 = 0 . 1(5 − 3[1 . 1]) = 0 . 17 5. k = 1 6 (0 . 2 + 0 . 158 + 4[0 . 17]) = 0 . 173 6. y ≃ 1 . 173 at x = 0 . 1 Note: It can be shown that the error in the result is of the order h 5 ; that is, the error is equivalent to some constant multiplied by h 5 . 7
Recommend
More recommend