## ~kdsch/ode2dsp

47680f009cf3e2e7fe3fd17596b6d2cfa77c4504 — Karl Schultheisz 2 months ago
```math.py: comment on stability condition algorithm
```
```1 files changed, 29 insertions(+), 0 deletions(-)

M src/ode2dsp/math.py
```
`M src/ode2dsp/math.py => src/ode2dsp/math.py +29 -0`
```@@ 65,6 65,35 @@ class ODE(Basic):
)

def _is_stable_at(self, point):
+        """
+        Returns the stability condition of the ODE linearized at the given point.
+        """
+        # The stability condition requires calculating the roots of the
+        # characteristic polynomial. Only a linear equation has a characteristic
+        # polynomial. Thus, nonlinear equations are first linearized.
+        #
+        # Linearization tends to introduce constant terms. The characteristic
+        # polynomial should not have constant terms, otherwise the ODE solution
+        # variable is not common to all terms and cannot be eliminated when
+        # solving for s. Thus, the constant terms are removed after linearization.
+        # This is OK; it amounts to ignoring the DC bias in the system and
+        # focusing on the dynamics.
+        #
+        # Finally, the characteristic polynomial must not have any non-monomial
+        # terms including s (such as the Laplace transform of an undefined
+        # function), otherwise the solver fails. Thus, these terms are replaced
+        # with expressions that mean the same thing for our purposes, but are
+        # strict monomials in s. That is,
+        #
+        #    LaplaceTransform(y(t).diff(t), t, s)
+        #
+        # is converted to
+        #
+        #    s * Y
+        #
+        # This is OK because if all of the above works correctly, then the
+        # term Y will be common to all terms of the characteristic polynomial
+        # and thus is irrelevant.
s = Dummy("s")

def symbolized_laplace(lt):

```