ODE solvers - Matlab ode23s vs Rosenbrock23 implementations

I am working on solving stiff ODEs and I was comparing MATLAB and Julia solvers. While both give the same solution when the system reaches a steady state, at the beginning there is a small difference for the same relative and absolute tolerances. Do you have any idea why it happens? I observed that the ode23s implementation uses more time points (smaller time step) compare to the implementation in Julia

This is likely a difference in the time step control. The time stepping of ODEs is half science, half random guessing, so there’s a lot of room for differences.

1 Like

That’s what I suspect. Do you know I can control the time stepping in Julia so I can match them? I am curious

see Timestepping Method Descriptions · DifferentialEquations.jl

I’m not going to look at the MATLAB source code for obvious reasons, but we default to a PI Controller and I would guess MATLAB defaults to an I Controller like what Hairer and Wanner do. Also, We default to using automatic differentiation while MATLAB uses finite differences, and Rosenbrock methods can be sensitive to gradient accuracy so that’s another piece that would give a difference.

2 Likes

Thanks for your answer!