Skip to content

Commit 70381f2

Browse files
Merge pull request sympy#18084 from oscarbenjamin/pr_lambdify_fix
Fix lambdify tests
2 parents 30440b0 + 6cd5423 commit 70381f2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

sympy/utilities/lambdify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ def _lambdifygenerated(x):
697697
else:
698698
modules = ["numpy"]
699699
else:
700-
modules = ["scipy", "numpy"]
700+
modules = ["numpy", "scipy"]
701701

702702
# Get the needed namespaces.
703703
namespaces = []

sympy/utilities/tests/test_lambdify.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,10 +1012,11 @@ def test_scipy_fns():
10121012
f = lambdify(x, sympy_fn(x), modules="scipy")
10131013
for i in range(20):
10141014
tv = numpy.random.uniform(-10, 10) + 1j*numpy.random.uniform(-5, 5)
1015-
# SciPy thinks that factorial(z) is 0 when re(z) < 0.
1015+
# SciPy thinks that factorial(z) is 0 when re(z) < 0 and
1016+
# does not support complex numbers.
10161017
# SymPy does not think so.
1017-
if sympy_fn == factorial and numpy.real(tv) < 0:
1018-
tv = tv + 2*numpy.abs(numpy.real(tv))
1018+
if sympy_fn == factorial:
1019+
tv = numpy.abs(tv)
10191020
# SciPy supports gammaln for real arguments only,
10201021
# and there is also a branch cut along the negative real axis
10211022
if sympy_fn == loggamma:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy