You are on page 1of 8

Ordinary Differential Equations:

✔ A differential equation is an equation that contains derivatives of an


unknown function.
✔ The solution of the equation is the function that satisfies the differential
equation.
✔ A differential equation that has one independent variable is called an
ordinary differential equation (ODE).
✔ A first-order ODE involves Independent variable (x), dependent
variable ( y) , and the first derivative of the dependent variable w.r.t
the independent variable ( dy )
dx
✔ A first-order ODE is linear, if it is a linear function of ( y) and ( dy )
but (x) can be a nonlinear function. dx
Initial Value Problem
✔ In general, an infinite number of functions satisfy the equation.
✔ To obtain a specific solution, a first-order ODE must have an initial
condition or constraint that specifies the value of the dependent
variable at a particular value of the independent variable.
✔ The constraint is called initial condition and the problem is called an
Initial Value Problem (IVP).
✔ A first order ODE has the form:
dy
=f (x , y) with initial condition : y ( x0 )= y 0
dx
Numerical methods used for solving a first-order
ODE
✔ Numerical solution is a procedure for calculating an estimate of the
exact solution at a set of discrete points.
✔ Two types of methods, explicit, and implicit, can be used for
calculating the solution at each step.
✔ Explicit method are those that use explicit formula for calculating the
value of the dependent variable at the next value of the independent
variable. The right-hand side of the equation only has known
quantities. y i+1=F ( xi , y i , xi+1), where x i , y i , xi+1 are all known
✔ In Implicit method, the equation used for calculating y i+1 has the
form: y i+1=F ( xi , xi+ 1 , yi+ 1)
✔ Implicit methods provide improved accuracy over explicit methods.
Explicit Methods

The approximate numerical solution (x i+1 , y i+1) is calculated from the


known solution at point (x i , y i ) by:
xi+1=x i +h
y i+1= y i + slope .h
Where h is the step size, and the Slope is a constant that estimates the
dy
value of in the interval from x i to x i+ 1
dx

The numerical solution starts at the point where the initial value is known.
There are several methods and the difference between them is in the value
used for the constant Slope and in the way that it is determined.
Euler's method

Is the simplest technique for solving a first-order ODE of the form of


dy
=f (x , y) withinitial condition y ( x 0)= y 0
dx
Euler's method assumes that for a short distance h near (x i , y i) , the
y ( x) function has a constant slope equal to the slope at (x i , y i) . With
this assumption, the next point of the numerical solution is calculated
by: xi+ 1=x i +h y i+1 = y i + f (x i , yi ). h
Deriving Euler’s method by Numerical
Integration
Euler's method can be derived in several ways. Starting with the given
differential equation: dy =f (x , y)
dx
The approximate solution can be obtained by integrating the equation
or by using a finite difference approximation for the derivative.
y x
i+1 i+1
Multiply both sides by dx ∫ dy= ∫ f (x , y)dx
y x
i i

Use the simplest i.e, rectangle method where the integrand is


approximated by the constant value f (xi , yi )
xi+ 1

y i+1 − y i= ∫ f (x i , y i )dx ⇒ y i+1 = y i +f (x i , y i )(x i+1− xi )


xi

y i+1 = y i + f (x i , yi )h since h=x i+1−x i


Deriving Euler's method by finite difference
approximation
The derivative dy can be approximated with the forward difference
dx
formula by evaluating the ODE at the point x=x i
dy ( y i+1 − y i)
≈ =f (x i , y i)
dx (x i+1 −xi )

Solving for y i+1 gives the Euler’s method. Because the equation can
be derived in this way, the method is also known as the Forward
Euler method.
Example’s
dy
Ex:1 = y , y (0)=1 , use Euler's method with size h=0.1 to find
dx
the approximate values of the solution at x=0.1, 0.2, 0.3, 0.4 Also find
the approximate value of y (100)

You might also like