Spaces:
Running
Running
Shah Mahdi Hasan
pre-commit-ci[bot]
commited on
Commit
•
2e51033
1
Parent(s):
06a70dd
Added "min" and "max" sympy mapping (#473)
Browse files* Added "min" and "max" sympy mapping
To overcome the sympy bug while using Min/Max operators as discussed under this issue: https://github.com/MilesCranmer/PySR/issues/183
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- pysr/export_sympy.py +2 -0
pysr/export_sympy.py
CHANGED
@@ -47,6 +47,8 @@ sympy_mappings = {
|
|
47 |
"ceil": sympy.ceiling,
|
48 |
"sign": sympy.sign,
|
49 |
"gamma": sympy.gamma,
|
|
|
|
|
50 |
}
|
51 |
|
52 |
|
|
|
47 |
"ceil": sympy.ceiling,
|
48 |
"sign": sympy.sign,
|
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 |
|