# Number of differential equation / degree of freedom

**URL:** https://discourse.julialang.org/t/number-of-differential-equation-degree-of-freedom/123644
**Category:** Modelling & Simulations
**Tags:** differentialequation
**Created:** [December 10, 2024, 3:37am UTC](https://discourse.julialang.org/t/number-of-differential-equation-degree-of-freedom/123644 "2024-12-10T03:37:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)
#### Post date: [December 10, 2024, 3:37am UTC](https://discourse.julialang.org/t/number-of-differential-equation-degree-of-freedom/123644/1 "2024-12-10T03:37:09Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [December 19, 2024, 8:48pm UTC](https://discourse.julialang.org/t/number-of-differential-equation-degree-of-freedom/123644/2 "2024-12-19T20:48:36Z")

</div>

> [@cstjean](#):
>
> 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.
