1 Predictor-corrector methods

We have seen that when using an implicit linear multistep method there is an additional difficulty because we cannot, in general, solve simply for the newest approximate y -value y n + k . A general k -step implicit method involves, at the k th time step,

α k y n + k + + α 1 y 1 + α 0 y 0 = h β k f n + k + + β 1 f 1 + β 0 f 0 the y n + k   occurs unknown here too

and if f depends on y in a complicated way then it is not obvious how to dig y n + k out of f n + k = f ( ( n + k ) h , y n + k ) .

One solution to this problem would be to only ever use explicit methods in which β k = 0 . But this is not a good solution, for implicit methods generally have better properties than the explicit ones (for example, the implicit trapezium is second order while the explicit Euler is only first order).

Another solution involves a so-called predictor-corrector method. This involves

  1. The predictor step. We use an explicit method to obtain an approximation y n + k P to y n + k .
  2. The corrector step. We use an implicit method, but with the predicted value y n + k P on the right-hand side in the evaluation of f n + k . We use f n + k P to denote this approximate (predicted) value of f n + k .
  3. We can then go on to correct again and again. At each step we put the latest approximation to y n + k in the right-hand side of the scheme ( via f ) to generate a new approximation from the left-hand side.

(This is not unlike an implementation of Newton-Raphson. In that method we require an initial guess (we “predict") and then the Newton-Raphson approach tells us how to iterate (or “correct") our latest approximation. The main difference here is that we have a systematic way of obtaining the initial prediction.)

It is sufficient for our purposes to illustrate the idea of a predictor-corrector method using the simplest possible pair of methods. We use Euler’s method to predict and the trapezium method to correct.

Example 12

Suppose that y = y ( t ) is the solution to the initial value problem

d y d t = t + y , y ( 0 ) = 3

Use Euler’s method and the trapezium method as a predictor-corrector pair (with one correction at each time step). Take the time step to be h = 0.05 so as to obtain approximations to y ( 0.05 ) and y ( 0.1 ) .

Solution

Euler’s method, y n + 1 = y n + h f n , is the explicit method so we use that to predict . For the first time step we require f 0 = f ( 0 , y 0 ) = f ( 0 , 3 ) = 3 and therefore

y 1 P = y 0 + h f 0 = 3 + 0.05 × 3 = 3.15

We now use this predicted value of y 1 to obtain a “predicted" value for f 1 which we can use in the implicit trapezium method. We find f 1 P = f ( h , y 1 P ) = f ( 0.05 , 3.15 ) = 3.2 . We now correct using the trapezium method in the form

y 1 = y 0 + h 2 f 0 + f 1 P = 3 + 1 2 ( 0.05 ) ( 3 + 3.2 ) = 3.155

This completes prediction and one correction for the first time step.

For the second time step we require f 1 = f ( h , y 1 ) = f ( 0.05 , 3.155 ) = 3.205 and therefore

y 2 P = y 1 + h f 1 = 3.155 + 0.05 × 3.205 = 3.31525

which is the predicted value for y 2 . We now correct it with

y 2 = y 1 + h 2 f 1 + f 2 P = 3.155 + 1 2 ( 0.05 ) ( 3.205 + 3.41525 ) = 3.320506

We conclude that

y ( 0.05 ) 3.155 y ( 0.1 ) 3.320506

If correction is repeated until the corrected values settle down to a converged number then the approximation inherits all the (nice) properties of the implicit scheme. So, in the example above we would have second order accurate results obtained by a procedure which gets around the implicit nature of the trapezium method. Of course in the hand-calculations done above we only corrected once, rather than repeatedly to convergence.

The example above is such that the dependence of f ( t , y ) on y is very simple and we could use the approach seen in Section 32.1 to implement the trapezium method. It turns out that the true trapezium method approximations to y ( 0.05 ) and y ( 0.1 ) are y 1 = 3.155128 and y 2 = 3.320776 respectively, to 6 decimal places. The predictor-corrector method will produce these values if enough corrections are taken.

As noted in the last paragraph, the example above was one in which it is possible to get around the implicit nature of the trapezium method easily because of the simple way in which the right-hand side of the differential equation depends on y . This is not true of the next example.

Example 13

Suppose that y = y ( t ) is the solution to the initial value problem

d y d t = tan ( y ) y ( 0 ) = 1

Use Euler’s method and the trapezium method as a predictor-corrector pair (with one correction at each time step). Take the time step to be h = 0.2 so as to obtain approximations to y ( 0.2 ) and y ( 0.4 ) .

Solution

