Example code:
import numpy as np
a = np.arange(1,11)
b = np.arange(1,11)
b[:] = 0
b[3] = 10
b[4] = 10
print(a, b)
[ 1 2 3 4 5 6 7 8 9 10] [ 0 0 0 10 10 0 0 0 0 0]
I am attempting to multiply b by element-wise a-array such that my resulting array is the following:
[0 0 10 30 50 70 90 110 130 150]
Any help would be greatly appreciated.
a * b. However, for your values ofaandb, the product is[ 0, 0, 0, 40, 50, 0, 0, 0, 0, 0]rather than whay you specified as expected output, so I think clarification is needed.