SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Part 7:
Ordinary Differential Equations
–
–
–
–
–

Runge-Kutta Methods
Euler’s Method
Heun’s Method
Midpoint method
Systems of Equations
Runge-Kutta Methods
 We want to solve an ordinary differential equation of the form:
y

'

dy

f ( x, y )

dx

 The general approach of the solution is in the form of:
(new value)=(old value) + (slope) x (step size)

 All of the one-step methods under this
general category are called RungeKutta methods.
> Euler’s method
> Heun’s method
> Midpoint method
 The differences in these methods are
in the way (slope) is defined.

Slope=

yi

xi

xi

1

1

yi

h
Euler’s Method
 Simplest way of approximating the slope is in the form of first
derivative. Apply forward scheme finite difference for the starting
point:
y

yi

'

yi

1

h

predicted

f ( xi , yi )

yi

Then,
yi

1

yi

f ( xi , y i ) h

Euler’s
method
formula

where f(xi, yi) is calculated from
the initial condition.

1

true

yi

xi

xi

1

 That is the slope at the beginning is approximated as the slope
over the entire interval.
 As in the forward scheme finite difference method, error for this
approximation is O(h).
EX: Use Euler’s method to solve
dy

2x

3

12 x

2

20 x

8 .5

dx

from x=0 to x=2 with a step size of 0.5. The initial condition at x=0 is y=1.
Differential equation: f ( x , y )
Using Euler’s formula:
y ( 0 .5 )

y (0)

f ( 0 ,1) 0 . 5

2x

3

12 x

5 . 25

2

20 x

t

8 .5

63 . 1 %

Second step:
y (1)

y ( 0 .5 )

f ( 0 . 5,5 . 25 ) 0 . 5

5 . 875

t

95 . 8 %

Other steps:
y (1 . 5 )

5 . 1250

y ( 2 .0 )

4 . 5000

t
t

131 %
125 . 0 %

Error can be reduced by using a smaller step size (h).
Considering that Euler’s method has an error O(h), halving the step size will
halve the error.
Heun’s Method
 It is an improvement of Euler’s method.
 Improve the slope of the interval by averaging derivatives at the
starting and end points.
Slope=f(xi+1’ yi+10)

Slope=[f(xi’ yi)+f(xi+1’ yi+10)]/2

Slope=f(xi’ yi)

xi

Predictor

xi

1

xi

Corrector

xi

1
Approximate the slope at the starting point using Euler’s method
y

'

f ( x, y )

Extrapolate linearly to find y at the end point:
0

yi

yi

1

f ( xi , y i ) h

standard Euler method stops here.

This intermediate solution (predictor) is used to calculate the slope
at the end point:
'

0

yi

f ( xi 1 , yi 1 )

1

Calculate average of the two slopes at the starting and end points:
'

'

yi

'

y

yi

1

2

Use this slope to re-calculate y value at the end point (corrector):
'

yi

1

yi

yh
0

Predictor:
Corrector:

yi
yi

1

yi

1

yi

f ( xi , y i ) h

f ( xi , y i )

0

f ( xi 1 , y i 1 )

h

Heun’s
method

2

 Corrector equation involves yi+1 on both sides, which means that it
can be applied iteratively for the end point (i.e., older
approximation can be used iteratively to calculate a new
approximation).
 The iteration does not necessarily converge to the true solution
but approaches a solution with a finite truncation error.
 The method is accurate to O(h2).(compare to O(h) accuracy of
Euler’s method).
EX: Use Heun’s method to numerically solve the following ODE
y

'

4e

0 .8 x

0 .5 y

from x=0 to x=4 with a step size of h=1. Initial condition is (0,2).
Calculate the slope at the starting point (x=0):
'

y0

4e

0

0 .5 ( 2 )

3

Apply Euler’s (predictor) formula to evaluate y10
0

y1

2

3 (1)

5

t

25 . 3 %

Calculate slope at the end point (x=1)
'

0

y1

f ( x1 , y 1 )

4e

0 . 8 (1 )

0 .5 (5 )

Calculate average of the two slopes:
'

y

3

6 . 401164
2

4 . 701082

6 . 402164

Euler’s
method
Use the corrector formula to calculate the new prediction at x=1:
y1

2

4 . 701082 (1)

6 . 701082

t

8 . 18 %

