It works perfectly. However, I’m a bit lost. I’m trying to find the zeros of the solution with Roots.jl, and when I use, for example:
find_zero(sol, (1, 100))
the function returns the zero of the solution’s first derivative instead of the zero of the solution. Is there any way to apply find_zero to find the root of the solution in some interval?
If you use save_idxs in the solve, you can choose which indices to save, like save_idxs = 2 then gives you only the second index of the solve, which IIRC is the position one (double check).
Thanks! It works! But in this case, if I want to work with both solutions separately I will have to solve the problem twice. Is that so, or I’m missing something?
@ChrisRackauckas to be honest, looking at the docs I also didn’t see anywhere on a quick glance that explained the ordering of variables in the solution object for a SecondOrderProblem. (I think this is also an issue for dynamical and Hamiltonian problems too.)
If you think it is not making the tutorial too long, I could update the very first tutorial’s example 3 (the pendulum) with a short second version that is equivalent but uses SecondOrderProblem, and then shows briefly what the solution components correspond to.
Alternatively, it might be worth adding a new tutorial in the main docs that covers the dynamical, Hamiltonian and 2nd order problem types, showing how to use their solutions. Maybe this would make sense as the second tutorial, before the code optimization one.
We don’t have a tutorial on SecondOrderODEProblem, so adding one is probably a good place to start. I would place it after the code optimization one, since growing standard ODEs is by far the #1 use case of the package. So all of the ODEs, handling PDE semi-discretizations, and stiff ODE stuff comes first, and then everything else.
But yes, we should document this in the dynamical problems section in more detail too.