SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Runge kutta method -by Prof.Prashant Goad(R.C.Patel Institute of Technology,...
Runge  kutta method -by Prof.Prashant Goad(R.C.Patel Institute of Technology,...Runge  kutta method -by Prof.Prashant Goad(R.C.Patel Institute of Technology,...
Runge kutta method -by Prof.Prashant Goad(R.C.Patel Institute of Technology,...Prashant Goad
 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equationsAhmed Haider
 
Runge Kutta Method
Runge Kutta Method Runge Kutta Method
Runge Kutta Method Bhavik Vashi
 
Numerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen valuesNumerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen valuesDr. Nirav Vyas
 
Euler and improved euler method
Euler and improved euler methodEuler and improved euler method
Euler and improved euler methodSohaib Butt
 
Fundamentals of Finite Difference Methods
Fundamentals of Finite Difference MethodsFundamentals of Finite Difference Methods
Fundamentals of Finite Difference Methods1rj
 
Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1Muhammad Waqas
 
application of first order ordinary Differential equations
application of first order ordinary Differential equationsapplication of first order ordinary Differential equations
application of first order ordinary Differential equationsEmdadul Haque Milon
 
Presentation on application of numerical method in our life
Presentation on application of numerical method in our lifePresentation on application of numerical method in our life
Presentation on application of numerical method in our lifeManish Kumar Singh
 
Newton-Raphson Method
Newton-Raphson MethodNewton-Raphson Method
Newton-Raphson MethodJigisha Dabhi
 
Partial differential equations
Partial differential equationsPartial differential equations
Partial differential equationsaman1894
 
Integration in the complex plane
Integration in the complex planeIntegration in the complex plane
Integration in the complex planeAmit Amola
 
Fourier series Introduction
Fourier series IntroductionFourier series Introduction
Fourier series IntroductionRizwan Kazi
 
shooting method with Range kutta method
shooting method with Range kutta methodshooting method with Range kutta method
shooting method with Range kutta methodSetuThacker
 
Partial Differentiation & Application
Partial Differentiation & Application Partial Differentiation & Application
Partial Differentiation & Application Yana Qlah
 

Tendances (20)

Runge kutta method -by Prof.Prashant Goad(R.C.Patel Institute of Technology,...
Runge  kutta method -by Prof.Prashant Goad(R.C.Patel Institute of Technology,...Runge  kutta method -by Prof.Prashant Goad(R.C.Patel Institute of Technology,...
Runge kutta method -by Prof.Prashant Goad(R.C.Patel Institute of Technology,...
 
Euler and runge kutta method
Euler and runge kutta methodEuler and runge kutta method
Euler and runge kutta method
 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equations
 
Runge Kutta Method
Runge Kutta Method Runge Kutta Method
Runge Kutta Method
 
Runge Kutta Method
Runge Kutta MethodRunge Kutta Method
Runge Kutta Method
 
Numerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen valuesNumerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen values
 
Power method
Power methodPower method
Power method
 
Euler and improved euler method
Euler and improved euler methodEuler and improved euler method
Euler and improved euler method
 
Fundamentals of Finite Difference Methods
Fundamentals of Finite Difference MethodsFundamentals of Finite Difference Methods
Fundamentals of Finite Difference Methods
 
Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1
 
application of first order ordinary Differential equations
application of first order ordinary Differential equationsapplication of first order ordinary Differential equations
application of first order ordinary Differential equations
 
Presentation on application of numerical method in our life
Presentation on application of numerical method in our lifePresentation on application of numerical method in our life
Presentation on application of numerical method in our life
 
Taylor series
Taylor seriesTaylor series
Taylor series
 
Newton-Raphson Method
Newton-Raphson MethodNewton-Raphson Method
Newton-Raphson Method
 
Partial differential equations
Partial differential equationsPartial differential equations
Partial differential equations
 
Integration in the complex plane
Integration in the complex planeIntegration in the complex plane
Integration in the complex plane
 
Fourier series Introduction
Fourier series IntroductionFourier series Introduction
Fourier series Introduction
 
shooting method with Range kutta method
shooting method with Range kutta methodshooting method with Range kutta method
shooting method with Range kutta method
 
Taylors series
Taylors series Taylors series
Taylors series
 
Partial Differentiation & Application
Partial Differentiation & Application Partial Differentiation & Application
Partial Differentiation & Application
 

En vedette

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
 

En vedette (20)

Eulermethod2
Eulermethod2Eulermethod2
Eulermethod2
 
Unit vi
Unit viUnit vi
Unit vi
 
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
 

Similaire à 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
 
Initial value problems
Initial value problemsInitial value problems
Initial value problemsAli Jan Hasan
 

Similaire à 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
 
Initial value problems
Initial value problemsInitial value problems
Initial value problems
 
Matlab lab.pdf
Matlab lab.pdfMatlab lab.pdf
Matlab lab.pdf
 

Plus de 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
 

Dernier

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Dernier (20)

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

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