Number of differential equation / degree of freedom

Today I was working on a (ModelingToolkit) problem with a single degree of freedom. But formulating everything with a single differential equation (plus supporting simple equations) turns out somewhat complicated / ugly. I’m pretty sure it has to involve root-finding. Mathematically, I’d really rather write it as two differential equations. But it feels numerically dangerous. There’s only one degree of freedom, so with two differential equations, won’t one of my constraints (eg. conservation of energy) end up violated due to numerical imprecision?

Yes, it will drift without being handled via an algebraic condition.

1 Like