SlideShare a Scribd company logo
1 of 27
Introduction to Numerical Methods for Differential
                   Equations
                   The Euler Method


                  Matthew Henderson

              matthew.james.henderson@gmail.com

                   21 December, 2011
Overview




1   Initial Value Problems


2   Approximate Solutions of Initial Value Problems


3   The Euler Method




    Matthew Henderson ()      Numerical Methods       21 December, 2011   2 / 15
An Initial Value Problem


Definition
An initial value problem (IVP) consists of an ordinary differential
equation along with an initial condition.




   Matthew Henderson ()       Numerical Methods         21 December, 2011   3 / 15
An Initial Value Problem


Definition
An initial value problem (IVP) consists of an ordinary differential
equation along with an initial condition.

Example
                          y = 2(x + 3) − y,        y(−1) = 3                       (1)




   Matthew Henderson ()            Numerical Methods           21 December, 2011    3 / 15
An Initial Value Problem


Definition
An initial value problem (IVP) consists of an ordinary differential
equation along with an initial condition.

Example
                          y = 2(x + 3) − y,        y(−1) = 3                       (1)

Definition
A solution is a function y(x) which satisfies both the ODE and the
initial condition.



   Matthew Henderson ()            Numerical Methods           21 December, 2011    3 / 15
The Solution


The IVP (1) has a unique solution:
                          y = 2(x + 2) + e−x−1                            (2)

Function y satisfies the ODE:
                            y = 2 − e−x−1


              2(x + 3) − y = 2(x + 3) − 2(x + 2) + e−x−1
                          = 2x + 6 − 2x − 4 − e−x−1
                          = 2 − e−x−1



   Matthew Henderson ()       Numerical Methods       21 December, 2011    4 / 15
The Solution


The IVP (1) has a unique solution:
                               y = 2(x + 2) + e−x−1                          (2)

Function y also satisfies the initial condition:

                          y(−1) = 2(−1 + 2) + e−(−1)−1
                                = 2(1) + e1−1
                                = 2 + e0
                                = 3




   Matthew Henderson ()            Numerical Methods     21 December, 2011    4 / 15
A Plot of the Solution

                                      y
                                 10
            y =2(x +2) + e−x−1
                                  8

                                  6

                                  4

                                  2

                                                                     x
       -3           -2    -1                    1    2   3

   Matthew Henderson ()          Numerical Methods       21 December, 2011   5 / 15
A Plot of the Solution?

                                    y
                               10

                                8

                                6

                                4

                                2

                                                                   x
       -3           -2    -1                  1    2   3

   Matthew Henderson ()        Numerical Methods       21 December, 2011   6 / 15
The Euler Method



Definition
Given an IVP of the form:

                          y = f(x, y),       y(a) = c




   Matthew Henderson ()         Numerical Methods       21 December, 2011   7 / 15
The Euler Method



Definition
Given an IVP of the form:

                           y = f(x, y),       y(a) = c

To find the approximate value of y(x + h) for some small value of h:

                          y(x + h) = y(x) + hf(x, y)                         (3)




   Matthew Henderson ()          Numerical Methods       21 December, 2011    7 / 15
The Euler Method


Example
Going back to our example from before:

                          y = 2(x + 3) − y,        y(−1) = 3




   Matthew Henderson ()            Numerical Methods           21 December, 2011   8 / 15
The Euler Method


Example
Going back to our example from before:

                           y = 2(x + 3) − y,        y(−1) = 3

In this case f(x, y) = 2(x + 3) − y.




    Matthew Henderson ()            Numerical Methods           21 December, 2011   8 / 15
The Euler Method


Example
Going back to our example from before:

                           y = 2(x + 3) − y,        y(−1) = 3

In this case f(x, y) = 2(x + 3) − y.
Put h = 0.4, x = −1.0 and y = 3.0 into (3):




    Matthew Henderson ()            Numerical Methods           21 December, 2011   8 / 15
The Euler Method


Example
Going back to our example from before:

                           y = 2(x + 3) − y,        y(−1) = 3

