Current plan is for a major rewrite to getp to handle hybrid continuous and discrete systems by @AayushSabharwal , and in the process we are going to track the behaviour of the getp function to make sure it ADs properly, considering there are known bugs with how it currently works.
This issue is to show the current situation, and track any progress. We also need to add tests related to AD for getp/u in SciMLBase/ SII to ensure the behaviour is tracked over time.
Expected behavior
Gradients produced should be correct.
Minimal Reproducible Example 👇
@parameters σ ρ β A2[1:10, 1:10]
@variables x(t) y(t) z(t) w(t) w2(t)
# @variables A[1:10, 1:10]
eqs = [D(D(x)) ~ σ * (y - x),
D(y) ~ x * (ρ - z) - y,
D(z) ~ x * y - β * z,
w ~ x + y + z + 2 * β,]
@mtkbuild sys = ODESystem(eqs, t)
ModelingToolkit.observed(sys)
u0 = [D(x) => 2.0,
x => 1.0,
y => 0.0,
z => 0.0]
p = [σ => 28.0,
ρ => 10.0,
β => 8 / 3,]
tspan = (0.0, 100.0)
prob = ODEProblem(sys, u0, tspan, p, jac = true)
sol = solve(prob, Tsit5())
Describe the bug 🐞
Sister to #69
Current plan is for a major rewrite to
getp
to handle hybrid continuous and discrete systems by @AayushSabharwal , and in the process we are going to track the behaviour of thegetp
function to make sure it ADs properly, considering there are known bugs with how it currently works.This issue is to show the current situation, and track any progress. We also need to add tests related to AD for
getp/u
in SciMLBase/ SII to ensure the behaviour is tracked over time.Expected behavior
Gradients produced should be correct.
Minimal Reproducible Example 👇
Error & Stacktrace ⚠️
The gradients returned when passed a vector of parameters is incorrect.
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
Add any other context about the problem here.