SlideShare a Scribd company logo
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

PDF
Numerical Methods - Oridnary Differential Equations - 1
PDF
Numerical Methods - Oridnary Differential Equations - 2
PDF
PDF
Numerical Methods - Oridnary Differential Equations - 3
PPT
Introduction to Differential Equations
PPTX
Initial value problems
PDF
PPTX
Automobile 3rd sem aem ppt.2016
Numerical Methods - Oridnary Differential Equations - 1
Numerical Methods - Oridnary Differential Equations - 2
Numerical Methods - Oridnary Differential Equations - 3
Introduction to Differential Equations
Initial value problems
Automobile 3rd sem aem ppt.2016

What's hot (20)

PPS
Unit vi
DOCX
DIFFERENTIAL EQUATION
PPTX
Euler and runge kutta method
PPTX
Euler and improved euler method
PPTX
presentation on Euler and Modified Euler method ,and Fitting of curve
PDF
Maths Notes - Differential Equations
PDF
Ep 5512 lecture-02
KEY
Optimal Finite Difference Grids
PDF
Properties of bivariate and conditional Gaussian PDFs
PPT
Ch05 2
PPTX
Ordinary differential equations
PPT
Ch02 7
PPTX
Methods of variation of parameters- advance engineering mathe mathematics
PPT
Persamaan Differensial Biasa 2014
PDF
Sistem pertidaksamaan kuadrat 2 variabel
PPT
Top Schools in delhi NCR
PPTX
introduction to differential equations
PDF
Week 3 [compatibility mode]
PDF
Higher Order Differential Equation
PDF
Study Material Numerical Differentiation and Integration
Unit vi
DIFFERENTIAL EQUATION
Euler and runge kutta method
Euler and improved euler method
presentation on Euler and Modified Euler method ,and Fitting of curve
Maths Notes - Differential Equations
Ep 5512 lecture-02
Optimal Finite Difference Grids
Properties of bivariate and conditional Gaussian PDFs
Ch05 2
Ordinary differential equations
Ch02 7
Methods of variation of parameters- advance engineering mathe mathematics
Persamaan Differensial Biasa 2014
Sistem pertidaksamaan kuadrat 2 variabel
Top Schools in delhi NCR
introduction to differential equations
Week 3 [compatibility mode]
Higher Order Differential Equation
Study Material Numerical Differentiation and Integration
Ad

Viewers also liked (20)

PPT
Numerical Methods
PPT
Higher Differential Equation
PPTX
Eulermethod3
PDF
Hpcc euler
PDF
Day 4 examples
PDF
Euler method notes sb
PDF
PDF
DLR_DG_AZIZ_2003
PDF
AP Calculus AB March 25, 2009
KEY
Calculus II - 13
PDF
Successive iteration method for reconstruction of missing data
PPTX
Perturbation methods last
PPTX
Euler Method using MATLAB
PPTX
Differential equations intro
PPTX
Interactives Methods
 
PDF
metode euler
PPTX
Recupero Crediti: fattori chiave per gestirlo al meglio
PPT
Calc 6.1b
PDF
AP Calculus AB March 26, 2009
PPTX
Ordinary differential equation
Numerical Methods
Higher Differential Equation
Eulermethod3
Hpcc euler
Day 4 examples
Euler method notes sb
DLR_DG_AZIZ_2003
AP Calculus AB March 25, 2009
Calculus II - 13
Successive iteration method for reconstruction of missing data
Perturbation methods last
Euler Method using MATLAB
Differential equations intro
Interactives Methods
 
metode euler
Recupero Crediti: fattori chiave per gestirlo al meglio
Calc 6.1b
AP Calculus AB March 26, 2009
Ordinary differential equation
Ad

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

PPT
Top School in india
DOC
Roots of equations
PPT
Chapter 3
PDF
Chapter 3 roots of equations
PDF
Chapter 3 roots of equations
PDF
Chapter 2 roots of equations
PDF
Chapter 3 roots of equations
PDF
Raices de ecuaciones pdf
PPT
Numerical method
PDF
Numerical Method for UOG mech stu prd by Abdrehman Ahmed
PDF
104newton solution
PDF
Engr 213 midterm 1a sol 2009
PDF
Linear Differential Equations1
PDF
Euler's Method.pdf
PPTX
Euler's Method
PDF
Em06 iav
PDF
Day 12 variables on both sides fractions
KEY
0309 ch 3 day 9
PPTX
Computational mathematic
Top School in india
Roots of equations
Chapter 3
Chapter 3 roots of equations
Chapter 3 roots of equations
Chapter 2 roots of equations
Chapter 3 roots of equations
Raices de ecuaciones pdf
Numerical method
Numerical Method for UOG mech stu prd by Abdrehman Ahmed
104newton solution
Engr 213 midterm 1a sol 2009
Linear Differential Equations1
Euler's Method.pdf
Euler's Method
Em06 iav
Day 12 variables on both sides fractions
0309 ch 3 day 9
Computational mathematic

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPT
Teaching material agriculture food technology
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Cloud computing and distributed systems.
PDF
Machine learning based COVID-19 study performance prediction
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Spectroscopy.pptx food analysis technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
“AI and Expert System Decision Support & Business Intelligence Systems”
Teaching material agriculture food technology
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Cloud computing and distributed systems.
Machine learning based COVID-19 study performance prediction
Mobile App Security Testing_ A Comprehensive Guide.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectroscopy.pptx food analysis technology
Network Security Unit 5.pdf for BCA BBA.
The Rise and Fall of 3GPP – Time for a Sabbatical?
Understanding_Digital_Forensics_Presentation.pptx

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