I have two array of numbers t,x:
import numpy
t = numpy.arange(0,10,0.001)
x = numpy.sin(t)
I want to produce other arrays of the same size which are the element-by-element maximum or minimum:
y1 = ?max(x,2)
y2 = ?min(x,t)
where ?max and ?min stand for unknown functions. The numpy.max() and numpy.min() seem to find the max and min of an entire array, which is not what I want.
How can I achieve this?
You’re looking for
numpy.minimum()andnumpy.maximum()(not to be confused withnumpy.min()andnumpy.max()).