In this case f(x, y) = 2(x + 3) − y.
Put h = 0.4, x = −1.0 and y = 3.0 into (3):

               y(−1.0 + 0.4) = y(−1.0) + 0.4f(−1.0, 3.0)




    Matthew Henderson ()            Numerical Methods           21 December, 2011   8 / 15
The Euler Method


Example
Going back to our example from before:

                             y = 2(x + 3) − y,         y(−1) = 3

In this case f(x, y) = 2(x + 3) − y.
Put h = 0.4, x = −1.0 and y = 3.0 into (3):

               y(−1.0 + 0.4) = y(−1.0) + 0.4f(−1.0, 3.0)
                           y(−0.6) = 3.0 + 0.4(2(−1.0 + 3.0) − 3.0)




    Matthew Henderson ()               Numerical Methods           21 December, 2011   8 / 15
The Euler Method


Example
Going back to our example from before:

                             y = 2(x + 3) − y,         y(−1) = 3

In this case f(x, y) = 2(x + 3) − y.
Put h = 0.4, x = −1.0 and y = 3.0 into (3):

               y(−1.0 + 0.4) = y(−1.0) + 0.4f(−1.0, 3.0)
                           y(−0.6) = 3.0 + 0.4(2(−1.0 + 3.0) − 3.0)
                                    = 3.0 + 0.4(4 − 3.0)




    Matthew Henderson ()               Numerical Methods           21 December, 2011   8 / 15
The Euler Method


Example
Going back to our example from before:

                             y = 2(x + 3) − y,         y(−1) = 3

In this case f(x, y) = 2(x + 3) − y.
Put h = 0.4, x = −1.0 and y = 3.0 into (3):

               y(−1.0 + 0.4) = y(−1.0) + 0.4f(−1.0, 3.0)
                           y(−0.6) = 3.0 + 0.4(2(−1.0 + 3.0) − 3.0)
                                    = 3.0 + 0.4(4 − 3.0)
                                    = 3.4



    Matthew Henderson ()               Numerical Methods           21 December, 2011   8 / 15
The Euler Method


We can compute more values in the same way . . .
x = −0.6 and y = 3.4:

                y(−0.6 + 0.4) = 3.4 + 0.4(2(−0.6 + 3) − 3.4)
                          y(−0.2) = 3.4 + 0.4(4.8 − 3.4)
                                   = 3.96




   Matthew Henderson ()              Numerical Methods     21 December, 2011   9 / 15
The Euler Method


We can compute more values in the same way . . .
x = −0.6 and y = 3.4:

                y(−0.6 + 0.4) = 3.4 + 0.4(2(−0.6 + 3) − 3.4)
                          y(−0.2) = 3.4 + 0.4(4.8 − 3.4)
                                   = 3.96

 x = −0.2 and y = 3.96:

              y(−0.2 + 0.4) = 3.96 + 0.4(2(−0.2 + 3) − 3.96)
                          y(0.2) = bluey + 0.4(5.6 − 3.96)
                                  = 4.616



   Matthew Henderson ()              Numerical Methods       21 December, 2011   9 / 15
The Euler Method

We continue to construct a table row-by-row:

                            x        y           hf(x, y)
                          -1.0   3.000000        0.400000
                          -0.6                   0.560000
                          -0.2   3.960000        0.656000
                           0.2   4.616000        0.713600
                           0.6   5.329600        0.748160
                           1.0   6.077760        0.768896
                           1.4   6.846656        0.781338
                           1.8   7.627994        0.788803
                           2.2   8.416796        0.793281
                           2.6   9.210078        0.795969
                           3.0   10.00605        0.797581


   Matthew Henderson ()           Numerical Methods         21 December, 2011   10 / 15
The Euler Method

We continue to construct a table row-by-row:

                            x        y           hf(x, y)
                          -1.0   3.000000        0.400000
                          -0.6   3.400000        0.560000
                          -0.2   3.960000        0.656000
                           0.2   4.616000        0.713600
                           0.6   5.329600        0.748160
                           1.0   6.077760        0.768896
                           1.4   6.846656        0.781338
                           1.8   7.627994        0.788803
                           2.2   8.416796        0.793281
                           2.6   9.210078        0.795969
                           3.0   10.00605        0.797581


   Matthew Henderson ()           Numerical Methods         21 December, 2011   10 / 15
