Explore add(), subtract(), multiply(), divide(), power(), mod(), and maximum().
NumPy provides named mathematical functions like `np.maximum(a, b)` and `np.minimum(a, b)` that perform element-wise comparisons across two arrays.
`np.maximum(a, b)` compares two arrays position-by-position and picks the higher value at each spot, like choosing the better player at each position.
`np.max(arr)` reduces an array to 1 single maximum scalar. `np.maximum(a, b)` compares 2 arrays element-by-element, returning an array of pairwise maximums.
relu = np.maximum(arr, 0)res = np.max(a, b) # Error: max does not take 2 arrays as argumentsres = np.maximum(a, b)Use `np.maximum()` for 2-array element-wise comparisons, and `np.max()` for 1-array reductions.
Solve the objective below using NumPy vectorized syntax
Given `arr = np.array([-10, 5, -2, 8])`, apply `np.maximum(arr, 0)` and print the result.
[0 5 0 8]