Better way to solve jacobian dependent differential equation

What is the best way to solve the following differential equations ?

image

I mean, I could solve the first equation x(t) alone and use the solutions to run the solver again and find P(t). I would like to know if there is any better method (better in terms of performance and solution) in DifferentialEquations.jl that helps to solve these two equations in a better way.

You can use ForwardDiff.jacobian in the RHS to put them together, and that will be faster if you aren’t using an implicit solver, slower if you are. Sequential solving here isn’t necessarily a bad idea.

1 Like

FWIW I’ve used ForwardDiff.jacobian when I was implementing the EKF in the past (which it looks like you’re doing here).

1 Like

Yes, its exactly what Im trying to do ! Do you have any suggestion for the solver to use or any other part of the implementation ?

I’m checking the ForwardDiff.jacobian. Is this the same function as the one used internally by the DifferentialEquation.jl solvers or I’m ignoring something?

I had a PeriodicCallback, where I would add measurement noise and do the estimate and covariance update step (assuming you’re using a hybrid continuous/discrete filter). If you’ve got process noise as well, set the problem up as an SDE rather than trying to add noise in your ODE function.

1 Like