# Using ForwardDiff.jacobian to provide jac to ODE solvers

**URL:** <https://discourse.julialang.org/t/using-forwarddiff-jacobian-to-provide-jac-to-ode-solvers/73041>\
**Category:** New to Julia\
**Tags:** question, diffeq\
**Created:** [December 13, 2021, 6:22pm UTC](https://discourse.julialang.org/t/using-forwarddiff-jacobian-to-provide-jac-to-ode-solvers/73041 "2021-12-13T18:22:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yinmin\_Liu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yinmin_liu/32/31880_2.png) [@Yinmin\_Liu](https://discourse.julialang.org/u/Yinmin_Liu)\
**Post date:** [December 13, 2021, 6:22pm UTC](https://discourse.julialang.org/t/using-forwarddiff-jacobian-to-provide-jac-to-ode-solvers/73041/1 "2021-12-13T18:22:59Z")

</div>

Hi,

I would like to use ForwardDiff.jacobian to provide Jacobian matrix to ODE solvers. I wonder if it can be faster than using numerical Jacobian. I think the rhs of differential equations should in form of f(du, u,p,t) and automatic jacobian should looks like ForwardDfiff.jacobian(f,u). But I am not sure how to make these two format working together. My code is attached.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/e/5e3797cfa7d59089f89a947cc3e22bb2655b49ca.png)

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 13, 2021, 8:00pm UTC](https://discourse.julialang.org/t/using-forwarddiff-jacobian-to-provide-jac-to-ode-solvers/73041/2 "2021-12-13T20:00:09Z")

</div>

Just follow the example from the docs: [Local Sensitivity Analysis (Automatic Differentiation) · DifferentialEquations.jl](https://diffeq.sciml.ai/stable/analysis/sensitivity/#solve-Differentiation-Examples)
