Spaces:
Sleeping
Sleeping
Shah Mahdi Hasan
commited on
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 |
|