I am solving an equation of the form

$(*)$ $0 = a(f) (\partial_rf)^2 + b(f) (\partial_rf) + c(f),$

where $f$ is a real function of $r\in \mathbb{R}$, and $a,b,c$ are real functions of $f$. The boundary condition $f=f_0$ at $r=0$. Right now, I am solving $(*)$ by finite differencing $(*)$ and then applying a relaxation method.

I want to solve $(*)$ using an explicit method, such as a Runge-Kutta type method. The only idea I have thought of so far is treating $(*)$ as an algebraic equation for $\partial_rf$, and then solving the resulting linear ODE using a Runge-Kutta solver. I find that procedure to be very inelegant though, and I'd like to know if there there is a body of algorithms that can solve (at least) specific kinds of nonlinear ODE.

I recognize there (may be?) issues with uniqueness of the solution(s) of $(*)$; I would appreciate any insights on how to numerically select a specific solution as well.


You don't have just a first-order ODE so you cannot use an explicit Runge-Kutta method. Because of the square term, you cannot bring this into mass matrix form even. Instead, what you have is an implicit ODE. This falls into the class of problems known as Differential-Algebraic Equations, and that still works even though you don't have any pure algebraic variables. A common method to solve DAEs is to use a fully implicit BDF method. Software for this is available in C++, Julia, MATLAB, etc.

| cite | improve this answer | |
  • $\begingroup$ Just to clarify: in $(*)$, if the discriminant $b^2-4ac>0$, could I in principle could reduce the equation to a first order ODE which I could solve using an explicit method? I am also concerned about the uniqueness of the solution of $(*)$. $\endgroup$ – PHY314 Mar 4 '18 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.