SciML / OrdinaryDiffEq.jl

High performance ordinary differential equation (ODE) and differential-algebraic equation (DAE) solvers, including neural ordinary differential equations (neural ODEs) and scientific machine learning (SciML)
https://diffeq.sciml.ai/latest/
Other
523 stars 199 forks source link

Better show methods which include AD info for stiff solvers #2156

Open ArnoStrouwen opened 4 months ago

ArnoStrouwen commented 4 months ago

The following two look the same:

julia> Rodas5P()
Rodas5P(; linsolve = nothing, precs = DEFAULT_PRECS,)
julia> sol.alg # comming from the default alg selector
Rodas5P(; linsolve = nothing, precs = DEFAULT_PRECS,)

But are not:


julia> typeof(Rodas5P())
Rodas5P{0, true, Nothing, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}

julia> typeof(sol.alg)
Rodas5P{1, false, Nothing, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}

It is super easy for the user to copy and paste the result from the show method and end up with a different solver. The constructor with the autodiff keywords and so on should be printed instead.

ChrisRackauckas commented 4 months ago

Interesting, I didn't know we had a show method on that.