The Euler Method: Comparison
Now when we plot those values we get something that begins to look
like our exact solution, albeit only on the interval [−1, 3].
                                             y
                                       10
                  y =2(x +2) + e−x−1
                                         8

                                         6

                                         4

                                         2

                                                                          x
             -3           -2    -1                   1     2   3

   Matthew Henderson ()                Numerical Methods           21 December, 2011   11 / 15
The Euler Method: Comparison

The numbers which we computed for y are not exactly correct but the
errors involved are quite small:

                       x    y (approx)    y (exact)      Error
                     -1.0    3.000000      3.000000    0.000000
                     -0.6    3.400000      3.470320    0.070320
                     -0.2    3.960000      4.049329    0.089329
                      0.2    4.616000      4.701194    0.085194
                      0.6    5.329600      5.401896    0.072296
                      1.0    6.077760      6.135335    0.057575
                      1.4    6.846656      6.890718    0.044062
                      1.8    7.627994      7.660810    0.032816
                      2.2    8.416796      8.440762    0.023966
                      2.6    9.210078      9.227324    0.017246
                      3.0    10.00605     10.018316    0.012269

   Matthew Henderson ()            Numerical Methods              21 December, 2011   12 / 15
The Euler Method: Where does it come from?

Given an initial value problem of the form:

                           y = f(x, y),       y(a) = c

we want to find the approximate value of y(b) for some b > a. From
the definition of derivative:
                                      y(x + h) − y(x)
                          y (x) ≈
                                             h
for h > 0 given and small. So,

                                      y(x + h) − y(x)
                          f(x, y) ≈
                                             h
which gives
                          y(x + h) ≈ y(x) + hf(x, y)

   Matthew Henderson ()          Numerical Methods       21 December, 2011   13 / 15
The Euler Method: Why does it work?



                   y =2(x +2) + e−x−1     10

                                           8

                                           6

                                           4

                                           2

              -3          -2     -1                     1   2   3



   Matthew Henderson ()                 Numerical Methods       21 December, 2011   14 / 15
The End

Merry Christmas!




   Matthew Henderson ()   Numerical Methods   21 December, 2011   15 / 15

More Related Content

What's hot

Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equations
Ahmed Haider
 
Week 3 [compatibility mode]
Week 3 [compatibility mode]Week 3 [compatibility mode]
Week 3 [compatibility mode]
Hazrul156
 

What's hot (20)

Unit vi
Unit viUnit vi
Unit vi
 
DIFFERENTIAL EQUATION
DIFFERENTIAL EQUATIONDIFFERENTIAL EQUATION
DIFFERENTIAL EQUATION
 
Euler and runge kutta method
Euler and runge kutta methodEuler and runge kutta method
Euler and runge kutta method
 
Euler and improved euler method
Euler and improved euler methodEuler and improved euler method
Euler and improved euler method
 
presentation on Euler and Modified Euler method ,and Fitting of curve
presentation on Euler and Modified Euler method ,and Fitting of curve presentation on Euler and Modified Euler method ,and Fitting of curve
presentation on Euler and Modified Euler method ,and Fitting of curve
 
Maths Notes - Differential Equations
Maths Notes - Differential EquationsMaths Notes - Differential Equations
Maths Notes - Differential Equations
 
Ep 5512 lecture-02
Ep 5512 lecture-02Ep 5512 lecture-02
Ep 5512 lecture-02
 
Optimal Finite Difference Grids
Optimal Finite Difference GridsOptimal Finite Difference Grids
Optimal Finite Difference Grids
 
Properties of bivariate and conditional Gaussian PDFs
Properties of bivariate and conditional Gaussian PDFsProperties of bivariate and conditional Gaussian PDFs
Properties of bivariate and conditional Gaussian PDFs
 
Ch05 2
Ch05 2Ch05 2
Ch05 2
 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equations
 
Ch02 7
Ch02 7Ch02 7
Ch02 7
 
