[Numpy-discussion] strange behavior of np.minimum and np.maximum

Emmanuelle Gouillart emmanuelle.gouillart at normalesup.org
Wed Apr 6 07:33:24 EDT 2011


	Hello,

>>> a, b, c = np.array([10]), np.array([2]), np.array([7])
>>> min_val = np.minimum(a, b, c)
>>> min_val
array([2])
>>> max_val = np.maximum(a, b, c)
>>> max_val
array([10])
>>> min_val
array([10])

(I'm using numpy 1.4, and I observed the same behavior with numpy
2.0.0.dev8600 on another machine). I'm quite surprised by this behavior
(It took me quite a long time to figure out what was happening in a
script of mine that wasn't giving what I expected, because of
np.maximum changing the output of np.minimum). Is it a bug, or am I
missing something?

	Cheers,
	Emmanuelle




More information about the NumPy-Discussion mailing list