Solving Boundary Value Problems in R

  • Karline Soetaert
  • Jeff Cash
  • Francesca Mazzia
Part of the Use R! book series (USE R)


Boundary Value Problems can be solved in R using shooting, MIRK and collocation methods and these can be found in the R package bvpSolve. The functions in this R package have an interface which is similar to the interface of the initial value problem solvers in the package deSolve. The default input to the solvers is very simple, requiring specification of only one function that calculates the derivatives while the boundary conditions are represented as simple vectors. However, in order to speed-up the simulations, and to increase the number of problems that can be solved, it is also possible to specify the boundary conditions by means of a function and provide analytic functions for the derivative and boundary gradients. In this chapter we demonstrate how to solve BVPs using a variety of well-known test problems, illustrating a wide range of difficulties in solving BVPs. We show how to use (manual and automatic) continuation, how difficult boundary conditions can be handled, and give many examples of how to convert BVPs to standard form. Some BVPs are much better solved using the finite difference methods as explained in the PDE chapter. We give an example of such a boundary value problem at the end of this chapter.


Unknown Constant Integration Interval Derivative Function Integral Constraint Separate Boundary Condition 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Ames, W., & Lohner, E. (1981). Nonlinear models of reaction–diffusion in rivers. In R. Vichnevetsky & R. Stepleman (Eds.), Advances in computer methods for partial differential equations (Vol. IV, pp. 217–219). New Brunswick: IMACS.Google Scholar
  2. 2.
    Ascher, U. M., & Petzold, L. R. (1998). Computer methods for ordinary differential equations and differential-algebraic equations. Philadelphia: SIAM.Google Scholar
  3. 3.
    Ascher, U. M., Christiansen, J., & Russell, R. D. (1979). COLSYS–a collocation code for boundary value problems. In B. Childs et al. (Ed.), Lecture notes in computer science 76 (pp. 164–185). New York: Springer.Google Scholar
  4. 4.
    Ascher, U. M., Christiansen, J., & Russell, R. D. (1981). Collocation software for boundary-value ODEs. ACM Transactions on Mathematical Software, 7, 209–222.Google Scholar
  5. 5.
    Ascher, U. M., Mattheij, R. M. M., & Russell, R. D. (1995). Numerical solution of boundary value problems for ordinary differential equations. Philadelphia: SIAM.Google Scholar
  6. 6.
    Bader, G., & Ascher, U. M. (1987). A new basis implementation for a mixed order boundary value ODE solver. SIAM Journal on Scientific and Statistical Computing, 8, 483–500.Google Scholar
  7. 7.
    Cash, J. R. (2007). Algorithms for the solution of two-point boundary value problems (
  8. 8.
    Cash, J. R., & Mazzia, F. (2005). A new mesh selection algorithm, based on conditioning, for two-point boundary value codes. Journal of Computational and Applied Mathematics, 184, 362–381.Google Scholar
  9. 9.
    Cash, J. R., & Mazzia, F. (2006). Hybrid mesh selection algorithms based on conditioning for two-point boundary value problems. Journal of Numerical Analysis, Industrial and Applied Mathematics, 1(1), 81–90.Google Scholar
  10. 10.
    Cash, J. R., & Mazzia, F. (2009). Conditioning and hybrid mesh selection algorithms for two-point boundary value problems. Scalable Computing: Practice and Experience, 10(4), 347–361.Google Scholar
  11. 11.
    Cash, J. R., & Wright, M. H. (1991). A deferred correction method for nonlinear two-point boundary value problems: Implementation and numerical evaluation. SIAM Journal on Scientific and Statistical Computing, 12, 971–989.Google Scholar
  12. 12.
    Cash, J. R., Moore, G. & Wright, R. W. (1995). An automatic continuation strategy for the solution of singularly perturbed linear two-point boundary value problems. Journal of Computational Physics, 122, 266–279.Google Scholar
  13. 13.
    Moore, G. (1995). Computation and parameterisation of periodic and connecting orbits. IMA Journal of Numerical Analysis, 15, 245–263.Google Scholar
  14. 14.
    Seydel, R. (1988). From equilibrium to Chaos. New York: Elsevier.Google Scholar
  15. 15.
    Shampine, L. F., Gladwell, I., & Thompson, S. (2003). Solving ODEs with MATLAB. Cambridge: Cambridge University Press.Google Scholar
  16. 16.
    Shampine, L. F., Kierzenka, J., & Reichelt, M. W. (2000). Solving boundary value problems for ordinary differential equations in MATLAB with bvp4c. In Matlab Guide, D.J. Higham and N.J. Higham, pp 163–169, Philadelphia: SIAM.Google Scholar
  17. 17.
    Soetaert, K. (2011). rootSolve: Nonlinear root finding, equilibrium and steady-state analysis of ordinary differential equations. R package version 1.6.2.Google Scholar
  18. 18.
    Soetaert, K., & Meysman, F. (2012). Reactive transport in aquatic ecosystems: Rapid model prototyping in the open source software R. Environmental Modelling and Software, 32, 49–60.Google Scholar
  19. 19.
    Soetaert, K., Middelburg, J. J., Heip, C., Meire, P., Van Damme, S., & Maris, T. (2006). Long-term change in dissolved inorganic nutrients in the heterotrophic scheldt estuary (Belgium, the Netherlands). Limnology and Oceanography, 51, 409–423.Google Scholar
  20. 20.
    Soetaert, K., Cash, J. R., & Mazzia, F. (2011). bvpSolve: Solvers for boundary value problems of ordinary differential equations. R package version 1.2.2.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Karline Soetaert
    • 1
  • Jeff Cash
    • 2
  • Francesca Mazzia
    • 3
  1. 1.Department Ecosystem StudiesRoyal Netherlands Institute for Sea ResearchYersekeThe Netherlands
  2. 2.MathematicsImperial CollegeLondonUK
  3. 3.Dipartimento di MatematicaUniversity of BariBariItaly

Personalised recommendations