Norms in NDSolve
NDSolve uses norms of error estimates to determine when solutions satisfy error tolerances. In nearly all cases the norm has been weighted, or scaled, such that it is less than 1 if error tolerances have been satisfied and greater than 1 if error tolerances are not satisfied. One significant advantage of such a scaled norm is that a given method can be written without explicit reference to tolerances: the satisfaction of tolerances is found by comparing the scaled norm to 1, thus simplifying the code required for checking error estimates within methods.
|a function to use to compute norms of error estimates in NDSolve
The setting for the NormFunction option can be any function that returns a scalar for a vector argument and satisfies the properties of a norm. If you specify a function that does not satisfy the required properties of a norm, NDSolve will almost surely run into problems and give an answer, if any, which is incorrect.
The default value of Automatic means that NDSolve may use different norms for different methods. Most methods use an infinity-norm, but the IDA method for DAEs uses a 2-norm because that helps maintain smoothness in the merit function for finding roots of the residual. It is strongly recommended that you use Norm with a particular value of . For this reason, you can also use the shorthand NormFunction->p in place of NormFunction->(Norm[#,p]/Length[#]^(1/p)&). The most commonly used implementations for , , and have been specially optimized for speed.
The reason that error decreases with increasing is because the norms are normalized by multiplying with , where is the length of the vector. This is often important in NDSolve because in many cases, an attempt is being made to check the approximation to a function, where more points should give a better approximation, or less error.
Consider a finite difference approximation to the first derivative of a periodic function given by where on a grid with uniform spacing . In the Wolfram Language, this can easily be computed using ListCorrelate.
The norms of the vectors are comparable because the number of components in the vector has increased, so the usual linear algebra norm does not properly reflect the convergence. Normalizing by multiplying by reflects the convergence in the function space properly.
Methods that have error control need to determine whether a step satisfies local error tolerances or not. To simplify the process of checking this, utility function ScaledVectorNorm does the scaling (1) and computes the norm. The table includes the formulas for specific values of for reference.
|compute the normalized p-norm of the vector v scaling using scaling (1) with reference vector u and relative and absolute tolerances ta and tr
|compute the norm of the vector v using scaling (1) with reference vector u and relative and absolute tolerances ta and tr and the norm function fun
|compute where n is the length of vectors v and u
|compute , where n is the length of vectors v and u