Numpy / pylab min, max

I have two arrays of numbers t, x:

import numpy
t = numpy.arange(0,10,0.001)
x = numpy.sin(t)

      

I want to create other arrays of the same size that are staged maximum or minimum:

y1 = ?max(x,2)
y2 = ?min(x,t)

      

where ?max

and ?min

denote unknown functions. It seems that numpy.max()

and numpy.min()

show max and min entire array of what I do not want to.

How can I achieve this?

+3


source to share


1 answer


You are looking for numpy.minimum()

and numpy.maximum()

(not to be confused with numpy.min()

and numpy.max()

).



+4


source







All Articles