There’s problems with that approach, though. First, when using autodiff
, the type constraint on the “user-defined” fields of the data do not match, i.e. only one of the fields is a dual at a time. So, using e.g. Trapezoid()
instead of Tsit5
as solver, I get the error:
MethodError: no method matching SimType(::Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(f),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},Float64}(),Float64,2},1}, ::Float64)
Closest candidates are:
SimType(::Array{T,1}, !Matched::T) where T ...
I remember there is a way of solving this, I read it somewhere some time ago. But, IMO, that’s rather complicated for a “standard user”. Is there any better way?
Ok, so let’s turn off autodiff
by using Trapezoid(autodiff=false)
. I then get:
MethodError: no method matching SimType(::Array{Float64,2}, ::Float64)
Closest candidates are:
SimType(!Matched::Array{T,1}, ::T) where T ...
So, somehow, this (and many other solvers) try to initialise a 2D array…?