Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Introduction to Numerical Methods for Differential                   Equations                   The Euler Method          ...
Overview1   Initial Value Problems2   Approximate Solutions of Initial Value Problems3   The Euler Method    Matthew Hende...
An Initial Value ProblemDefinitionAn initial value problem (IVP) consists of an ordinary differentialequation along with an ...
An Initial Value ProblemDefinitionAn initial value problem (IVP) consists of an ordinary differentialequation along with an ...
An Initial Value ProblemDefinitionAn initial value problem (IVP) consists of an ordinary differentialequation along with an ...
The SolutionThe IVP (1) has a unique solution:                          y = 2(x + 2) + e−x−1                            (2...
The SolutionThe IVP (1) has a unique solution:                               y = 2(x + 2) + e−x−1                         ...
A Plot of the Solution                                      y                                 10            y =2(x +2) + e...
A Plot of the Solution?                                    y                               10                             ...
The Euler MethodDefinitionGiven an IVP of the form:                          y = f(x, y),       y(a) = c   Matthew Henderso...
The Euler MethodDefinitionGiven an IVP of the form:                           y = f(x, y),       y(a) = cTo find the approxi...
The Euler MethodExampleGoing back to our example from before:                          y = 2(x + 3) − y,        y(−1) = 3 ...
The Euler MethodExampleGoing back to our example from before:                           y = 2(x + 3) − y,        y(−1) = 3...
The Euler MethodExampleGoing back to our example from before:                           y = 2(x + 3) − y,        y(−1) = 3...
The Euler MethodExampleGoing back to our example from before:                           y = 2(x + 3) − y,        y(−1) = 3...
The Euler MethodExampleGoing back to our example from before:                             y = 2(x + 3) − y,         y(−1) ...
The Euler MethodExampleGoing back to our example from before:                             y = 2(x + 3) − y,         y(−1) ...
The Euler MethodExampleGoing back to our example from before:                             y = 2(x + 3) − y,         y(−1) ...
The Euler MethodWe can compute more values in the same way . . .x = −0.6 and y = 3.4:                y(−0.6 + 0.4) = 3.4 +...
The Euler MethodWe can compute more values in the same way . . .x = −0.6 and y = 3.4:                y(−0.6 + 0.4) = 3.4 +...
The Euler MethodWe continue to construct a table row-by-row:                            x        y           hf(x, y)     ...
The Euler MethodWe continue to construct a table row-by-row:                            x        y           hf(x, y)     ...
The Euler Method: ComparisonNow when we plot those values we get something that begins to looklike our exact solution, alb...
The Euler Method: ComparisonThe numbers which we computed for y are not exactly correct but theerrors involved are quite s...
The Euler Method: Where does it come from?Given an initial value problem of the form:                           y = f(x, y...
The Euler Method: Why does it work?                   y =2(x +2) + e−x−1     10                                           ...
The EndMerry Christmas!   Matthew Henderson ()   Numerical Methods   21 December, 2011   15 / 15
Upcoming SlideShare
Loading in …5
×

Introduction to Numerical Methods for Differential Equations

816 views

Published on

Published in: Technology
  • Be the first to comment

Introduction to Numerical Methods for Differential Equations

  1. 1. Introduction to Numerical Methods for Differential Equations The Euler Method Matthew Henderson matthew.james.henderson@gmail.com 21 December, 2011
  2. 2. Overview1 Initial Value Problems2 Approximate Solutions of Initial Value Problems3 The Euler Method Matthew Henderson () Numerical Methods 21 December, 2011 2 / 15
  3. 3. An Initial Value ProblemDefinitionAn initial value problem (IVP) consists of an ordinary differentialequation along with an initial condition. Matthew Henderson () Numerical Methods 21 December, 2011 3 / 15
  4. 4. An Initial Value ProblemDefinitionAn initial value problem (IVP) consists of an ordinary differentialequation 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. 5. An Initial Value ProblemDefinitionAn initial value problem (IVP) consists of an ordinary differentialequation along with an initial condition.Example y = 2(x + 3) − y, y(−1) = 3 (1)DefinitionA solution is a function y(x) which satisfies both the ODE and theinitial condition. Matthew Henderson () Numerical Methods 21 December, 2011 3 / 15
  6. 6. The SolutionThe 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. 7. The SolutionThe 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. 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. 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. 10. The Euler MethodDefinitionGiven an IVP of the form: y = f(x, y), y(a) = c Matthew Henderson () Numerical Methods 21 December, 2011 7 / 15
  11. 11. The Euler MethodDefinitionGiven an IVP of the form: y = f(x, y), y(a) = cTo 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. 12. The Euler MethodExampleGoing back to our example from before: y = 2(x + 3) − y, y(−1) = 3 Matthew Henderson () Numerical Methods 21 December, 2011 8 / 15
  13. 13. The Euler MethodExampleGoing back to our example from before: y = 2(x + 3) − y, y(−1) = 3In this case f(x, y) = 2(x + 3) − y. Matthew Henderson () Numerical Methods 21 December, 2011 8 / 15
  14. 14. The Euler MethodExampleGoing back to our example from before: y = 2(x + 3) − y, y(−1) = 3In 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. 15. The Euler MethodExampleGoing back to our example from before: y = 2(x + 3) − y, y(−1) = 3In 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. 16. The Euler MethodExampleGoing back to our example from before: y = 2(x + 3) − y, y(−1) = 3In 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. 17. The Euler MethodExampleGoing back to our example from before: y = 2(x + 3) − y, y(−1) = 3In 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. 18. The Euler MethodExampleGoing back to our example from before: y = 2(x + 3) − y, y(−1) = 3In 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. 19. The Euler MethodWe 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. 20. The Euler MethodWe 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. 21. The Euler MethodWe 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. 22. The Euler MethodWe 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. 23. The Euler Method: ComparisonNow when we plot those values we get something that begins to looklike 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. 24. The Euler Method: ComparisonThe numbers which we computed for y are not exactly correct but theerrors 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. 25. The Euler Method: Where does it come from?Given an initial value problem of the form: y = f(x, y), y(a) = cwe want to find the approximate value of y(b) for some b > a. Fromthe definition of derivative: y(x + h) − y(x) y (x) ≈ hfor h > 0 given and small. So, y(x + h) − y(x) f(x, y) ≈ hwhich gives y(x + h) ≈ y(x) + hf(x, y) Matthew Henderson () Numerical Methods 21 December, 2011 13 / 15
  26. 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. 27. The EndMerry Christmas! Matthew Henderson () Numerical Methods 21 December, 2011 15 / 15

×