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

**URL:** <https://discourse.julialang.org/t/choice-of-the-integrator-for-mixed-first-second-order-system-of-ode/55330>\
**Category:** Modelling & Simulations\
**Created:** [February 15, 2021, 4:16pm UTC](https://discourse.julialang.org/t/choice-of-the-integrator-for-mixed-first-second-order-system-of-ode/55330 "2021-02-15T16:16:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [February 15, 2021, 4:16pm UTC](https://discourse.julialang.org/t/choice-of-the-integrator-for-mixed-first-second-order-system-of-ode/55330/1 "2021-02-15T16:16:47Z")

</div>

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):

```julia
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?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 15, 2021, 10:40pm UTC](https://discourse.julialang.org/t/choice-of-the-integrator-for-mixed-first-second-order-system-of-ode/55330/2 "2021-02-15T22:40:04Z")

</div>

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.
