While automatic variation of the step size is easy

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: i ed each time the computed error measure fails to satisfy the prescribed tolerance . procedure onestep (f: vector function : real var t, h: real var y: vector) begin repeat Integrate (3.5.1b) from t to t + h using (3.5.1a) Compute errormeasure at t + h if errormeasure > then Calculate a new step size h until errormeasure t=t+h Suggest a step size h for the next step end Figure 3.5.1: Pseudo-code segment of a one-step numerical method with error control and automatic step size adjustment. In addition to supplying a one-step method, the procedure presented in Figure 3.5.1 will require routines to compute an error measure and to vary the step size. We'll concentrate on the error measure rst. Example 3.5.1. Let us calculate an estimate of the local discretization error of the midpoint rule predictor-corrector. We do this by subtracting the Taylor Taylor's series expansion of the exact solution (3.1.2, 3.1.3) from the expansion of the Runge-Kutta formula (3.1.7) with a = c = 1=2, b1 = 0, and b2 = 1. The result is 3 dn = h 3(ftt + 2ffty + f 2fyy...
View Full Document

Ask a homework question - tutors are online