IMPLEMENTATION
Richardson Extrapolation
In numerical simulation, Richardson extrapolation is a sequence acceleration method, often used to improve the rate of
convergence. This method can also be applied to finite difference approximations to boost the accuracy of numerical derivatives.
If A(h) is an estimation of order hn for A:
or
A = A(h) + anhn + O(hm), an ≠ 0, m > n
|
We can repeat the calculation with h = th, so that
A = A(h) + an((th)n + O((th))m)
|
eliminating the coefficient an and solving for A, we obtain from the above two equations:
A = tnA(h) - A(th) / tn - 1
|
which is the Richardson extrapolation formula.
Testing the Richardson Extrapolation
We will test if the Richardson extrapolation improves the accuracy of the derivatives. The following function will be used for the
testing:
We can easily compute the first four derivatives of the above function analytically. For testing we will calculate the
derivatives using the Forward Method with and without the Richardson extrapolation.
Here we set h = 0.1 and x is changeable, starting with initial value x = 1. Inside the TestRichardsonExtrapolation method, the parameters
Exact1,...,Exact4 represent the exact results for the first four derivatives; Forward1,...,Forward4 represent results from Forward difference
method; and Richardson1,...,Richardson4 denote the results from the Forward method with Richardson extrapolation.
The reader can see the results from the Richardson Extrapolation are much closer to the exact results than those from the
Forward method.
Richardson Extrapolation setup
To test the Richardson Extrapolation, a new static method has been added to show how to calculate
the first four derivatives. TestRichardsonExtrapolation() method has
been written, added and executed. No additional supporting code is shown.
Running this code generates results shown above.
static void TestRichardsonExtrapolation();
{
double exact1 = 4 * t1 * t1 * t1 + 1 - Math.Exp(-t1);
double c1 = Differentiation.Forward1(f1, t1, h);
double r1 = Differentiation.Richardson1(f1, t1, h, "Forward");
ListBox1.Items.Add(" ~FIRST DERIVATIVE ");
ListBox1.Items.Add(" Exact1 = " + exact1.ToString() + " Forward1 = " + c1.ToString() + " Richardson1 = " + r1.ToString());
ListBox1.Items.Add(" ");
double exact2 = 4 * t1 * t1 * t1 + 1 - Math.Exp(-t1);
double c2 = Differentiation.Forward2(f1, t1, h);
double r2 = Differentiation.Richardson2(f1, t1, h, "Forward");
ListBox1.Items.Add(" ~SECOND DERIVATIVE ");
ListBox1.Items.Add(" Exact1 = " + exact2.ToString() + " Forward2 = " + c2.ToString() + " Richardson2 = " + r2.ToString());
ListBox1.Items.Add(" ");
double exact3 = 4 * t1 * t1 * t1 + 1 - Math.Exp(-t1);
double c3 = Differentiation.Forward3(f1, t1, h);
double r3 = Differentiation.Richardson3(f1, t1, h, "Forward");
ListBox1.Items.Add(" ~THIRD DERIVATIVE ");
ListBox1.Items.Add(" Exact1 = " + exact3.ToString() + " Forward3 = " + c3.ToString() + " Richardson3 = " + r3.ToString());
ListBox1.Items.Add(" ");
double exact4 = 4 * t1 * t1 * t1 + 1 - Math.Exp(-t1);
double c4 = Differentiation.Forward4(f1, t1, h);
double r4 = Differentiation.Richardson4(f1, t1, h, "Forward");
ListBox1.Items.Add(" ~FOURTH DERIVATIVE ");
ListBox1.Items.Add(" Exact1 = " + exact4.ToString() + " Forward4 = " + c4.ToString() + " Richardson4 = " + r4.ToString());
ListBox1.Items.Add(" ");
}
|
|