Note that for compatibility with bsstep the arrays y and d2y are of length 2n for a system of n second-order equations. The values of y are stored in the first n elements of y, while the first derivatives are stored in the second n elements. | 734 Chapter 16. Integration of Ordinary Differential Equations Note that for compatibility with bsstep the arrays y and d2y are of length 2n for a system of n second-order equations. The values of y are stored in the first n elements of y while the first derivatives are stored in the second n elements. The right-hand side f is stored in the first n elements of the array d2y the second n elements are unused. With this storage arrangement you can use bsstep simply by replacing the call to mmid with one to stoerm using the same arguments just be sure that the argument nv of bsstep is set to 2n. You should also use the more efficient sequence of stepsizes suggested by Deuflhard n 1 2 3 4 5 . and set KMAXX 12 in bsstep. CITED REFERENCES AND FURTHER READING Deuflhard P. 1985 SIAM Review vol. 27 pp. 505-535. Stiff Sets of Equations As soon as one deals with more than one first-order differential equation the possibility of a stiff set of equations arises. Stiffness occurs in a problem where there are two or more very different scales of the independent variable on which the dependent variables are changing. For example consider the following set of equations 1 u 998u 1998v v 999u - 1999v with boundary conditions u 0 1 v 0 0 By means of the transformation u 2y z v y z we find the solution u 2e-x e-1000x lnnn v e-x e-1000x V Sample page from NUMERICAL RECIPES IN C THE ART OF SCIENTIFIC COMPUTING ISBN 0-521-43108-5 If we integrated the system with any of the methods given so far in this chapter the presence of the e-1000x term would require a stepsize h 1 1000 for the method to be stable the reason for this is explained below . This is so even Stiff Sets ofEquations 735 Figure . Example of an instability encountered in integrating a stiff equation schematic . Here it is supposed that the equation has two solutions shown as solid and dashed lines. Although the initial conditions are such as to give the solid solution .