[The Verlet method's relative position error for Δt=0.1, 0.05 and 0.025.]

Week 3 Notes: Introduction to Ordinary Differential Equations

In order to begin our study of the numerical solution of ordinary differential equations, we model a mass on a spring using a Hooke's Law approximation to the spring force.  Although the analytic solution to this simple harmonic oscillator is well known, it pays to begin with a model with a known analytic result so that we can compare this result with various numerical approximations.

Fourth model: Numerical Error (advanced)

The order of a numerical method is a measure of the accuracy of the solution depends on the time step Δt.  Because the Euler method has an position error per time step that is proportional to (Δt)2,  halving the time step decreases this local error by a factor of four.  Unfortunately, we also have to take twice as many step to cover the same total time so the global error is proportional to (Δt)1.  The exponent in the that determines the global error over a fixed interval is the order of the algorithm.  Although it is tempting to choose a very small time step to reduce error, a great many computations are required for all but the simplest models.  A far better approach is to use a higher order algorithm.

 

The SHO Numerical Error Model is designed to explore the accuracy of common numerical methods.  The error graph displays either the position or the energy error as the user changes the step size and the the numerical algorithm.  Users can choose either relative or absolute error and can plot this error using linear or smi-log scales.

Related Models

The following simple harmonic oscillator (SHO) models compare different solution techniques.  These models are listed in order of complexity.

Credits:

The SHO Numerical Error Model was created by Wolfgang Christian using the Easy Java Simulations (EJS) version 4.1 authoring and modeling tool.  You can examine and modify a compiled EJS model if you run the model (double click on the model's jar file), right-click within a plot, and select "Open Ejs Model" from the pop-up menu.  You must, of course, have EJS installed on your computer.

 

Information about Ejs is available at: <http://www.um.es/fem/Ejs/> and in the OSP comPADRE collection <http://www.compadre.org/OSP/>.