ModelingToolkit.jl
                                
                                 ModelingToolkit.jl copied to clipboard
                                
                                    ModelingToolkit.jl copied to clipboard
                            
                            
                            
                        ODESystem doesn't check parameters and variables are disjoint
If i try to get a numerical solution to this ODE system i don't get the correct result.
# This code is inspired by the one found as an example in README.md
p₀, q₀ = 0.0, 3.0
@variables t
@parameters P(t) Q(t)
∂t = Differential(t)
eqs = [∂t(Q) ~ 0.2P
       ∂t(P) ~ -80.0sin(Q)]
@named sys = ODESystem(eqs)
u₀ = [P=>p₀, Q=>q₀]
t_span = (0.0, 20.0)
prob = ODEProblem(sys, u₀, t_span)
sol = solve(prob, Tsit5())
By declaring Q and P as variables I get the right result. Maybe there is a problem. https://discourse.julialang.org/t/solving-system-of-ode-with-modeling-toolkit/85524/2
Just to clarify, writing
@parameters P(t) Q(t)
is wrong. It should be @variables. We could have better error messages though.
Sorry, my mistake. There are no problems in Modeling Toolkit. Thanks for the reply.