coin-or / CppAD

A C++ Algorithmic Differentiation Package: Home Page
https://cppad.readthedocs.io
Other
446 stars 94 forks source link

Computing the Jacobian of an ODE #136

Closed jianqixi closed 2 years ago

jianqixi commented 2 years ago

Dear All,

I am trying to build the Jacobian matrix for my ODE question, like dy/dt=f(t,y). I have programmed the C++ code for the ODE functions. And I want to build one Jacobian matrix of df/dy for the ODE solver. I know I can create the hand code of df/dy by myself, but it is not effective. So I want to know whether the CppAD software can help me to build this Jacobian matrix? The size of this matrix is around 3000*3000. Thank you,

bradbell commented 2 years ago

Perhaps the function Ode_dep in the example below is a help. https://coin-or.github.io/CppAD/doc/rosen_34.cpp.htm

For such a large case you probably want a sparse Jacobian, while the example above computes a dense one. See https://coin-or.github.io/CppAD/doc/sparse_jac.htm https://coin-or.github.io/CppAD/doc/sparsity_pattern.htm

Does this answer your question ?

jianqixi commented 2 years ago

@bradbell Thank you for your recommendation.