# How to use SciMLOperators.jl with autograd in DifferentialEquations.jl

**URL:** <https://discourse.julialang.org/t/how-to-use-scimloperators-jl-with-autograd-in-differentialequations-jl/117731>\
**Category:** General Usage\
**Tags:** differentialequation\
**Created:** [August 1, 2024, 1:51pm UTC](https://discourse.julialang.org/t/how-to-use-scimloperators-jl-with-autograd-in-differentialequations-jl/117731 "2024-08-01T13:51:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ctessum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctessum/32/19444_2.png) [@ctessum](https://discourse.julialang.org/u/ctessum)\
**Post date:** [August 1, 2024, 1:51pm UTC](https://discourse.julialang.org/t/how-to-use-scimloperators-jl-with-autograd-in-differentialequations-jl/117731/1 "2024-08-01T13:51:53Z")

</div>

Hello,

I have a system that is implemented as a `FunctionOperator` from SciMLOperators.jl, that I would like to integrate as a differential equation. For example:

```julia
using SciMLOperators, DifferentialEquations

op = FunctionOperator((du,u,p,t) -> du .= u .* u, rand(10), t=0.0, p=[0.0], batch=true)
op = cache_operator(op, rand(10))

prob = ODEProblem{true}(op, rand(10), (0.0,1.0), [0.0])

solve(prob, Rosenbrock23())

```

The code above defines the operator, and a related ODE problem, and runs it in in-place mode with an integrator that uses automatic differentiation. However, this doesn’t work, presumably because the cache is a `Float64` type instead of dual numbers. How can I make it work correctly? Any suggestions would be greatly appreciated!

---

<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:** [August 1, 2024, 4:28pm UTC](https://discourse.julialang.org/t/how-to-use-scimloperators-jl-with-autograd-in-differentialequations-jl/117731/2 "2024-08-01T16:28:00Z")

</div>

SciMLOperators needs more work

---

<div class="post-metadata">

**Author:** ![ctessum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctessum/32/19444_2.png) [@ctessum](https://discourse.julialang.org/u/ctessum)\
**Post date:** [August 4, 2024, 1:47pm UTC](https://discourse.julialang.org/t/how-to-use-scimloperators-jl-with-autograd-in-differentialequations-jl/117731/3 "2024-08-04T13:47:36Z")

</div>

Good to know, thanks!
