Version 2 (modified by 11 years ago) ( diff ) | ,
---|
Order of accuracy
The order of accuracy, n, of a scheme is defined by the equation,
where E is the error and h is the grid spacing. The error of a scheme should fall off with decreasing the grid spacing (i.e. the intercell distance), and how fast it falls off we say depends on the order of accuracy.
How to compute the error is the subject of the rest of this wiki page.
Computing the error for a scalar
This is the simplest type of error to compute. For a scalar function at one point (say the solution of an ODE at a given time), the error can be broken down as either absolute or relative.
The absolute error
If
is your approximate solution, and z is the exact solution, then the absolute error is just given by . This is an okay measure when z is in units scaled to a magnitude order of 1. (If not, then the error will may appear unexpectedly large or small due to scaling).Relative error
This measure always gives the same error, regardless of units working in. The error is often
, where k is roughly the number of digits the approximation is correct to.Note on choice
It is often just best to scale the problem so that the measured quantities scale roughly to magnitude order of 1 (so the absolute error is a fine measure), and that the quantities are not many orders different than each other for unphysical reasons. This will help prevent bugs in numerical codes.