Euler’s method, y n + 1 = y n + h f n , is the explicit method so we use that to predict. For the first time step we require f 0 = f ( 0 , y 0 ) = f ( 0 , 1 ) = 1.55741 and therefore

y 1 P = y 0 + h f 0 = 1 + 0.2 × 1.55741 = 0.688518

We now use this predicted value to obtain a “predicted" value for f 1 which we can use in the implicit trapezium method. We find f 1 P = f ( h , y 1 P ) = f ( 0.2 , 0.688518 ) = 0.82285 . We now correct using the trapezium method in the form

y 1 = y 0 + h 2 f 0 + f 1 P = 1 + 1 2 ( 0.2 ) ( 1.55741 0.822848 ) = 0.761974

This completes prediction and one correction for the first time step.

For the second time step we require f 1 = f ( h , y 1 ) = f ( 0.2 , 0.761974 ) = 0.95422 and therefore

y 2 P = y 1 + h f 1 = 0.76194 + 0.2 × 0.95422 = 0.571131

which is the predicted value for y 2 . We now correct it with

y 2 = y 1 + h 2 f 1 + f 2 P = 0.761974 + 1 2 ( 0.2 ) ( 0.95422 0.64257 ) = 0.602296

We conclude that

y ( 0.2 ) 0.761974 y ( 0.4 ) 0.602296
Task!

Suppose that y = y ( t ) is the solution to the initial value problem

d y d t = cos ( y ) , y ( 0 ) = 0

Use Euler’s method and the trapezium method as a predictor-corrector pair (with one correction at each time step). Take the time step to be h = 0.1 so as to obtain approximations to y ( 0.1 ) and y ( 0.2 ) .

Euler’s method, y n + 1 = y n + h f n , is the explicit method so we use that to predict. For the first time step we require f 0 = f ( 0 , y 0 ) = f ( 0 , 0 ) = 1 and therefore   y 1 P = y 0 + h f 0 = 0 + 0.1 × 1 = 0.1 We now use this predicted value to obtain a “predicted" value for f 1 which we can use in the implicit trapezium method. We find f 1 P = f ( h , y 1 P ) = f ( 0.1 , 0.1 ) = 0.995004 . We now correct using the trapezium method in the form y 1 = y 0 + h 2 f 0 + f 1 P = 0 + 1 2 ( 0.1 ) ( 1 + 0.995004 ) = 0.099750 which completes the prediction and one correction for the first time step.

For the second time step we require f 1 = f ( h , y 1 ) = f ( 0.1 , 0.099750 ) = 0.995029 and therefore

y 2 P = y 1 + h f 1 = 0.099750 + 0.1 × 0.995029 = 0.199253

which is the predicted value for y 2 . We now correct it with

y 2 = y 1 + h 2 f 1 + f 2 P = 0.099750 + 1 2 ( 0.1 ) ( 0.995029 + 0.980215 ) = 0.198512

We conclude that y ( 0.1 ) 0.099750 , y ( 0.2 ) 0.198512   to six decimal places.

Exercise

Suppose that y = y ( t ) is the solution to the initial value problem

d y d t = 1 ( 1 + y 2 ) y ( 0 ) = 1

Use Euler’s method and the trapezium method as a predictor-corrector pair (with one correction at each time step). Take the time step to be h = 0.25 so as to obtain approximations to y ( 0.25 ) and y ( 0.5 ) .

Euler’s method, y n + 1 = y n + h f n , is the explicit method so we use that to predict. For the first time step we require f 0 = f ( 0 , y 0 ) = f ( 0 , 1 ) = 0.5 and therefore

y 1 P = y 0 + h f 0 = 1 + 0.25 × 0.5 = 1.125

We now use this predicted value to obtain a “predicted" value for f 1 which we can use in the implicit trapezium method. We find f 1 P = f ( h , y 1 P ) = f ( 0.25 , 1.125 ) = 0.441379 . We now correct using the trapezium method in the form

y 1 = y 0 + h 2 f 0 + f 1 P = 1 + 1 2 ( 0.25 ) ( 0.5 + 0.441379 ) = 1.117672

This completes prediction and one correction for the first time step.

For the second time step we require f 1 = f ( h , y 1 ) = f ( 0.25 , 1.117672 ) = 0.444604 and therefore

y 2 P = y 1 + h f 1 = 1.125 + 0.25 × 0.444604 = 1.228823

which is the predicted value for y 2 . We now correct it with

y 2 = y 1 + h 2 f 1 + f 2 P = 1.117672 + 1 2 ( 0.25 ) ( 0.444604 + 0.398405 ) = 1.223049

We conclude that  y ( 0.25 ) 1.117672 , y ( 0.5 ) 1.223049  to six decimal places.