# DifferentialEquations and derivatives of solutions?

**URL:** <https://discourse.julialang.org/t/differentialequations-and-derivatives-of-solutions/49995>\
**Category:** General Usage\
**Created:** [November 11, 2020, 5:43pm UTC](https://discourse.julialang.org/t/differentialequations-and-derivatives-of-solutions/49995 "2020-11-11T17:43:11Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [November 11, 2020, 10:23pm UTC](https://discourse.julialang.org/t/differentialequations-and-derivatives-of-solutions/49995/3 "2020-11-11T22:23:44Z")

</div>

You just add a second argument with the order of derivative you want:

```julia
julia> begin
           using DifferentialEquations
           f(u,p,t) = 1.1*u
           u0 = 1/2
           tspan = (0.0,1.0)
           prob = ODEProblem(f,u0,tspan)
           sol = solve(prob, Tsit5(), reltol=1e-10, abstol=1e-10)
       end;

julia> sol(1.0) # solution at t = 1.0
1.50208301197696

julia> sol(1.0, Val{1}) ) # First derivative of the solution at t = 1.0 
1.6522913131746269

julia> 1.1 * sol(1.0) ≈ sol(1.0, Val{1}) # We know for this differential equation, that this should match the derivative for any t
true

```

---

_[View the full topic](https://discourse.julialang.org/t/differentialequations-and-derivatives-of-solutions/49995)._
