Eulers Method MatLab Example with f t y Euler Error Analysis Local Truncation

# Eulers method matlab example with f t y euler error

• 10

This preview shows page 6 - 8 out of 10 pages.

Euler’s Method - MatLab Example with f ( t, y ) Euler Error Analysis Local Truncation Error 1 Assume that φ ( t ) solves the IVP, so φ 0 ( t ) = f ( t, φ ( t )) Use Taylor’s theorem with a remainder, then φ ( t n + h ) = φ ( t n ) + φ 0 ( t n ) h + 1 2 φ 00 ( ¯ t n ) h 2 , where ¯ t n ( t n , t n + h ) From φ being a solution of the IVP φ ( t n +1 ) = φ ( t n ) + hf ( t n , φ ( t n )) + 1 2 φ 00 ( ¯ t n ) h 2 , If y n = φ ( t n ) is the correct solution, then the Euler approximate solution at t n +1 is y * n +1 = φ ( t n ) + hf ( t n , φ ( t n )) , so the local truncation error satisfies e n +1 = φ ( t n +1 ) - y * n +1 = 1 2 φ 00 ( ¯ t n ) h 2 Joseph M. Mahaffy, h [email protected] i Lecture Notes – Numerical Methods for Differential Equations — (21/39) Introduction Euler’s Method Improved Euler’s Method Malthusian Growth Example Euler’s Method - MatLab Example with f ( t, y ) Euler Error Analysis Local Truncation Error 2 Since the local truncation error satisfies e n +1 = 1 2 φ 00 ( ¯ t n ) h 2 , then if there is a uniform bound M = max t [ a,b ] | φ 00 ( t ) | , the local error is bounded with | e n | ≤ Mh 2 2 Thus, Euler’s Method is said to have a local truncation error of order h 2 often denoted O ( h 2 ) This result allows the choice of a stepsize to keep the numerical solution within a certain tolerance, say ε , or Mh 2 2 ε or h p 2 ε/M Often difficult to estimate either | φ 00 ( t ) | or M Joseph M. Mahaffy, h [email protected] i Lecture Notes – Numerical Methods for Different — (22/39) Introduction Euler’s Method Improved Euler’s Method Malthusian Growth Example Euler’s Method - MatLab Example with f ( t, y ) Euler Error Analysis Global Truncation Other Errors The local truncation error satisfies | e n | ≤ Mh 2 / 2 This error is most significant for adaptive numerical routines where code is created to maintain a certain tolerance Global Truncation Error The more important error for the numerical routines is this error over the entire simulation Euler’s method can be shown to have a global truncation error , | E n | ≤ Kh Note error is one order less than local error , which scales proportionally with the stepsize or | E n | ≤ O ( h ) HW problem using Taylor’s series and Math induction to prove this result Joseph M. Mahaffy, h [email protected] i Lecture Notes – Numerical Methods for Differential Equations — (23/39) Introduction Euler’s Method Improved Euler’s Method Malthusian Growth Example Euler’s Method - MatLab Example with f ( t, y ) Euler Error Analysis Global Truncation and Round-Off Error Other Errors - continued Round-Off Error , R n This error results from the finite digits in the computer All numbers in a computer are truncated This is beyond the scope of this course Total Computed Error The total error combines the machine error and the error of the algorithm employed It follows that | φ ( t n ) - Y n | ≤ | E n | + | R n | The machine error cannot be controlled, but choosing a higher order method allows improving the global truncation error Joseph M. Mahaffy, h [email protected] i Lecture Notes – Numerical Methods for Different — (24/39)

Subscribe to view the full document.

Introduction Euler’s Method Improved Euler’s Method
• Fall '08
• staff

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern