With the super accurate computation, it works! norm(grad) = 0.0009
.
I should also note that
- it works with adjoint sensitivity analysis (with a normal Tsit5() solution)
- the numerical explosion in ForwardDiff doesn’t happen when I look at the L2 deviation of less ‘stiff’ species (i.e. Calcium, the second state, instead of voltage)
I’m not sure what the lesson is to take from this. Maybe that Forward mode can potentially diverge if your error tolerances are high on a stiff system?