# lecture30 - Lecture 30 Euler Methods Numerical Solution of...

This preview shows pages 1–3. Sign up to view the full content.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture 30 Euler Methods Numerical Solution of an IVP Suppose we wish to numerically solve the initial value problem ˙ y = f ( t, y ) , y ( a ) = y , (30.1) on an interval of time [ a, b ]. By a numerical solution, we must mean an approximation of the solution at a finite number of points, i.e. ( t , y ) , ( t 1 , y 1 ) , ( t 2 , y 2 ) , . . . , ( t n , y n ) , where t = a and t n = b . The first of these points is exactly the initial value. If we take n steps as above, and the steps are evenly spaced, then the time change in each step is h = b- a n , (30.2) and the times t i are given simply by t i = a + ih . This leaves the most important part of finding a numerical solution: determining y 1 , y 2 , . . . , y n in a way that is as consistent as possible with (30.1). To do this, first write the differential equation in the indexed notation ˙ y i ≈ f ( t i , y i ) , (30.3) and will then replace the derivative ˙ y by a difference. There are many ways we might carry this out and in the next section we study the simplest. The Euler Method The most straight forward approach is to replace ˙ y i in (30.3) by its forward difference approximation. This gives y i +1- y i h = f ( t i , y i ) . Rearranging this gives us a way to obtain y i +1 from y i known as Euler’s method: y i +1 = y i + h f ( t i , y i ) . (30.4) With this formula, we can start from ( t , y ) and compute all the subsequent approximations ( t i , y i ). This is very easy to implement, as you can see from the following program (which can be downloaded from the class web site): 109 110 LECTURE 30. EULER METHODS function [T , Y] = myeuler(f,tspan,y0,n) % function [T , Y] = myeuler(f,tspan,y0,n)...
View Full Document

{[ snackBarMessage ]}

### Page1 / 4

lecture30 - Lecture 30 Euler Methods Numerical Solution of...

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

View Full Document
Ask a homework question - tutors are online