Vectorized Solution of ODEs in Matlab with Control of Residual and Error

  • L. F. ShampineEmail author


Vectorization is very important to the efficiency of computation in the popular problem-solving environment Matlab. Here we develop an explicit Runge–Kutta (7,8) pair of formulas that exploits vectorization. Conventional Runge–Kutta pairs control local error at the end of a step. The new method controls the extended local error at 8 points equally spaced in the span of a step. This is a byproduct of a control of the residual at these points. A new solver based on this pair, odevr7, not only has a very much stronger control of error than the recommended Matlab solver ode45, but on standard sets of test problems, it competes well at modest tolerances and is notably more efficient at stringent tolerances.


Matlab Vectorization Ordinary differential equations Initial value problems 

Mathematics Subject Classification (2000)

65L05 65L20 


  1. 1.
    Dormand, J.R.: Numerical Methods for Differential Equations a Computational Approach. CRC Press, Boca Raton (1996) zbMATHGoogle Scholar
  2. 2.
    Enright, W.H., Li, Y.: The reliability/cost trade-off for a class of ODE solvers. Numer. Alg. 53, 239–260 (2010) zbMATHCrossRefGoogle Scholar
  3. 3.
    Higham, D.J.: Robust defect control with Runge–Kutta schemes. SIAM J. Numer. Anal. 26, 1175–1183 (1989) MathSciNetzbMATHCrossRefGoogle Scholar
  4. 4.
    Hull, T.E., Enright, W.H., Fellen, B.M., Sedgwick, A.E.: Comparing numerical methods for ordinary differential equations. SIAM J. Numer. Anal. 9, 603–637 (1972) MathSciNetzbMATHCrossRefGoogle Scholar
  5. 5.
    Kierzenka, J., Shampine, L.F.: A BVP solver based on residual control and the Matlab PSE. ACM Trans. Math. Softw. 27, 299–316 (2001) MathSciNetzbMATHCrossRefGoogle Scholar
  6. 6.
    Krogh, F.T.: On testing a subroutine for the numerical integration of ordinary differential equations. J. ACM 20, 545–562 (1973) zbMATHGoogle Scholar
  7. 7.
    Matlab: The MathWorks, Inc., 3 Apple Hill Dr., Natick, MA 01760 Google Scholar
  8. 8.
    Milne, W.E.: Numerical Solution of Differential Equations. Dover, Mineola (1970) zbMATHGoogle Scholar
  9. 9.
    Rosser, J.B.: A Runge-Kutta for all seasons. SIAM Rev. 9, 417–452 (1967) MathSciNetzbMATHCrossRefGoogle Scholar
  10. 10.
    Shampine, L.F.: Local error control in codes for ordinary differential equations. Appl. Math. Comput. 3, 189–210 (1977) MathSciNetzbMATHCrossRefGoogle Scholar
  11. 11.
    Shampine, L.F.: Interpolation for Runge–Kutta methods. SIAM J. Numer. Anal. 22, 1014–1027 (1985) MathSciNetzbMATHCrossRefGoogle Scholar
  12. 12.
    Shampine, L.F.: Solving ODEs and DDEs with residual control. Appl. Numer. Math. 52, 113–127 (2005) MathSciNetzbMATHCrossRefGoogle Scholar
  13. 13.
    Shampine, L.F.: Vectorized solution of ODEs in Matlab. Scalable Comput.: Pract. Experience 10, 337–345 (2010). A preprint is available at Google Scholar
  14. 14.
    Shampine, L.F., Kierzenka, J.: A BVP solver that controls residual and error. J. Numer. Anal. Ind. Appl. Math. 3, 27–41 (2008) MathSciNetzbMATHGoogle Scholar
  15. 15.
    The MathWorks, Code Vectorization Guide, available at
  16. 16.
    Verner, J.H.: A ‘most efficient’ Runge-Kutta (13:7,8) pair. Available at
  17. 17.
    Watts, H.A., Shampine, L.F.: A-stable block implicit one step methods. BIT 12, 252–256 (1972) MathSciNetzbMATHCrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media B.V. 2011

Authors and Affiliations

  1. 1.RichardsonUSA

Personalised recommendations