KEMBAR78
Numerical Methods For Solving Differential Equations | PDF | Ordinary Differential Equation | Finite Difference
0% found this document useful (0 votes)
7 views11 pages

Numerical Methods For Solving Differential Equations

This document describes several numerical methods for solving ordinary differential equations, including the Euler method, improvements such as the Heun method and the midpoint method, and second, third, and fourth-order Runge-Kutta methods. It also covers the shooting method for boundary value problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views11 pages

Numerical Methods For Solving Differential Equations

This document describes several numerical methods for solving ordinary differential equations, including the Euler method, improvements such as the Heun method and the midpoint method, and second, third, and fourth-order Runge-Kutta methods. It also covers the shooting method for boundary value problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

NUMERICAL METHODS FOR SOLVING DIFFERENTIAL EQUATIONS

Juan Carlos García Hernández


Cristian David Medina Martínez
Eider Fernando Arteaga Cundar
Luisa Carolina David Arias

Professor:
Ing. Édison Martínez Oviedo

UNIVERSITY OF PAMPLONA
ENGINEERING AND ARCHITECTURE
MECHANICAL ENGINEERING
COMPUTATIONAL MECHANICS
PAMPLONA NORTH OF SANTANDER
2018
NUMERICAL METHODS TO SOLVE DIFFERENTIAL EQUATIONS

ORDINARY DIFFERENTIAL EQUATIONS

Many engineering problems can be modeled with ordinary differential equations.

1.1. EULER METHOD

It is a first-order method and the simplest of the numerical methods, its basic idea is
calculate an approximation to the derivative at xithrough the incremental quotient

Algorithm:

1. We write the equation in the form:


dy
= f(x, y)
dx
2. We substitute the problem data into the following equation:
yi+1 = yi+ hf xi(, andi )
where h = size of the increment in x
3.Once the first result is obtained, we repeat the process with the next iteration.
y = yi+1
We repeat the procedure until we have reached the final value given to us.

1.2. IMPROVEMENTS OF THE EULER METHOD

The Euler method is of low precision. These methods are based on the idea of the Euler method.
but with an improvement in the approach

1.2.1. HEUN'S METHOD

This method allows calculating the slope from an initial point and with this finding a new point.
Applying two derivatives in the interval, at the initial point and the final point.

Algorithm:

we find
yi′= f x(i , andI )
2. We replace the problem data in the predictive equation.
0
yi+1 = yi+ f xi(, andih )
3. Now we evaluate the function again with the
xi+1 y yi0+1= f(xi+1, andi0+1)
4. We replace in the corrective equation
f( xi , yi+) f(xi+1, andI0+1)
yi+1 = yi+ h
2
and we will obtain
yi+1
5. We repeat the procedure until we reach the final value that was given to us.
1.2.2. MIDPOINT METHOD

With the midpoint method or the improved polygon method, we find a slope at the midpoint.
of the interval using a known point

Algorithm:

1. We substitute the problem data into the function they give us by finding
f(xi , andi )
2. We now replace in the equation
h
yi+ 1/ = yi+ f(xi , yi )
2 2
finding the point in
y = yi+ 1/
2
and to find
xi +1 /2
we split our point into two inx
3. We substitute in the equationyi+1 = yi+ f(xi + /,1andi+ ⁄)hand
1 we obtain our next
2 2
point inyi+1
We repeat the procedure until we reach the final value that was given to us.

1.3. RUNGE-KUTTA METHODS

These methods have more accuracy than the previous ones, characterized because their error has the form:
EIChk
Where C = positive real constant and k = order of the method
All methods use a generalized formula:
yi + 1= yi+ ∅(xi , andi , h)h

1.3.1. SECOND ORDER RUNGE-KUTTA METHOD

It is second order since the function is evaluated twice at each step.


