# Variable is not a function of independent variable error for trivial example

**URL:** https://discourse.julialang.org/t/variable-is-not-a-function-of-independent-variable-error-for-trivial-example/88669
**Category:** Modelling & Simulations
**Tags:** modelingtoolkit
**Created:** [October 13, 2022, 2:35pm UTC](https://discourse.julialang.org/t/variable-is-not-a-function-of-independent-variable-error-for-trivial-example/88669 "2022-10-13T14:35:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![drandran12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drandran12/32/220647_2.png) [@drandran12](https://discourse.julialang.org/u/drandran12)
#### Post date: [October 13, 2022, 2:35pm UTC](https://discourse.julialang.org/t/variable-is-not-a-function-of-independent-variable-error-for-trivial-example/88669/1 "2022-10-13T14:35:15Z")

</div>

I am trying out the `ModelingToolkit.jl` package and I get this weird error when defing the classical harmonic oscillator with the following code

```julia
using ModelingToolkit,
@variables t x(t)
@parameters ω₀
Dₜ = Differential(t)
@named sys = ODESystem([Dₜ(Dₜ(x)) + ω₀^2*x ~ 0])

```

It produces the error

```julia
ArgumentError: Variable x(t) is not a function of independent variable (ω₀^2)*x(t).

```

I do not understand the where the error comes from. Just putting the second term on the other side gets rid of the error, i.e.

```julia
using ModelingToolkit,
@variables t x(t)
@parameters ω₀
Dₜ = Differential(t)
@named sys = ODESystem([Dₜ(Dₜ(x)) ~ - ω₀^2*x])

```

runs just fine. My apologies if this error comes from my lack of understanding how the package must be used.

---

<div class="post-metadata">

### Author: ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)
#### Post date: [October 13, 2022, 11:44pm UTC](https://discourse.julialang.org/t/variable-is-not-a-function-of-independent-variable-error-for-trivial-example/88669/2 "2022-10-13T23:44:39Z")

</div>

If you explicitly provide the independent variable your first formulation works.

```julia
@named sys = ODESystem([Dₜ(Dₜ(x)) + ω₀^2*x ~ 0], t)

```
