eulermethdn12-1
-
Upload
vinayaga-murthy-g -
Category
Documents
-
view
224 -
download
0
Transcript of eulermethdn12-1
-
7/30/2019 eulermethdn12-1
1/9
Numerical Solutions of
Differential EquationsEulers Method
-
7/30/2019 eulermethdn12-1
2/9
Differential Equations
A differential equation is a relation between the independent variable ( x), thedependent variable ( y) and its derivatives ( y,y,y,y (4) ,). Some of thesevariables might be missing from the equation. Many situations in not onlymathematics, but physics, engineering, biology, chemistry, economics as well asmany other disciplines can be described using differential equations. Here aresome examples:
02
2
lg
dt d
Harmonic Oscillator
gdt
sd 2
2
Free Falling Body
)( mT T k dt dT Newtons Law of
Cooling
222
1 dxdyk
dx yd Shape of a
hanging string
kP
dt
dP Population Growth
)( bPaPdt dP Population Growth
(limited resources)
kxydt
dxSpread of Disease
Predator-Prey)(
)(
y x
x y
dt dx
dt dy
Given equations like these we would like to solve them.
-
7/30/2019 eulermethdn12-1
3/9
There are many known methods to solve differential equations using non-numerical techniques (i.e. by hand). Most of these involve integration methods. Aswe have previously mentioned it is not always possible to find a closed formantiderivative for a given function made up of functions we commonly use.
To the right is an example of an explicit solution of aseparable (Newtons Law of Cooling) differential equationby non-numerical methods.
Notice the c0 term that appears in the solution. This come
from not knowing the constant (+ C ) when you integrate.If we knew a certain value for the function say T (1)=95 ,for example, we could find the value for c0 and thus haveeverything we need to solve the differential equation.
This specific piece of information is sometime called a
boundary condition for the differential equation. Thiswill become an important part of generating a numericalsolution for a differential equation.
Since some antiderivatives do not have a closed formmade up of common function neither will the solutions to
some differential equations.
)( mT T k dt dT
dt k dT T T m
1
dt k dT mT T 1
C kt T T mln
C kt T T
ee m)ln(
kt m ecT T 0
kt m ecT T 0
-
7/30/2019 eulermethdn12-1
4/9
First Order Degree 1 Differential Equations
The study of differential equation is a subject of its own. The way they arenormally studied is much like solving algebraic equations, look to see if thedifferential equation fits a certain pattern and then apply a certain technique to it.
The methods we will focus on here will all have the same initial problem. We willbe given a differential equation with the derivative a function of the dependent andindependent variable and an initial condition.
00 )(),( y x yand y x f dxdy
The solution which we call a function y(x) tosuch an equation can be picturedgraphically. The point ( x0, y0) must be on thegraph. The function y(x) would also satisfythe differential equation if you plugged y(x) infor y. y0
x0
( x0 ,y0)
y(x)
))(,()('
),(
x y x f x y
y x f dxdy
-
7/30/2019 eulermethdn12-1
5/9
Solutions to Equations
The solution to a differential equation (unlike an algebraic equation) is a function.The problem with this is there are many ways to describe functions. Some can
be described in terms of some equation relating the dependent and independentvariable, some by a graph and some by a very complicated rule.
The way we will solve a differential equation is to use the definition of afunction. That is to say if we are given a differential equation y(x) = f(x,y) with aboundary condition y(x0 ) = y0 and another value of x, say xact we can find anumber yact so that y(xact ) = yact .
y0
x0
( x0 ,y0)
y(x) ( xact ,yact )
yact
xact
The problem that exists is that yn can notbe exactly computed only estimated.There are several different ways in whichto estimate the value for yn. We will studya couple of them in this section.
The point ( x0, y0) is called the initial point and the point ( xact , yact ) is called theterminal point .
-
7/30/2019 eulermethdn12-1
6/9
Eulers Method
The method that Euler used to estimate a solution (i.e. the corresponding value of y for a given value of x) of a differential equation was to follow the tangent line from
the initial point to the terminal point.
y0
x0
( x0 ,y0)
y(x) ( xact ,yact )
yact
xact
ynHere we use the value yn to estimate thevalue of yact . This can be directly computedfrom the information given by the followingequation.
))(,())(,(
0000
0000
x x y x f y y x x y x f y y
act n
act n
The insight that Euler had was to see how this estimate could be improved on.The strategy he used was to divide the interval [ x0, xact ] (or [ xact , x0] in the case
xact < x0) into equal subintervals and recompute the tangent line as you go. Thiswould not allow the tangent line to drift far from the function itself. This wouldhopefully produce a more accurate estimate for yact at the end.
-
7/30/2019 eulermethdn12-1
7/9
( x4, y4)
( x3, y3)
( x2, y2)
( x1, y1)
x0
( x0 ,y0)
( xact ,yact )
x4 x1 x2 x3
To Apply Eulers Method
1. Divide the interval n equal subintervals. (Inour example 4.)
2. Compute the width of each subintervalwhich is x=h=( xn- x0)/n.
3. Compute the sequence of points asfollows:
x
y0
x y x f y y
x x x y x
),(),(
0001
0111
x y x f y y
x x x y x
),(),(
1112
1222
x y x f y y
x x x y x
),(),(
2223
2333
x y x f y y
x x x y x
),(
),(3334
3444
In general the coordinates of thepoint ( xn+1 , yn+1) can be computedfrom the coordinates of the point
( xn, yn) as follows :
x y x f y y
x x x y x
nnnn
nnnn ),(
),(1
111
-
7/30/2019 eulermethdn12-1
8/9
Example:
Given the differential equation to the right with its boundaryconditions find the value of y(2 ) using Eulers method with4 iterations. 1)0(
2
y
y xdxdy
21
402.2 xh
210.1 400 xand yand x
11010
.3212
1
21
21
1
y
x
125.11111
.481
212
21
2
21
21
2
y
x
6875.15625.125.1125.11125.15.11
.5212
3
21
3
y
x
58594.389844.16875.16875.15.16875.125.1
.621
24
21
4
y
x
The actual solutionis:
331 x
e y3919.14)2( 3
8
e y
-
7/30/2019 eulermethdn12-1
9/9
Algorithm for Eulers Method
Given f(x,y) (* expression for x and y *)
x0 (* initial value for x *) y0 (* initial value for y *) xn (* terminal value for x *)n (* number of partitions of the interval *)
deltax = ( xn-x0 )/n
xi = x0 xprev = xi yi = y0for( i=1, i n, i++,
xi = xi + deltax yi = yi + f(xprev,y i)*deltax ) xprev = xi
Return yi