chapter5.page04

# chapter5.page04 - t 2-e x sin( t ) ,x (0) = 1 with h = 0 ....

This preview shows page 1. Sign up to view the full content.

4 1. NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS The algorithm for this function is very simple (here, we break down the computation in three steps), Input f , x , and h . Output: the approximation to f 0 ( x ) . Step One: Set w = f ( x + h ) Step Two: Set d = f ( x ) Step Three: return w - d h 2. Euler’s Method 2.1. Euler’s Method. Euler’s method is the simplest method in ﬁnd approximate solutions to ﬁrst order equations. From the forward diﬀerence formula f 0 ( x ) f ( x + h ) - f ( x ) h , we have f ( x + h ) f ( x ) + f 0 ( x ) h (1) Now if x 0 ( t ) = f ( t,x ) is a ﬁrst order diﬀerential equations, apply (1), we have x ( t + h ) x ( t ) + f ( t,x ( t )) h. Suppose we want to ﬁnd approximate solution over interval [a, b] with initial value x ( a ) = x 0 , we divided the interval into n subintervals each with length h = b - a n , the ends of the subintervals is t 0 = a,t 1 = a + h,t 2 = a + 2 h, ··· ,t n = a + nh = b. Start with x 0 we can compute x 1 = x 0 + f ( t 0 ,x 0 ) h x 2 = x 1 + f ( t 1 ,x 1 ) h . . . x n = x n - 1 + f ( t n - 1 ,x n - 1 ) h Example 2.1 . Find approximate to x (1) if x 0 ( t ) =
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t 2-e x sin( t ) ,x (0) = 1 with h = 0 . 25 . Solution Here the interval is [0, 1], so a = 0 ,b = 1 . Since h = b-a n = 0 . 25 we have n = 4 and we need to compute x 1 ,x 2 ,x 3 ,x 4 starting with x = x (0) = 1 . x 1 = x + f ( t ,x ) h = 1 + f (0 , 1) * . 25 = 0 . 15853 x 2 = x 1 + f ( t 1 ,x 1 ) h = 0 . 15853 + f (0 . 25 , . 15853) * . 25 = 0 . 01833 x 3 = x 2 + f ( t 2 ,x 2 ) h = 0 . 01833 + f (0 . 5 , . 01833) * . 25 = 0 . 23811 x 4 = x 3 + f ( t 3 ,x 3 ) h = 0 . 23811 + f (0 . 75 , . 15853) * . 25 = 0 . 30128 So the approximation to x (1) is x (1) x 4 = 0 . 30128 . Also x (0 . 25) x 1 = 0 . 15853 , x (0 . 5) x 2 = 0 . 01833 , x (0 . 75) x 3 = 0 . 23811 . a...
View Full Document

## This note was uploaded on 10/04/2011 for the course MAP 4231 taught by Professor Dr.han during the Spring '11 term at UNF.

Ask a homework question - tutors are online