Above is based on a single iteration at y1. Apply another iteration to refine the
predictor:
y1

2

[3

4e

0 . 8 (1 )

0 . 5 ( 6 . 701082 )]

6 . 275811

t

1 . 31 %

6 . 382129

t

3 . 03 %

2

Further correction:
y1

2

[3

4e

0 . 8 (1 )

Results for all the
points from x=0 to x=4:
(15 iterations at each point)

0 . 5 ( 6 . 275811 )]
2

x

y (true)

y (Heun)

0

2.0000000

2.0000000

0.00

1

6.1946314

6.360866

2.68

2

14.843922

15.302237

3.09

3

33.677172

34.743276

3.17

4

75.338963

77.735096

3.18

t(%)
Midpoint Method
 It is another improvement of Euler’s method.
 Approximate y at the midpoint of the interval, and use it for the
average slope of the entire interval.
Slope=f(xi+1/2’ yi+1/2)

Slope=f(xi+1/2’ yi+1/2)

xi

xi
yi

1/ 2

yi

f ( xi , yi )

Predictor

xi

1/ 2

h
2

yi

1

yi

f ( xi

1/ 2

Corrector

xi
, yi

1

1/ 2

)h
 No iteration can be made for the corrector.
 Just as the centered difference is superior to forward or backward
difference schemes, midpoint is superior to Euler’s method in the
same manner.

Euler’s method
Midpoint method

O(h)
O(h2)

truncation error

Summary:
 All the three methods, Euler’s, Heun’s (without iteration), and
midpoint methods, mentioned so far are under the general
category of one-step approaches called Runge-Kutta methods.
 Heun’s and midpoint methods are generally superior to Euler’s
method, even though they require somewhat more calculations.
Systems of Equations
 Problems requiring the solution of a system of ODE’s are very
common in engineering applications.
dy 1
dx
dy 2
dx

f 1 ( x , y 1 , y 2 ,..., y n )
f 2 ( x , y 1 , y 2 ,..., y n )

....
dy n
dx

n- initial conditions
need to be known
at the starting
value of x

f n ( x , y 1 , y 2 ,..., y n )

Euler’s Method:
 Simply apply Euler’s method for each equation at each step.
 Strcictly apply the one-step Euler’s formula for every equation
before proceeding to the next-step (i.e., do not update any
variable during a single step).
EX: Solve the following system of ODEs using Euler’s method.
dy 1

dy 2

0 .5 y1

dx

dx

4

0 .3 y 2

0 .1 y1

Assume that for x=0, y1=4, and y2=6. Integrate to x=2 with a step size h=0.5.
Apply Euler’s method:
y1 ( 0 . 5 )

4

y 2 ( 0 .5 )

6

0 .5 ( 4 ) 0 .5
4

0 .3( 6 )

3
0 . 1( 4 ) 0 . 5

6 .9

Other points are calculated in the same fashion. Results to x=2 are below:
x

y1

y2

0

4

6

0.5

3

6.9

1.0

2.25

7.715

1.5

1.6875

8.44525

2.0

1.265625

9.094087

Weitere ähnliche Inhalte

Was ist angesagt?

Runge-Kutta methods with examples
Runge-Kutta methods with examplesRunge-Kutta methods with examples
Runge-Kutta methods with examplesSajjad Hossain
 
Numerical solution of ordinary differential equations GTU CVNM PPT
Numerical solution of ordinary differential equations GTU CVNM PPTNumerical solution of ordinary differential equations GTU CVNM PPT
Numerical solution of ordinary differential equations GTU CVNM PPTPanchal Anand
 
Newton-Raphson Method
Newton-Raphson MethodNewton-Raphson Method
Newton-Raphson MethodJigisha Dabhi
 
Numerical solution of ordinary differential equation
Numerical solution of ordinary differential equationNumerical solution of ordinary differential equation
Numerical solution of ordinary differential equationDixi Patel
 
Runge Kutta Method
Runge Kutta Method Runge Kutta Method
Runge Kutta Method Bhavik Vashi
 
Newton’s Forward & backward interpolation
Newton’s Forward &  backward interpolation Newton’s Forward &  backward interpolation
Newton’s Forward & backward interpolation Meet Patel
 
D’Alembert’s Solution of the Wave Equation
D’Alembert’s Solution of the Wave EquationD’Alembert’s Solution of the Wave Equation
D’Alembert’s Solution of the Wave Equationvaani pathak
 
