# Rodas4 using dual number for time with autodiff=false

**URL:** https://discourse.julialang.org/t/rodas4-using-dual-number-for-time-with-autodiff-false/98256
**Category:** Modelling & Simulations
**Tags:** question
**Created:** [May 3, 2023, 2:16pm UTC](https://discourse.julialang.org/t/rodas4-using-dual-number-for-time-with-autodiff-false/98256 "2023-05-03T14:16:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)
#### Post date: [May 3, 2023, 2:16pm UTC](https://discourse.julialang.org/t/rodas4-using-dual-number-for-time-with-autodiff-false/98256/1 "2023-05-03T14:16:03Z")

</div>

When the right hand side function has a time dependence, Rodas4 gives dual number method errors, when other solvers (e.g. QBDF) do not. I thought that autodiff was the use-case for dual numbers, but Rodas4 uses dual numbers for time even with autodiff=false? Example code:

```julia
using DifferentialEquations

u = [0.0, 0.0]

function du(u,p,t)
    #display(typeof(t))
    du = zeros(2)
    du[1] = 0.1*u[1] + 0.2*u[2]
    du[2] = 0.1*t
    return du
end

prob = ODEProblem(du,u,(0.0,1.0))

#No error:
sol = solve(prob,QBDF(autodiff=false))

#Dual number error:
sol = solve(prob,Rodas4(autodiff=false))

```

---

<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: [May 3, 2023, 2:35pm UTC](https://discourse.julialang.org/t/rodas4-using-dual-number-for-time-with-autodiff-false/98256/2 "2023-05-03T14:35:16Z")

</div>

Yeah I ran into this yesterday when writing tests for the checkpointed sensitivity analysis fix. It seems like it’s just with Rodas4 and Rodas3 and only in the OOP form, but I added a bigger test suite to make sure we covered this better. The PR fix is here:

> <https://github.com/SciML/OrdinaryDiffEq.jl/pull/1940>
>
> Found in https://discourse.julialang.org/t/rodas4-using-dual-number-for-time-wit…h-autodiff-false/98256, for some reason the out of place Rosenbrock methods were always autodiffing time. This adds a test to make sure this doesn't regress, and also puts in methods from a few other classes just to double check, and tests both oop and iip

that should merge in an hour or so since it’s quite simple.

---

<div class="post-metadata">

### Author: ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)
#### Post date: [May 3, 2023, 2:52pm UTC](https://discourse.julialang.org/t/rodas4-using-dual-number-for-time-with-autodiff-false/98256/3 "2023-05-03T14:52:12Z")

</div>

Thanks a lot, very helpful!
