Skip to content

Commit

Permalink
Add free variables in un SympyExpression form
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Dec 23, 2024
1 parent 23bcb52 commit 11526f1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions mathics/builtin/numbers/algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1810,13 +1810,15 @@ def eval(self, expr, v, evaluation):
return
elif len(v) == 0:
sympy_expr = expr.to_sympy(convert_functions_for_polynomialq=True)
sympy_result = tracing.run_sympy(
sympy_expr.is_polynomial,
*[
SympyExpression(free_symbol)
for free_symbol in sympy_expr.free_symbols
],
)
free_symbols = []
# Until we understand and get expression generation under control,
# for now, we include both sympy.Symbol and
# SympyExpression(sympy.Symbol) variants
# as free variables.
for free_symbol in sympy_expr.free_symbols:
free_symbols.append(SympyExpression(free_symbol))
free_symbols.append(free_symbol)
sympy_result = tracing.run_sympy(sympy_expr.is_polynomial, *free_symbols)
return from_bool(sympy_result)

var = v[0]
Expand Down

0 comments on commit 11526f1

Please sign in to comment.