Non linear Second Order DE in ModelingToolkit.jl

Something strange happened to the formatting of your example, you should have more multiply operators in there. And is should that m be an m₂ or m₁? Try calling structural_simplify as suggested in the second error:

using ModelingToolkit

@variables t
∂ = Differential(t)

function test()
    @variables θ(t) ϕ(t) r(t)
    @parameters m m₂ g k m₁ l₁ μ l₂ w
    eqns = [∂(∂(θ)) ~ -1*(m*g*θ + m₂*g*ϕ + k*(θ - ϕ)r)/(m₁*l₁)
            ∂(∂(ϕ)) ~ ((1+μ)g*θ + (k/m₁)*(θ - ϕ)r + (μ - 1)g*ϕ - 2∂(ϕ)∂(r))/(l₂+r)
            ∂(∂(r)) ~ - w*r + l₁*∂(θ)^2 + l₂*∂(ϕ)^2 + 0.5g*ϕ^2 + l₁*(θ - ϕ)*∂(∂(θ))]
    @named system = ODESystem(eqns)
    model = structural_simplify(system)
end
1 Like