You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by younesStrittmatter September 8, 2023
Lambdifying max and min with a constant doesn't work but works as expected with variables:
x = sympy.Symbol('x')
sympy_expr = sympy.sympify('max(3, x)')
f = sympy.lambdify(x, sympy_expr, 'numpy')
f([1,2,3])
->
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
y = sympy.Symbol('y')
sympy_expr = sympy.sympify('max(x, y)')
f = sympy.lambdify([x, y], sympy_expr, 'numpy')
f([1,2,3], [3,2,1])
->
[3,2,3]
```</div>
The text was updated successfully, but these errors were encountered:
This looks like an instance of the problem described at #5642. At least for the case where constant is part of the original expression, it should be possible for the printer to detect this and print something else (it is printing amax((3, x), axis=0))
Discussed in #25659
Originally posted by younesStrittmatter September 8, 2023
Lambdifying max and min with a constant doesn't work but works as expected with variables:
The text was updated successfully, but these errors were encountered: