Numpy multiplication and create new list B[i] = Product(A[j]) where j =! i – StackOverflow
[2, 1, 5, 9] ↓ [ [2, 1, 5, 9], [2, 1, 5, 9], [2, 1, 5, 9], [2, 1, 5, 9], ] ↓ [ [1, 1, 5, 9], [2, 1, 5, 9], [2, 1, 1, 9], [2, 1, 5, 1], ] ↓ [45., 90., 18., 10.]
という処理を考える.
import numpy as np a = np.array([2, 1, 5, 9]) a[None].repeat(len(a), 0).prod(1) / a
array([45., 90., 18., 10.])