# ODEProblem error --\> LoadError: UndefVarError: \_derivative not defined

**URL:** <https://discourse.julialang.org/t/odeproblem-error-loaderror-undefvarerror-derivative-not-defined/55038>\
**Category:** Modelling & Simulations\
**Tags:** question, diffeq, error\
**Created:** [February 11, 2021, 1:16am UTC](https://discourse.julialang.org/t/odeproblem-error-loaderror-undefvarerror-derivative-not-defined/55038 "2021-02-11T01:16:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grheadrick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/grheadrick/32/21111_2.png) [@grheadrick](https://discourse.julialang.org/u/grheadrick)\
**Post date:** [February 11, 2021, 1:16am UTC](https://discourse.julialang.org/t/odeproblem-error-loaderror-undefvarerror-derivative-not-defined/55038/1 "2021-02-11T01:16:35Z")

</div>

I am getting an error when solving a system of differential equations. I have made the below example to demonstrate.  
Julia v1.5.3  
ModelingToolkit v5.6.0  
OrdinaryDiffEq v5.50.2

```julia
using ModelingToolkit, OrdinaryDiffEq, Plots

@variables V_n1 V_n2 V_n_mid
@parameters t
D = Differential(t)

eqs = [ 0 ~ 5.0e-5((D(V_n2)) - (D(V_n_mid)))
        0 ~ 1.0e-5((D(V_n_mid)) - (D(V_n1))) + 5.0e-5((D(V_n_mid)) - (D(V_n2)))
        0 ~ V_n1 - 0.5 - (sin(80t))]

vars = [V_n1, V_n2, V_n_mid]
params = []

sys = ODESystem(eqs, t, vars, params)
u0 = zeros(length(eqs))
du0 = zeros(length(eqs))
tspan = (0.0,100.0)

prob = ODEProblem(sys,u0,tspan,params)
sol = solve(prob, Trapezoid())
plot(sol)

```

The error occurs at the solve step and gives message:

```julia
ERROR: LoadError: UndefVarError: _derivative not defined
Stacktrace:
 [1] macro expansion at /Users/user/.julia/packages/ModelingToolkit/JtDFb/src/build_function.jl:476 [inlined]
 [2] macro expansion at /Users/user/.julia/packages/RuntimeGeneratedFunctions/tNQoo/src/RuntimeGeneratedFunctions.jl:95 [inlined]
 [3] macro expansion at ./none:0 [inlined]
 [4] generated_callfunc at ./none:0 [inlined]
 [5] (::RuntimeGeneratedFunctions.
 -------- [Very long message] -------- 

```

I think I need to use:

```julia
prob = DAEProblem(sys, du0, u0, tspan, differential_vars=[true,true,false])

```

But there is no DAESystem equivalent to ODESystem.  
Thanks for the help.

---

<div class="post-metadata">

**Author:** ![YingboMa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yingboma/32/2181_2.png) [@YingboMa](https://discourse.julialang.org/u/YingboMa)\
**Post date:** [February 11, 2021, 1:53pm UTC](https://discourse.julialang.org/t/odeproblem-error-loaderror-undefvarerror-derivative-not-defined/55038/2 "2021-02-11T13:53:34Z")

</div>

Hey Grant, we are working on general transformations for DAEs in [StructuralTransformations.jl](https://github.com/JuliaComputing/StructuralTransformations.jl). It’s free for academic use. Currently, it only handles the case where the derivative variables on the LHS. I am working on handling the general case along with a singularity-removing alias elimination algorithm.

---

<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:** [February 20, 2021, 3:47am UTC](https://discourse.julialang.org/t/odeproblem-error-loaderror-undefvarerror-derivative-not-defined/55038/3 "2021-02-20T03:47:12Z")

</div>

This is currently in development. As @YingboMa notes, the solution is in StructuralTransformations.jl.
