In [1]:
import numpy as np

In [2]:
a = np.array([0, 1, 2])
b = np.array([3, 0, 6])
c = np.array([1, 2, 3])

In [3]:
print(np.maximum.reduce([a, b, c]))


[3 2 6]

In [4]:
print(np.maximum(np.maximum(a, b), c))


[3 2 6]

In [5]:
print(np.fmax.reduce([a, b, c]))


[3 2 6]

In [6]:
print(np.minimum.reduce([a, b, c]))


[0 0 2]

In [7]:
print(np.fmin.reduce([a, b, c]))


[0 0 2]

In [8]:
print(np.maximum.reduce((a, b, c)))


[3 2 6]

In [9]:
# print(np.maximum.reduce(a, b, c))
# TypeError: data type not understood

In [10]:
a_2d = np.arange(6).reshape(2, 3)
print(a_2d)


[[0 1 2]
 [3 4 5]]

In [11]:
# print(np.maximum.reduce([a_2d, b, c]))
# ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

In [12]:
print(np.maximum(np.maximum(a_2d, b), c))


[[3 2 6]
 [3 4 6]]

In [13]:
# print(np.maximum.reduce([4, b, c]))
# ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

In [14]:
print(np.maximum(np.maximum(4, b), c))


[4 4 6]

In [15]:
print(a)


[0 1 2]

In [16]:
print(np.maximum.reduce(a))


2

In [17]:
print(a.max())


2

In [18]:
print(max(a))


2

In [19]:
a_2d = np.array([[0, 1, 2], [3, 0, 6], [1, 2, 3]])
print(a_2d)


[[0 1 2]
 [3 0 6]
 [1 2 3]]

In [20]:
print(np.maximum.reduce(a_2d))


[3 2 6]

In [21]:
print(np.maximum(np.maximum(a_2d[0], a_2d[1]), a_2d[2]))


[3 2 6]

In [22]:
print(a_2d.max(axis=0))


[3 2 6]