Lagrange equation and its application
Lagrange equation and its applicationLagrange equation and its application
Lagrange equation and its applicationMahmudul Alam
 
Finite DIfference Methods Mathematica
Finite DIfference Methods MathematicaFinite DIfference Methods Mathematica
Finite DIfference Methods Mathematicaguest56708a
 
Numerical Differentiation and Integration
 Numerical Differentiation and Integration Numerical Differentiation and Integration
Numerical Differentiation and IntegrationMeenakshisundaram N
 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equationsSusana I. F.
 
Fundamentals of Finite Difference Methods
Fundamentals of Finite Difference MethodsFundamentals of Finite Difference Methods
Fundamentals of Finite Difference Methods1rj
 
Euler's Method
Euler's MethodEuler's Method
Euler's Methoddmidgette
 
1st order differential equations
1st order differential equations1st order differential equations
1st order differential equationsNisarg Amin
 
System of linear equations
System of linear equationsSystem of linear equations
System of linear equationsDiler4
 
introduction to differential equations
introduction to differential equationsintroduction to differential equations
introduction to differential equationsEmdadul Haque Milon
 

Was ist angesagt? (20)

Runge Kutta Method
Runge Kutta MethodRunge Kutta Method
Runge Kutta Method
 
Runge-Kutta methods with examples
Runge-Kutta methods with examplesRunge-Kutta methods with examples
Runge-Kutta methods with examples
 
Numerical solution of ordinary differential equations GTU CVNM PPT
Numerical solution of ordinary differential equations GTU CVNM PPTNumerical solution of ordinary differential equations GTU CVNM PPT
Numerical solution of ordinary differential equations GTU CVNM PPT
 
Newton-Raphson Method
Newton-Raphson MethodNewton-Raphson Method
Newton-Raphson Method
 
Numerical solution of ordinary differential equation
Numerical solution of ordinary differential equationNumerical solution of ordinary differential equation
Numerical solution of ordinary differential equation
 
Runge Kutta Method
Runge Kutta Method Runge Kutta Method
Runge Kutta Method
 
Newton’s Forward & backward interpolation
Newton’s Forward &  backward interpolation Newton’s Forward &  backward interpolation
Newton’s Forward & backward interpolation
 
Euler and runge kutta method
Euler and runge kutta methodEuler and runge kutta method
Euler and runge kutta method
 
D’Alembert’s Solution of the Wave Equation
D’Alembert’s Solution of the Wave EquationD’Alembert’s Solution of the Wave Equation
D’Alembert’s Solution of the Wave Equation
 
Lagrange equation and its application
Lagrange equation and its applicationLagrange equation and its application
Lagrange equation and its application
 
Finite DIfference Methods Mathematica
Finite DIfference Methods MathematicaFinite DIfference Methods Mathematica
Finite DIfference Methods Mathematica
 
Numerical Differentiation and Integration
 Numerical Differentiation and Integration Numerical Differentiation and Integration
Numerical Differentiation and Integration
 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equations
 
newton raphson method
newton raphson methodnewton raphson method
newton raphson method
 
Fundamentals of Finite Difference Methods
Fundamentals of Finite Difference MethodsFundamentals of Finite Difference Methods
Fundamentals of Finite Difference Methods
 
Euler's Method
Euler's MethodEuler's Method
Euler's Method
 
1st order differential equations
1st order differential equations1st order differential equations
1st order differential equations
 
System of linear equations
System of linear equationsSystem of linear equations
System of linear equations
 
Unit vi
Unit viUnit vi
Unit vi
 
introduction to differential equations
introduction to differential equationsintroduction to differential equations
introduction to differential equations
 

Andere mochten auch

Eulermethod2
Eulermethod2Eulermethod2
Eulermethod2stellajoh
 
Numerical solution using runge kutta with programming in c++
Numerical solution using runge kutta with programming in c++Numerical solution using runge kutta with programming in c++
Numerical solution using runge kutta with programming in c++Vijay Choudhary
 
AP Calculus AB March 25, 2009
AP Calculus AB March 25, 2009AP Calculus AB March 25, 2009
AP Calculus AB March 25, 2009Darren Kuropatwa
 
