Hello,
I am using an Ode solver to simulate a mechanical system with a mass and a spring. Besides the spring and an external force there is a nonlinear force acting on the system. Each computation takes around 4 ms.
When im am simulating the exact same system in Matlab, the ode23t needs around 200 function evaluations.
In Julia all solver I tried (non stiff and stiff solvers) are calling the ode_function at least 2200 times. The one performing the best is the Rosenbrock23.
I am using the same tolerances in matlab as in julia. Is there a solver option I am missing?
I am also using the same initial step size.

Hi, i have a follow up problem to my last one above.
I compared most of the stiff solvers avaible against the ode15s in Matlab. As my equation gets more and more stiff, the julia solvers still have at least twice as much function calls.
If I reduce the error tollerance, the solution i obtain is not acceptable. Since the function calls are expensive I really would like to reduce them.

I checked the ode_function and the ode_jacobian with random inputs against my Matlab code. The results are exactly the same.
A list of the solvers I tried:

Some SDIRKT Methods ( but my jacobian is changing alot)

RadauIIA3 and RadauIIA5

ROS3P

Rodas3,Rodas4, Rodas4P2, Rodas5P, Rodsa4P and 5P

Rosenbrock23

Thanks for your time. Tell me if you have an idea or you need some more informations.

What about QNDF and FBDF? These are the solvers most similar to ode15s. In general the stiff solvers that are worth trying first are Rosenbrok23, Rodas5P, QNDF, and FBDF.

Ahh yes. I tried them. For the same tolerances I get 4 times as many evals. And the result in Matlab is even more accurate.
If i am reducing the maximum step size I am getting compareable results.
But this should not be the way.

Its hard, since the computation of the nonlinear force is done in many files. I also dindt wrote all the parts by my selfe. So I am not sure if I am allowed to share them public.
I could share the rest if its helpfull.

Well itâ€™s really hard to help if thereâ€™s no code to compare. But the #1 issue always tends to be that the translation is not 1-1. If you run all of the functions with random (u,p,t) do you get the same exact answer from MATLAB and Julia? In almost all cases like this, Iâ€™ve found that to be false, so thatâ€™s the first thing I would look into detail with.

Other than that ode23t is very different from solve of the solvers youâ€™re discussing here. Did you try the Trapezoidal counterpart? L-stability is good for â€śmostâ€ť equations, but not ones for which the dampening is not beneficial. In which case, the reversibility (and â€śclose to symplecticnessâ€ť) can be beneficial. So itâ€™s good to try methods that are similar to what youâ€™ve seen work well before.

Lastly, you may want to watch this video which highlights some of the most common issues people have when translating, particularly from MATLAB:

Thanks for your answer. I used in Matlab the ode15s. The function outputs are the same for random inputs.
I have already seen your video before and I tried the steps there.

Ok, many many years ago, when @ChrisRackauckas helped me a lot by adding amazing features to DifferentialEquations.jl ecosystem, I was doing exactly the same comparison. I see results similar to yours, but it was caused by simulink. It seems it were automatically changing the tolerances, yielding less evaluations. However, everything was very similar when using .m and the function ode45.

Interesting. With or without autodiff? Does the difference there matter? Are there complex valued variables? And the function is exactly the same on random values?