Spaces:
Sleeping
Sleeping
Update solver.py
Browse files
solver.py
CHANGED
|
@@ -5,11 +5,9 @@ from sympy import integrate, diff, latex,simplify, expand, log, exp, sin, cos, t
|
|
| 5 |
import re
|
| 6 |
def format_expression(expr):
|
| 7 |
try:
|
| 8 |
-
#
|
| 9 |
-
if
|
| 10 |
-
|
| 11 |
-
if evaluated.is_real:
|
| 12 |
-
return str(float(evaluated))
|
| 13 |
latex_expr = latex(expr)
|
| 14 |
replacements = {
|
| 15 |
'**': '^', # Power notation
|
|
|
|
| 5 |
import re
|
| 6 |
def format_expression(expr):
|
| 7 |
try:
|
| 8 |
+
# Handle numeric evaluation first
|
| 9 |
+
if isinstance(expr, (sp.Integer, sp.Float)):
|
| 10 |
+
return str(float(expr))
|
|
|
|
|
|
|
| 11 |
latex_expr = latex(expr)
|
| 12 |
replacements = {
|
| 13 |
'**': '^', # Power notation
|