MILNE'S PREDICTOR CORRECTOR METHOD
MILNE'S PREDICTOR CORRECTOR METHODMILNE'S PREDICTOR CORRECTOR METHOD
MILNE'S PREDICTOR CORRECTOR METHODKavin Raval
 
AP Calculus AB March 26, 2009
AP Calculus AB March 26, 2009AP Calculus AB March 26, 2009
AP Calculus AB March 26, 2009Darren Kuropatwa
 
DIFFRENTIAL EQUATIONS
DIFFRENTIAL EQUATIONSDIFFRENTIAL EQUATIONS
DIFFRENTIAL EQUATIONSAafaq Malik
 
Adequacy of solutions
Adequacy of solutionsAdequacy of solutions
Adequacy of solutionsTarun Gehlot
 
A2 /EXPT/THER/KELLY/APRIL
A2 /EXPT/THER/KELLY/APRILA2 /EXPT/THER/KELLY/APRIL
A2 /EXPT/THER/KELLY/APRILRama Chandra
 
Applied numerical methods lec6
Applied numerical methods lec6Applied numerical methods lec6
Applied numerical methods lec6Yasser Ahmed
 
Cequel: Chemical Equilibrium in Excel
Cequel:  Chemical Equilibrium in ExcelCequel:  Chemical Equilibrium in Excel
Cequel: Chemical Equilibrium in ExcelJonathan French
 
Eulermethod3
Eulermethod3Eulermethod3
Eulermethod3stellajoh
 
Euler method notes sb
Euler method notes sbEuler method notes sb
Euler method notes sbjanetvmiller
 
Hpcc euler
Hpcc eulerHpcc euler
Hpcc eulerrhuzefa
 

Andere mochten auch (20)

Eulermethod2
Eulermethod2Eulermethod2
Eulermethod2
 
Numerical solution using runge kutta with programming in c++
Numerical solution using runge kutta with programming in c++Numerical solution using runge kutta with programming in c++
Numerical solution using runge kutta with programming in c++
 
DLR_DG_AZIZ_2003
DLR_DG_AZIZ_2003DLR_DG_AZIZ_2003
DLR_DG_AZIZ_2003
 
AP Calculus AB March 25, 2009
AP Calculus AB March 25, 2009AP Calculus AB March 25, 2009
AP Calculus AB March 25, 2009
 
Ch02 7
Ch02 7Ch02 7
Ch02 7
 
MILNE'S PREDICTOR CORRECTOR METHOD
MILNE'S PREDICTOR CORRECTOR METHODMILNE'S PREDICTOR CORRECTOR METHOD
MILNE'S PREDICTOR CORRECTOR METHOD
 
AP Calculus AB March 26, 2009
AP Calculus AB March 26, 2009AP Calculus AB March 26, 2009
AP Calculus AB March 26, 2009
 
Calc 6.1b
Calc 6.1bCalc 6.1b
Calc 6.1b
 
DIFFRENTIAL EQUATIONS
DIFFRENTIAL EQUATIONSDIFFRENTIAL EQUATIONS
DIFFRENTIAL EQUATIONS
 
Numerical Integration
Numerical IntegrationNumerical Integration
Numerical Integration
 
Ma2002 1.6 rm
Ma2002 1.6 rmMa2002 1.6 rm
Ma2002 1.6 rm
 
Adequacy of solutions
Adequacy of solutionsAdequacy of solutions
Adequacy of solutions
 
Ma2002 1.16 rm
Ma2002 1.16 rmMa2002 1.16 rm
Ma2002 1.16 rm
 
A2 /EXPT/THER/KELLY/APRIL
A2 /EXPT/THER/KELLY/APRILA2 /EXPT/THER/KELLY/APRIL
A2 /EXPT/THER/KELLY/APRIL
 
Applied numerical methods lec6
Applied numerical methods lec6Applied numerical methods lec6
Applied numerical methods lec6
 
Cequel: Chemical Equilibrium in Excel
Cequel:  Chemical Equilibrium in ExcelCequel:  Chemical Equilibrium in Excel
Cequel: Chemical Equilibrium in Excel
 
Eulermethod3
Eulermethod3Eulermethod3
Eulermethod3
 
Euler method notes sb
Euler method notes sbEuler method notes sb
Euler method notes sb
 
10 09
10 0910 09
10 09
 
Hpcc euler
Hpcc eulerHpcc euler
Hpcc euler
 

