Choice of the integrator for mixed first-second order system of ODE

I have a system of ODE with the following peculiar functional structure.
It is second order for one variable, but first order for another one (actually, A and B are some vectors):

A'' = f(A, B)
B' = g(A, B)

I need the help with the choice of the integrator.

  • I can easily convert it to a first-order ODE with the phase space (A, A', B) and use the corresponding general integrators.
  • I can also differentiate the second equation once to get a second order ODE and use the corresponding general integrators.

Which approach, do you think, is best? Is there some specialized integrator for this case?

If it’s non-stiff the second option and using a Runge-Kutta-Nystrom option is probably the most efficient. Keeping the second order structure is always a good idea, but that exact form doesn’t fit so differentiating seems to be the right idea.

1 Like