Methods of variation of parameters- advance engineering mathe mathematics
Methods of variation of parameters- advance engineering mathe mathematicsMethods of variation of parameters- advance engineering mathe mathematics
Methods of variation of parameters- advance engineering mathe mathematics
 
Persamaan Differensial Biasa 2014
Persamaan Differensial Biasa 2014 Persamaan Differensial Biasa 2014
Persamaan Differensial Biasa 2014
 
Sistem pertidaksamaan kuadrat 2 variabel
Sistem pertidaksamaan kuadrat 2 variabelSistem pertidaksamaan kuadrat 2 variabel
Sistem pertidaksamaan kuadrat 2 variabel
 
Top Schools in delhi NCR
Top Schools in delhi NCRTop Schools in delhi NCR
Top Schools in delhi NCR
 
introduction to differential equations
introduction to differential equationsintroduction to differential equations
introduction to differential equations
 
Week 3 [compatibility mode]
Week 3 [compatibility mode]Week 3 [compatibility mode]
Week 3 [compatibility mode]
 
Higher Order Differential Equation
Higher Order Differential EquationHigher Order Differential Equation
Higher Order Differential Equation
 
Study Material Numerical Differentiation and Integration
Study Material Numerical Differentiation and IntegrationStudy Material Numerical Differentiation and Integration
Study Material Numerical Differentiation and Integration
 

Viewers also liked

Eulermethod3
Eulermethod3Eulermethod3
Eulermethod3
stellajoh
 
Hpcc euler
Hpcc eulerHpcc euler
Hpcc euler
rhuzefa
 
Euler method notes sb
Euler method notes sbEuler method notes sb
Euler method notes sb
janetvmiller
 
Successive iteration method for reconstruction of missing data
Successive iteration method for reconstruction of missing dataSuccessive iteration method for reconstruction of missing data
Successive iteration method for reconstruction of missing data
IAEME Publication
 
Interactives Methods
Interactives MethodsInteractives Methods
Interactives Methods
UIS
 

Viewers also liked (20)

Numerical Methods
Numerical MethodsNumerical Methods
Numerical Methods
 
Higher Differential Equation
Higher Differential EquationHigher Differential Equation
Higher Differential Equation
 
Eulermethod3
Eulermethod3Eulermethod3
Eulermethod3
 
Hpcc euler
Hpcc eulerHpcc euler
Hpcc euler
 
Day 4 examples
Day 4 examplesDay 4 examples
Day 4 examples
 
Euler method notes sb
Euler method notes sbEuler method notes sb
Euler method notes sb
 
10 09
10 0910 09
10 09
 
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
 
Calculus II - 13
Calculus II - 13Calculus II - 13
Calculus II - 13
 
Successive iteration method for reconstruction of missing data
Successive iteration method for reconstruction of missing dataSuccessive iteration method for reconstruction of missing data
Successive iteration method for reconstruction of missing data
 
Perturbation methods last
Perturbation methods lastPerturbation methods last
Perturbation methods last
 
Euler Method using MATLAB
Euler Method using MATLABEuler Method using MATLAB
Euler Method using MATLAB
 
Differential equations intro
Differential equations introDifferential equations intro
Differential equations intro
 
Interactives Methods
Interactives MethodsInteractives Methods
Interactives Methods
 
metode euler
metode eulermetode euler
metode euler
 
Recupero Crediti: fattori chiave per gestirlo al meglio
Recupero Crediti: fattori chiave per gestirlo al meglioRecupero Crediti: fattori chiave per gestirlo al meglio
Recupero Crediti: fattori chiave per gestirlo al meglio
 
Calc 6.1b
Calc 6.1bCalc 6.1b
Calc 6.1b
 
AP Calculus AB March 26, 2009
AP Calculus AB March 26, 2009AP Calculus AB March 26, 2009
AP Calculus AB March 26, 2009
 
Ordinary differential equation
Ordinary differential equationOrdinary differential equation
Ordinary differential equation
 

Similar to Introduction to Numerical Methods for Differential Equations