Ähnlich wie Es272 ch7

Applications Of MATLAB Ordinary Differential Equations (ODE
Applications Of MATLAB  Ordinary Differential Equations (ODEApplications Of MATLAB  Ordinary Differential Equations (ODE
Applications Of MATLAB Ordinary Differential Equations (ODEJustin Knight
 
Computational techniques
Computational techniquesComputational techniques
Computational techniquesRafi Dar
 
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docxCALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docxRAHUL126667
 
numericalmethods.pdf
numericalmethods.pdfnumericalmethods.pdf
numericalmethods.pdfShailChettri
 
Mit18 330 s12_chapter5
Mit18 330 s12_chapter5Mit18 330 s12_chapter5
Mit18 330 s12_chapter5CAALAAA
 
Complex Variables and Numerical Methods
Complex Variables and Numerical MethodsComplex Variables and Numerical Methods
Complex Variables and Numerical MethodsDhrumit Patel
 
Introduction to Differential Equations
Introduction to Differential EquationsIntroduction to Differential Equations
Introduction to Differential EquationsVishvaraj Chauhan
 
Episode 50 : Simulation Problem Solution Approaches Convergence Techniques S...
Episode 50 :  Simulation Problem Solution Approaches Convergence Techniques S...Episode 50 :  Simulation Problem Solution Approaches Convergence Techniques S...
Episode 50 : Simulation Problem Solution Approaches Convergence Techniques S...SAJJAD KHUDHUR ABBAS
 
MATLAB ODE
MATLAB ODEMATLAB ODE
MATLAB ODEKris014
 
Trapezoidal Method IN Numerical Analysis
Trapezoidal Method IN  Numerical AnalysisTrapezoidal Method IN  Numerical Analysis
Trapezoidal Method IN Numerical AnalysisMostafijur Rahman
 
Maths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K MukhopadhyayMaths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K MukhopadhyayDr. Asish K Mukhopadhyay
 
Numerical Analysis and Its application to Boundary Value Problems
Numerical Analysis and Its application to Boundary Value ProblemsNumerical Analysis and Its application to Boundary Value Problems
Numerical Analysis and Its application to Boundary Value ProblemsGobinda Debnath
 
Initial value problems
Initial value problemsInitial value problems
Initial value problemsAli Jan Hasan
 

Ähnlich wie Es272 ch7 (20)

Applications Of MATLAB Ordinary Differential Equations (ODE
Applications Of MATLAB  Ordinary Differential Equations (ODEApplications Of MATLAB  Ordinary Differential Equations (ODE
Applications Of MATLAB Ordinary Differential Equations (ODE
 
Computational techniques
Computational techniquesComputational techniques
Computational techniques
 
Term project
Term projectTerm project
Term project
 
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docxCALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
 
numericalmethods.pdf
numericalmethods.pdfnumericalmethods.pdf
numericalmethods.pdf
 
Euler Method
Euler MethodEuler Method
Euler Method
 
Mit18 330 s12_chapter5
Mit18 330 s12_chapter5Mit18 330 s12_chapter5
Mit18 330 s12_chapter5
 
Maths digital text
Maths digital textMaths digital text
Maths digital text
 
Calc 6.1a
Calc 6.1aCalc 6.1a
Calc 6.1a
 
Computational Dynamics edited
Computational Dynamics editedComputational Dynamics edited
Computational Dynamics edited
 
Complex Variables and Numerical Methods
Complex Variables and Numerical MethodsComplex Variables and Numerical Methods
Complex Variables and Numerical Methods
 
Introduction to Differential Equations
Introduction to Differential EquationsIntroduction to Differential Equations
Introduction to Differential Equations
 
Calculus
CalculusCalculus
Calculus
 
Episode 50 : Simulation Problem Solution Approaches Convergence Techniques S...
Episode 50 :  Simulation Problem Solution Approaches Convergence Techniques S...Episode 50 :  Simulation Problem Solution Approaches Convergence Techniques S...
Episode 50 : Simulation Problem Solution Approaches Convergence Techniques S...
 
Ijmet 10 01_021
Ijmet 10 01_021Ijmet 10 01_021
Ijmet 10 01_021
 
MATLAB ODE
MATLAB ODEMATLAB ODE
MATLAB ODE
 
Trapezoidal Method IN Numerical Analysis
Trapezoidal Method IN  Numerical AnalysisTrapezoidal Method IN  Numerical Analysis
Trapezoidal Method IN Numerical Analysis
 
Maths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K MukhopadhyayMaths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K Mukhopadhyay
 
Numerical Analysis and Its application to Boundary Value Problems
Numerical Analysis and Its application to Boundary Value ProblemsNumerical Analysis and Its application to Boundary Value Problems
Numerical Analysis and Its application to Boundary Value Problems
 
Initial value problems
Initial value problemsInitial value problems
Initial value problems
 

Mehr von Batuhan Yıldırım (10)

Es272 ch6
Es272 ch6Es272 ch6
Es272 ch6
 
Es272 ch5b
Es272 ch5bEs272 ch5b
Es272 ch5b
 
Es272 ch5a
Es272 ch5aEs272 ch5a
Es272 ch5a
 
Es272 ch4b
Es272 ch4bEs272 ch4b
Es272 ch4b
 
Es272 ch4a
Es272 ch4aEs272 ch4a
Es272 ch4a
 
Es272 ch1
Es272 ch1Es272 ch1
Es272 ch1
 
Es272 ch0
Es272 ch0Es272 ch0
Es272 ch0
 
Es272 ch3b
Es272 ch3bEs272 ch3b
Es272 ch3b
 
Es272 ch3a
Es272 ch3aEs272 ch3a
Es272 ch3a
 
Es272 ch2
Es272 ch2Es272 ch2
Es272 ch2
 

Kürzlich hochgeladen

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Es272 ch7

  • 1. Part 7: Ordinary Differential Equations – – – – – Runge-Kutta Methods Euler’s Method Heun’s Method Midpoint method Systems of Equations
  • 2. Runge-Kutta Methods  We want to solve an ordinary differential equation of the form: y ' dy f ( x, y ) dx  The general approach of the solution is in the form of: (new value)=(old value) + (slope) x (step size)  All of the one-step methods under this general category are called RungeKutta methods. > Euler’s method > Heun’s method > Midpoint method  The differences in these methods are in the way (slope) is defined. Slope= yi xi xi 1 1 yi h
  • 3. Euler’s Method  Simplest way of approximating the slope is in the form of first derivative. Apply forward scheme finite difference for the starting point: y yi ' yi 1 h predicted f ( xi , yi ) yi Then, yi 1 yi f ( xi , y i ) h Euler’s method formula where f(xi, yi) is calculated from the initial condition. 1 true yi xi xi 1  That is the slope at the beginning is approximated as the slope over the entire interval.  As in the forward scheme finite difference method, error for this approximation is O(h).
  • 4. EX: Use Euler’s method to solve dy 2x 3 12 x 2 20 x 8 .5 dx from x=0 to x=2 with a step size of 0.5. The initial condition at x=0 is y=1. Differential equation: f ( x , y ) Using Euler’s formula: y ( 0 .5 ) y (0) f ( 0 ,1) 0 . 5 2x 3 12 x 5 . 25 2 20 x t 8 .5 63 . 1 % Second step: y (1) y ( 0 .5 ) f ( 0 . 5,5 . 25 ) 0 . 5 5 . 875 t 95 . 8 % Other steps: y (1 . 5 ) 5 . 1250 y ( 2 .0 ) 4 . 5000 t t 131 % 125 . 0 % Error can be reduced by using a smaller step size (h). Considering that Euler’s method has an error O(h), halving the step size will halve the error.
  • 5. Heun’s Method  It is an improvement of Euler’s method.  Improve the slope of the interval by averaging derivatives at the starting and end points. Slope=f(xi+1’ yi+10) Slope=[f(xi’ yi)+f(xi+1’ yi+10)]/2 Slope=f(xi’ yi) xi Predictor xi 1 xi Corrector xi 1
  • 6. Approximate the slope at the starting point using Euler’s method y ' f ( x, y ) Extrapolate linearly to find y at the end point: 0 yi yi 1 f ( xi , y i ) h standard Euler method stops here. This intermediate solution (predictor) is used to calculate the slope at the end point: ' 0 yi f ( xi 1 , yi 1 ) 1 Calculate average of the two slopes at the starting and end points: ' ' yi ' y yi 1 2 Use this slope to re-calculate y value at the end point (corrector): ' yi 1 yi yh
  • 7. 0 Predictor: Corrector: yi yi 1 yi 1 yi f ( xi , y i ) h f ( xi , y i ) 0 f ( xi 1 , y i 1 ) h Heun’s method 2  Corrector equation involves yi+1 on both sides, which means that it can be applied iteratively for the end point (i.e., older approximation can be used iteratively to calculate a new approximation).  The iteration does not necessarily converge to the true solution but approaches a solution with a finite truncation error.  The method is accurate to O(h2).(compare to O(h) accuracy of Euler’s method).
  • 8. EX: Use Heun’s method to numerically solve the following ODE y ' 4e 0 .8 x 0 .5 y from x=0 to x=4 with a step size of h=1. Initial condition is (0,2). Calculate the slope at the starting point (x=0): ' y0 4e 0 0 .5 ( 2 ) 3 Apply Euler’s (predictor) formula to evaluate y10 0 y1 2 3 (1) 5 t 25 . 3 % Calculate slope at the end point (x=1) ' 0 y1 f ( x1 , y 1 ) 4e 0 . 8 (1 ) 0 .5 (5 ) Calculate average of the two slopes: ' y 3 6 . 401164 2 4 . 701082 6 . 402164 Euler’s method
  • 9. Use the corrector formula to calculate the new prediction at x=1: y1 2 4 . 701082 (1) 6 . 701082 t 8 . 18 % Above is based on a single iteration at y1. Apply another iteration to refine the predictor: y1 2 [3 4e 0 . 8 (1 ) 0 . 5 ( 6 . 701082 )] 6 . 275811 t 1 . 31 % 6 . 382129 t 3 . 03 % 2 Further correction: y1 2 [3 4e 0 . 8 (1 ) Results for all the points from x=0 to x=4: (15 iterations at each point) 0 . 5 ( 6 . 275811 )] 2 x y (true) y (Heun) 0 2.0000000 2.0000000 0.00 1 6.1946314 6.360866 2.68 2 14.843922 15.302237 3.09 3 33.677172 34.743276 3.17 4 75.338963 77.735096 3.18 t(%)
  • 10. Midpoint Method  It is another improvement of Euler’s method.  Approximate y at the midpoint of the interval, and use it for the average slope of the entire interval. Slope=f(xi+1/2’ yi+1/2) Slope=f(xi+1/2’ yi+1/2) xi xi yi 1/ 2 yi f ( xi , yi ) Predictor xi 1/ 2 h 2 yi 1 yi f ( xi 1/ 2 Corrector xi , yi 1 1/ 2 )h
  • 11.  No iteration can be made for the corrector.  Just as the centered difference is superior to forward or backward difference schemes, midpoint is superior to Euler’s method in the same manner. Euler’s method Midpoint method O(h) O(h2) truncation error Summary:  All the three methods, Euler’s, Heun’s (without iteration), and midpoint methods, mentioned so far are under the general category of one-step approaches called Runge-Kutta methods.  Heun’s and midpoint methods are generally superior to Euler’s method, even though they require somewhat more calculations.
  • 12. Systems of Equations  Problems requiring the solution of a system of ODE’s are very common in engineering applications. dy 1 dx dy 2 dx f 1 ( x , y 1 , y 2 ,..., y n ) f 2 ( x , y 1 , y 2 ,..., y n ) .... dy n dx n- initial conditions need to be known at the starting value of x f n ( x , y 1 , y 2 ,..., y n ) Euler’s Method:  Simply apply Euler’s method for each equation at each step.  Strcictly apply the one-step Euler’s formula for every equation before proceeding to the next-step (i.e., do not update any variable during a single step).
  • 13. EX: Solve the following system of ODEs using Euler’s method. dy 1 dy 2 0 .5 y1 dx dx 4 0 .3 y 2 0 .1 y1 Assume that for x=0, y1=4, and y2=6. Integrate to x=2 with a step size h=0.5. Apply Euler’s method: y1 ( 0 . 5 ) 4 y 2 ( 0 .5 ) 6 0 .5 ( 4 ) 0 .5 4 0 .3( 6 ) 3 0 . 1( 4 ) 0 . 5 6 .9 Other points are calculated in the same fashion. Results to x=2 are below: x y1 y2 0 4 6 0.5 3 6.9 1.0 2.25 7.715 1.5 1.6875 8.44525 2.0 1.265625 9.094087