Spaces:
Sleeping
Sleeping
Shah Mahdi Hasan
commited on
Commit
•
ce15648
1
Parent(s):
2e51033
Added "round" operator in the Sympy mappings (#474)
Browse filesEnabling a workaround to avoid the following type error:
`raise TypeError("Cannot round symbolic expression")`
while using `round` as a unary operator.
This issue was raised in #269 the the PR contains the exact solution put forth in the subsequent discussion
- pysr/export_sympy.py +1 -0
pysr/export_sympy.py
CHANGED
@@ -49,6 +49,7 @@ sympy_mappings = {
|
|
49 |
"gamma": sympy.gamma,
|
50 |
"max": lambda x, y: sympy.Piecewise((y, x < y), (x, True)),
|
51 |
"min": lambda x, y: sympy.Piecewise((x, x < y), (y, True)),
|
|
|
52 |
}
|
53 |
|
54 |
|
|
|
49 |
"gamma": sympy.gamma,
|
50 |
"max": lambda x, y: sympy.Piecewise((y, x < y), (x, True)),
|
51 |
"min": lambda x, y: sympy.Piecewise((x, x < y), (y, True)),
|
52 |
+
"round": lambda x: sympy.ceiling(x - 0.5),
|
53 |
}
|
54 |
|
55 |
|