I solved this ode system with DifferentialEquations and got the correct result.
I am trying with ModelingToolkit but I don’t get the correct result. What am I doing wrong?
The only change was to make @variables P(t) Q(t) instead of parameters. It seems that by making them parameters, the automatic system detection put them as both variables and parameters, printing out:
julia> @named sys = ODESystem(eqs)
Model sys with 2 equations
States (2):
Q(t)
P(t)
Parameters (2):
Q(t)
P(t)
So it would be great if you could open an issue on ModelingToolkit.jl. We should add a sanity check that the intersection between states and parameters should be null. Somehow this one slipped by. Thanks for pointing this out!
Sorry, my mistake. Declaring P and Q as parameters is wrong. P and Q must be declared as variables. There are no problems in Modeling Toolkit. Thank you.