For this case, we use the formula:
yi+1 = yI+ (a1 k1+ a2 k2
Where
k1= f(xi , yI )
k 2= f(xi+ p1 h, yi+ q11k1 h)
a1= 1- a2
1
p1=11 =
2a2
Special cases:

1
yesa2= then:
2

1
a1= y p1q11= 1
2

the Heun method would result in the formula as follows:

1 1
yi+1 = yi+ ( k1+ k2
2 2

yesa2= 1so:

1
a1= 0p1=11 y = 2

The midpoint method would result in the formula as follows:

yi+1 = yi+k2 h

2
yesa2= so:
3

1 3
a1= y p1= q11 =
3 4

the Ralston method is used, the formula would be as follows:

1 2
yi+1 = yi+ ( k1+ k2 ) h
3 3

Algorithm:

1.Depending on which constant we choose, we then find the values of k.1y k2


2. We obtain the value of the slope.
3. We now substitute into the equation of yi+1finding the point at y= yi+1
4. We repeat the process until we have reached the final value given to us.

1.3.2. THIRD ORDER RUNGE-KUTTA METHOD

For a number of stages of n=3, one can proceed similarly to the second method.
order. For this case we use the formula:

1
yi+1 = yi+ (k1+ 4k2+k3
6
Where:
k1= f(xi , andi )
1 1
k 2= f(xi+ h, yi+ k1
2 2
k 3= f(xi+ h, yI− k1 h + 2k 2 h)

Algorithm
We find the values of k1, k2y k3
2. We obtain the value of the slope.
3. We now substitute in the equation for y.i+1 finding the point at y=yi+1
4. We repeat the procedure until we reach the final value given to us.

1.3.3. FOURTH ORDER RUNGE-KUTTA METHOD


Of the many Runge-Kutta methods, this is the most used and therefore called the RK method.
fourth-order classic. If n=4, a procedure similar to the previous one is carried out. Starting from
the general equation:
1
yi+1 = yi+ (k1+ 2k 2+ 2k 3+ K 4
6
Where:
k1= f(xi , andi )

k 2= f(xi+ 21h, yi+ 12k1 h)

k 3= f(xi+ 21h, yi+ 12k 2 h)

k 4= f(xi+ h, yi+k3 h)

Algorithm

We find the values of k1, k2, k3y k4


2. We now replace in the equation of yi+1 finding the point at y=yi+1
We repeat the procedure until we reach the final value that was given to us.

1.3.4. HIGHER ORDER RUNGE-KUTTA METHOD

When more accurate results are required, the fifth-order RK method is recommended.
Butcher (1964):

1
yi+1 = yi+ (7k1+ 32k 3+ 12k 4+ 32K5+ 7K6 )h
90
where

k1= fx(i , andi, )


k 2= f(xi+ 41h, yi+ 14k1 h),
k 3= f(xI+ 41h, yi+ 18k1 h+ 18k 2 h)
k 4= f(xi+ 21h, yi+ 12k 2 h+k3
3 9
k 5= f(xi+ 43h, yi+ 16k1 h+ 16k 4 h) y
k 6= f(xi+ h, yI− 73k1 h+ 27k 2 h+ 12k 3 h −127 k 4 h+ 78k 57h)

Algorithm

We find the values ofk1 , k 2 , k 3 , k 4 , k 5yk 6


2. We now substitute in the equation ofyi+1, finding the point iny = yi+1
3. We repeat the procedure until we have reached the final value that was given to us.

1.4. BOUNDARY VALUE PROBLEMS

1.4.1. SHOOTING METHOD

The shooting method is based on converting the boundary value problem into a problem of
equivalent initial value. We will have a second degree equation, which we take and the
we express it as two first-order ODEs, then we will obtain a new variable z, which
we will give it an arbitrary initial value, then what we do is integrate the two ODEs of
first order by any of the previous methods, giving us a result which we will compare
whether it approaches or distances itself from the final value given in the exercise. Since this is an approximation, then
we will surely obtain two results, one below and one above the real value, then
what we do is an interpolation between the initial values we take arbitrarily for
z and the result we obtained by integrating the 1st order ODEs. Thus giving us a value for z that we
it will take you right to the exact final value.

Algorithm
We express the 2nd order ODE as two 1st order ones.
We obtain a new variable to which we assign arbitrary initial values.
3. We integrate and when we obtain one value above and another below the final real value.
we interpolate.

1.4.2. FINITE DIFFERENCE METHOD

The most common alternatives to the shooting method are the finite difference methods, in the
which, the finite divided differences replace the derivatives in the original equation. Thus, a
linear differential equation is transformed into a set of simultaneous algebraic equations,
according to table 1. When we have already replaced the derivatives, it is replaced according to the node which
will give us the equations that we will have to input into a matrix from which we will take the inverse
and will give us the solution to the unknowns.
This method can be applied to partial differential equations in the same way.
First derivative:
f( xi+1 )- fxi−1
( )
f ′ ( xi=
)
2h

-f x( i+2+ )8f xi+1( − 8f) xi+1 (- fxI-2) ( )


f ′ ( xI)=
12h

Second derivative

-f x( i+2+ )16f xi+1( − 30f


) xI+ 16f
( )xi+1 - fx( i-2 ) ( )
f′′ x(i= )
12h2

Third derivative

-f x( i+3 +) 8f xi+2
( − 13f
) xi+1 (+ 13f)xI−1− 8f( xi-2+) f xi+3( ) ( )
f′′′ x( i=)
8h3

Fourth derivative

′ (x =)
-f x( i+3 +) 12f xi+2
( − 39f
) xi+1 (+ 56f) xi− 39f( xI−1
) − 12f( xI-2+) f xi+3 ( ) ( )
f′′′ I
6h4

Algorithm
The equations are replaced.
2. Then the equations of the nodes are found.
3. They are introduced into a matrix from which we take the inverse and it will give us the results.

Example:
Exercise 27.23 from the book Numerical Methods for Engineers by Chapra 5th edition.
27.23 Use finite differences to solve the differential equation
Ordinary with boundary values. Use 5 nodes see fig. 1

2
+6
2 − ( )
= 0 0= 10 (2) =1With∆x=0.5

u (0) = 10 U5= u (2)=1

Exercise solution.

Node 1
2−2u1+10 2−10
0.5 2
+ 6 −
0.5(2)
1= 0

Solving

-91 + 100 = 20 Equation 1


Node 2
u3-2 2+u1
0.5 2
+ 6u3−u10.5(2)
− 2 =0

Resolving

-21- 901 + 10 3= 0Equation 2

Node 3
1-2u3 + u2 1− 2
0.5 2
+ 6( )−0.52 3= 0

Resolving

-2a2 - 9a3= −10Equation 3

Set values for the matrix

A U B

I -9 10 0 I I u1 I I 20 I

I -2 -9 10 l I u2 I = I 0 I

I 0 -2 -9 i I u3 I I -10 I

2nd or higher order ODE

Differential Equations of Order n

It is a mathematical expression of the type F (x,y, y’, y’’…y) =0


A second-order ODE has a second derivative as the highest

d2 x dx
m + m+ kx =0
dt2 dt

Any differential equation of order n (expressed in normal form) is equivalent to a system of


in first order differential equations
dy
= y1 (x)
dx

dy1
= y2 (x)
dx

dy-2
= yn−1 ( x)
dx
LINEAR DIFFERENTIAL EQUATIONS OF ORDER n

A linear differential equation of order n is a linear expression of the function and its derivatives.
They can be classified as homogeneous (equal to zero) and non-homogeneous (equal to a function of x).

A homogeneous linear equation takes the form:

−1
( ) + −1 ( ) +⋯
−1 1( ) + 0( ) =0

A non-homogeneous linear equation (fn(x) ≠ 0) remains in the form:

−1
+ −1 ( ) +⋯
−1 1( ) + 0( ) = ( )

The points at which fn(x) = 0 are called singular points of the linear equation.

2. PARTIAL DIFFERENTIAL EQUATIONS

These equations can be described as a relationship whose unknowns are functions of variables.
independent. It is said that a partial differential equation is linear if it is linear in the function
unknown and in all its derivatives, with coefficients that depend only on the variables
independents.
A second-order EDP has the form:

2 2 2
( ,) 2
( , ) + 2B ( ) ( , ) + ( ,) 2
( , ) + ( ,) ( , )

+ ( ,) ( , ) + ( ,) ( ), = ( , )

And they are classified into types:


Hyperbolic if B2-AC>0
Parabolic if B2-AC=0
Elliptical if B2-AC<0

2.1. FINITE DIFFERENCES: ELLIPTIC EQUATIONS

The finite element method as a mathematical formulation is relatively new; although


its basic structure has been known for quite some time, in recent years it has undergone a great
development due to computer advancements.
It is a method that allows the approximation of partial differential equations. These
Equations are of Poisson (f ≠ 0) and of Laplace (f = 0)
2.1.1. POISSON EQUATION

These equations are used in physical problems such as heat distribution or in dynamics.
of fluids and is defined as:

2 2

2
( , ) + ( , ) = ( ,
2
)

This equation is elliptic since: A=1, B=0 and C=1

2.1.2. Laplace Equation

The Laplace equation is defined as:

2 2

2
( , ) + ( , ) =0
2
BIBLIOGRAPHY

CHAPRA, Steven C; RAYMOND, Canale P. Numerical Methods for Engineers, Fifth


edition, McGraw Hill, Mexico City
Wikipedia. (n.d.). Euler's Method. Location:
Unable to access external content, please provide the text you wish to translate.
Google Sites. (n.d.). Numerical methods, unit VI. Location:
The provided text is a URL and cannot be translated.
one-step-Euler-method-improved-Euler-method-and-Runge-Kutta-method
Differential equation solved exercises. (2014). Euler's method for equations
differentials. Location:The provided link is not valid for translation.
euler-for-differential-equations
López, Diego. (2016). University of Antioquia, learn online, Heun method.
Location:
http://aprendeenlinea.udea.edu.co/lms/moodle/mod/page/view.php?id=24537
Martínez Verdú, Jaime. (2013). Slideshare, Numerical methods for equations
ordinary differentials. Location:https://es.slideshare.net/balzasbravas/methods-
numerical differential equations
Wikipedia. (n.d.). Finite difference. Location:
Unable to access external content such as websites.
Wikipedia. (n.d.). Finite Difference. Location:
Unable to access external links.
Math tools. (n.d.). Runge-Kutta methods. Location:
The provided link does not contain text to be translated.
0jt7IU
Wikipedia. (n.d.). ordinary differential equation. Location:
Ordinary Differential Equation
Wikipedia. (n.d.). partial differential equation. Location:
Partial Differential Equation
López Garza, Gabriel. (2013). Partial Differential Equations. Location:
The provided text is a URL and does not contain translatable content.
_Gabrile.pdf

You might also like