Skip to content

Commit

Permalink
Handle input containing division by zero better
Browse files Browse the repository at this point in the history
  • Loading branch information
C.A.P. Linssen committed Nov 21, 2024
1 parent 8671f85 commit 42329d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions odetoolbox/sympy_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ def _is_constant_term(term, parameters: Mapping[sympy.Symbol, str] = None) -> bo
assert all([type(k) is sympy.Symbol for k in parameters.keys()])

if sympy.__version__.startswith("1.4"):
sympy_zero = sympy.numbers.Zero
sympy_one = sympy.numbers.One
sympy_zero = sympy.numbers.Zero
sympy_one = sympy.numbers.One
else:
sympy_zero = sympy.core.numbers.Zero
sympy_one = sympy.core.numbers.One
sympy_zero = sympy.core.numbers.Zero
sympy_one = sympy.core.numbers.One

return type(term) in [sympy.Float, sympy.Integer, sympy_zero, sympy_one] \
or all([sym in parameters.keys() for sym in term.free_symbols])
Expand Down

0 comments on commit 42329d5

Please sign in to comment.