array numpy mixed division problem
Hi
why this line is ok:
DiceValueFrequencyT.append([nonZeroValueT[value],(valueT[nonZeroValueT[value]]*(1/int(len(DiceT[die]))))])
Except the fact that I do not understand why it is written 0.8333333 instead of 5/6 as usual
but this one is ko ?:
DiceValueFrequencyT.append([nonZeroValueT[value],(valueT[nonZeroValueT[value]] / int(len(DiceT[die])))])
in notebook Sagemath 8.2
forget()
import numpy as np
DiceT=[[3,3,3,3,3,6],[1,4,4,4,4,4] ,[2,2,2,5,5,5]]
DiceColorT=['Red','Green','White']
DiceValueFrequencyT=[]
#Rf=[[3,5/6],[6,1/6]];Gf=[[1,1/6],[4,5/6]];Wf=[[2,1/2],[5,1/2]];
for die in range(0,len(DiceT)) :
freqT = np.array(DiceT[die])
valueT = np.bincount(freqT)
nonZeroValueT=np.nonzero(valueT)[0]
show(valueT)
show(nonZeroValueT)
for value in range(0,len(nonZeroValueT)) :
print int(len(DiceT[die]))
# these Two lines are ok when uncommented
#DiceValueFrequencyT.append([nonZeroValueT[value],(valueT[nonZeroValueT[value]]*(1/6))])
DiceValueFrequencyT.append([nonZeroValueT[value],(valueT[nonZeroValueT[value]]*(1/int(len(DiceT[die]))))])
# but this one give false results when uncommented!
#DiceValueFrequencyT.append([nonZeroValueT[value],(valueT[nonZeroValueT[value]] / int(len(DiceT[die])))])
show (DiceValueFrequencyT)