1.  Which of the following is the correct matrix representation .docx
1.  Which of the following is the correct matrix representation .docx1.  Which of the following is the correct matrix representation .docx
1.  Which of the following is the correct matrix representation .docx
jackiewalcutt
 
Solving Linear Equations
Solving Linear EquationsSolving Linear Equations
Solving Linear Equations
taco40
 

Similar to Introduction to Numerical Methods for Differential Equations (20)

Taller 2
Taller 2 Taller 2
Taller 2
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Section2 stochastic
Section2 stochasticSection2 stochastic
Section2 stochastic
 
Class 3.pdf
Class 3.pdfClass 3.pdf
Class 3.pdf
 
1.  Which of the following is the correct matrix representation .docx
1.  Which of the following is the correct matrix representation .docx1.  Which of the following is the correct matrix representation .docx
1.  Which of the following is the correct matrix representation .docx
 
Linear equations in Two variables
Linear equations in Two variablesLinear equations in Two variables
Linear equations in Two variables
 
A family of implicit higher order methods for the numerical integration of se...
A family of implicit higher order methods for the numerical integration of se...A family of implicit higher order methods for the numerical integration of se...
A family of implicit higher order methods for the numerical integration of se...
 
Unit 1 Operation on signals
Unit 1  Operation on signalsUnit 1  Operation on signals
Unit 1 Operation on signals
 
Algebra presentation on topic modulus function and polynomials
Algebra presentation on topic modulus function and polynomialsAlgebra presentation on topic modulus function and polynomials
Algebra presentation on topic modulus function and polynomials
 
Module 2 polynomial functions
Module 2   polynomial functionsModule 2   polynomial functions
Module 2 polynomial functions
 
Solving Linear Equations
Solving Linear EquationsSolving Linear Equations
Solving Linear Equations
 
sim-140907230908-phpapp01.pptx
sim-140907230908-phpapp01.pptxsim-140907230908-phpapp01.pptx
sim-140907230908-phpapp01.pptx
 
Polynomial math
Polynomial mathPolynomial math
Polynomial math
 
Week 2
Week 2 Week 2
Week 2
 
Shareena p r
Shareena p r Shareena p r
Shareena p r
 
Shareena p r
Shareena p r Shareena p r
Shareena p r
 
Digital text book
Digital text bookDigital text book
Digital text book
 
Quadratic inequality
Quadratic inequalityQuadratic inequality
Quadratic inequality
 
Interpolation.pptx
Interpolation.pptxInterpolation.pptx
Interpolation.pptx
 
Factoring Trinomials
Factoring TrinomialsFactoring Trinomials
Factoring Trinomials
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
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
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
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
Safe Software
 

