-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sympy overloads maximum numpy function #18801
Comments
You can use from sympy import *
import numpy as np
a, b = symbols('a b')
fct = lambdify([a, b], Max(a, b))
na1 = np.array([1.0, -2.0])
na2 = np.array([-1.0, 2.0])
fct(na1, na2) |
Hi, thanks for the reply. Unfortunately the Max function returns the maximum from both arrays as a scalar, not componentwise. The return value in my example would be 2.0 instead of np.array([1.0, 2.0]) |
@phofl @sylee957 output: |
Hi, unfortunately we do not know the dimension of our arrays beforehand. Your described workaround is a bit complicated in this case, but would work nevertheless. Thank you. We solved the issue temporarily through defining a user defined function usr_maximum. This function applies the I think the issue is not the lambdify function. According to my obersvations |
Hi,
I have encountered the following bug recently.
The implementation described in #16473 overloads the maximum/minimum functions from numpy. I would like to get the componentwise maximum from two numpy arrays.
With sympy version 1.4 this code block returned np.array([1.0, 2.0]). Since upgrading to sympy version 1.5 sympify interprets the maximum(a,b) function as a.
Is there a workaround for this behaviour?
The text was updated successfully, but these errors were encountered: