I have the following array:
propensity = [32. 0. 0.]
I've calculated the sum of the array as follows:
a0 = sum(propensity)
I'm trying to calculate a fraction for every element of the array over the sum of the array and have written the following function:
def prob_rxn_fires(propensity, a0):
for x in propensity:
print("propensity:\n", x)
prob = x/a0
print("Prob reaction fires:\n", prob)
return prob
I want the function to return three fractions for each array element, at the moment it only returns 0. I think that's because when it iterates through the array and reaches the return statement it returns only the last value it computed which is 0/32 = 0.0. I need to return the first 2 values as well but am unsure how to fix this?
Cheers