Recently uploaded (20)

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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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...
 
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
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
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, ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
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
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Introduction to Numerical Methods for Differential Equations

  • 1. Introduction to Numerical Methods for Differential Equations The Euler Method Matthew Henderson matthew.james.henderson@gmail.com 21 December, 2011
  • 2. Overview 1 Initial Value Problems 2 Approximate Solutions of Initial Value Problems 3 The Euler Method Matthew Henderson () Numerical Methods 21 December, 2011 2 / 15
  • 3. An Initial Value Problem Definition An initial value problem (IVP) consists of an ordinary differential equation along with an initial condition. Matthew Henderson () Numerical Methods 21 December, 2011 3 / 15
  • 4. An Initial Value Problem Definition An initial value problem (IVP) consists of an ordinary differential equation along with an initial condition. Example y = 2(x + 3) − y, y(−1) = 3 (1) Matthew Henderson () Numerical Methods 21 December, 2011 3 / 15
  • 5. An Initial Value Problem Definition An initial value problem (IVP) consists of an ordinary differential equation along with an initial condition. Example y = 2(x + 3) − y, y(−1) = 3 (1) Definition A solution is a function y(x) which satisfies both the ODE and the initial condition. Matthew Henderson () Numerical Methods 21 December, 2011 3 / 15
  • 6. The Solution The IVP (1) has a unique solution: y = 2(x + 2) + e−x−1 (2) Function y satisfies the ODE: y = 2 − e−x−1 2(x + 3) − y = 2(x + 3) − 2(x + 2) + e−x−1 = 2x + 6 − 2x − 4 − e−x−1 = 2 − e−x−1 Matthew Henderson () Numerical Methods 21 December, 2011 4 / 15
  • 7. The Solution The IVP (1) has a unique solution: y = 2(x + 2) + e−x−1 (2) Function y also satisfies the initial condition: y(−1) = 2(−1 + 2) + e−(−1)−1 = 2(1) + e1−1 = 2 + e0 = 3 Matthew Henderson () Numerical Methods 21 December, 2011 4 / 15
  • 8. A Plot of the Solution y 10 y =2(x +2) + e−x−1 8 6 4 2 x -3 -2 -1 1 2 3 Matthew Henderson () Numerical Methods 21 December, 2011 5 / 15
  • 9. A Plot of the Solution? y 10 8 6 4 2 x -3 -2 -1 1 2 3 Matthew Henderson () Numerical Methods 21 December, 2011 6 / 15
  • 10. The Euler Method Definition Given an IVP of the form: y = f(x, y), y(a) = c Matthew Henderson () Numerical Methods 21 December, 2011 7 / 15
  • 11. The Euler Method Definition Given an IVP of the form: y = f(x, y), y(a) = c To find the approximate value of y(x + h) for some small value of h: y(x + h) = y(x) + hf(x, y) (3) Matthew Henderson () Numerical Methods 21 December, 2011 7 / 15
  • 12. The Euler Method Example Going back to our example from before: y = 2(x + 3) − y, y(−1) = 3 Matthew Henderson () Numerical Methods 21 December, 2011 8 / 15
  • 13. The Euler Method Example Going back to our example from before: y = 2(x + 3) − y, y(−1) = 3 In this case f(x, y) = 2(x + 3) − y. Matthew Henderson () Numerical Methods 21 December, 2011 8 / 15
  • 14. The Euler Method Example Going back to our example from before: y = 2(x + 3) − y, y(−1) = 3 In this case f(x, y) = 2(x + 3) − y. Put h = 0.4, x = −1.0 and y = 3.0 into (3): Matthew Henderson () Numerical Methods 21 December, 2011 8 / 15
  • 15. The Euler Method Example Going back to our example from before: y = 2(x + 3) − y, y(−1) = 3 In this case f(x, y) = 2(x + 3) − y. Put h = 0.4, x = −1.0 and y = 3.0 into (3): y(−1.0 + 0.4) = y(−1.0) + 0.4f(−1.0, 3.0) Matthew Henderson () Numerical Methods 21 December, 2011 8 / 15
  • 16. The Euler Method Example Going back to our example from before: y = 2(x + 3) − y, y(−1) = 3 In this case f(x, y) = 2(x + 3) − y. Put h = 0.4, x = −1.0 and y = 3.0 into (3): y(−1.0 + 0.4) = y(−1.0) + 0.4f(−1.0, 3.0) y(−0.6) = 3.0 + 0.4(2(−1.0 + 3.0) − 3.0) Matthew Henderson () Numerical Methods 21 December, 2011 8 / 15
  • 17. The Euler Method Example Going back to our example from before: y = 2(x + 3) − y, y(−1) = 3 In this case f(x, y) = 2(x + 3) − y. Put h = 0.4, x = −1.0 and y = 3.0 into (3): y(−1.0 + 0.4) = y(−1.0) + 0.4f(−1.0, 3.0) y(−0.6) = 3.0 + 0.4(2(−1.0 + 3.0) − 3.0) = 3.0 + 0.4(4 − 3.0) Matthew Henderson () Numerical Methods 21 December, 2011 8 / 15
  • 18. The Euler Method Example Going back to our example from before: y = 2(x + 3) − y, y(−1) = 3 In this case f(x, y) = 2(x + 3) − y. Put h = 0.4, x = −1.0 and y = 3.0 into (3): y(−1.0 + 0.4) = y(−1.0) + 0.4f(−1.0, 3.0) y(−0.6) = 3.0 + 0.4(2(−1.0 + 3.0) − 3.0) = 3.0 + 0.4(4 − 3.0) = 3.4 Matthew Henderson () Numerical Methods 21 December, 2011 8 / 15
  • 19. The Euler Method We can compute more values in the same way . . . x = −0.6 and y = 3.4: y(−0.6 + 0.4) = 3.4 + 0.4(2(−0.6 + 3) − 3.4) y(−0.2) = 3.4 + 0.4(4.8 − 3.4) = 3.96 Matthew Henderson () Numerical Methods 21 December, 2011 9 / 15
  • 20. The Euler Method We can compute more values in the same way . . . x = −0.6 and y = 3.4: y(−0.6 + 0.4) = 3.4 + 0.4(2(−0.6 + 3) − 3.4) y(−0.2) = 3.4 + 0.4(4.8 − 3.4) = 3.96 x = −0.2 and y = 3.96: y(−0.2 + 0.4) = 3.96 + 0.4(2(−0.2 + 3) − 3.96) y(0.2) = bluey + 0.4(5.6 − 3.96) = 4.616 Matthew Henderson () Numerical Methods 21 December, 2011 9 / 15
  • 21. The Euler Method We continue to construct a table row-by-row: x y hf(x, y) -1.0 3.000000 0.400000 -0.6 0.560000 -0.2 3.960000 0.656000 0.2 4.616000 0.713600 0.6 5.329600 0.748160 1.0 6.077760 0.768896 1.4 6.846656 0.781338 1.8 7.627994 0.788803 2.2 8.416796 0.793281 2.6 9.210078 0.795969 3.0 10.00605 0.797581 Matthew Henderson () Numerical Methods 21 December, 2011 10 / 15
  • 22. The Euler Method We continue to construct a table row-by-row: x y hf(x, y) -1.0 3.000000 0.400000 -0.6 3.400000 0.560000 -0.2 3.960000 0.656000 0.2 4.616000 0.713600 0.6 5.329600 0.748160 1.0 6.077760 0.768896 1.4 6.846656 0.781338 1.8 7.627994 0.788803 2.2 8.416796 0.793281 2.6 9.210078 0.795969 3.0 10.00605 0.797581 Matthew Henderson () Numerical Methods 21 December, 2011 10 / 15
  • 23. The Euler Method: Comparison Now when we plot those values we get something that begins to look like our exact solution, albeit only on the interval [−1, 3]. y 10 y =2(x +2) + e−x−1 8 6 4 2 x -3 -2 -1 1 2 3 Matthew Henderson () Numerical Methods 21 December, 2011 11 / 15
  • 24. The Euler Method: Comparison The numbers which we computed for y are not exactly correct but the errors involved are quite small: x y (approx) y (exact) Error -1.0 3.000000 3.000000 0.000000 -0.6 3.400000 3.470320 0.070320 -0.2 3.960000 4.049329 0.089329 0.2 4.616000 4.701194 0.085194 0.6 5.329600 5.401896 0.072296 1.0 6.077760 6.135335 0.057575 1.4 6.846656 6.890718 0.044062 1.8 7.627994 7.660810 0.032816 2.2 8.416796 8.440762 0.023966 2.6 9.210078 9.227324 0.017246 3.0 10.00605 10.018316 0.012269 Matthew Henderson () Numerical Methods 21 December, 2011 12 / 15
  • 25. The Euler Method: Where does it come from? Given an initial value problem of the form: y = f(x, y), y(a) = c we want to find the approximate value of y(b) for some b > a. From the definition of derivative: y(x + h) − y(x) y (x) ≈ h for h > 0 given and small. So, y(x + h) − y(x) f(x, y) ≈ h which gives y(x + h) ≈ y(x) + hf(x, y) Matthew Henderson () Numerical Methods 21 December, 2011 13 / 15
  • 26. The Euler Method: Why does it work? y =2(x +2) + e−x−1 10 8 6 4 2 -3 -2 -1 1 2 3 Matthew Henderson () Numerical Methods 21 December, 2011 14 / 15
  • 27. The End Merry Christmas! Matthew Henderson () Numerical Methods 21 December, 2011 15 / 15