Write a NumPy program to compute xy, element-wise where x, y are two given arrays.
import numpy as np x = np.array([[1, 2], [3, 4]]) y = np.array([[1, 2], [1, 2]]) print("Array1: ") print(x) print("Array1: ") print(y) print("Result- x^y:") r1 = np.power(x, y) print(r1)
Sample Output:
Array1: [[1 2] [3 4]] Array1: [[1 2] [1 2]] Result- x^y: [[ 1 4] [ 3 16]]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer