Loop and the list
Krzysztof Szynter
dygimailNo at SPAMpoczta.fm
Fri May 14 10:57:11 EDT 2004
According to your question and advice:
Yes i mean indexing test in the if statement. Just corrected this simple
bug. But it still doesn't work. This is a piece of results, the code gives:
[1]
TY = natezeniep(TX,TY,dr)
print TY #first main point
gives a list:
[9.8627544243153125, 9.764861685914024, 9.6684191984269319,
9.5733984559832201, 9.479771649668697, 9.3875116471769786,
9.2965919731504503, 9.2069867901844269, 9.118670880469038,
9.0316196280445151, 8.9458090016465412, 8.8612155381193709,
8.7778163263753228, 8.695588991880193, 8.6145116816449576,
8.5345630497049747, 8.4557222430686831, 8.3779688881185095,
8.3012830774474473, 8.2256453571154164, ...]
[2]
max = maxvalue(TY)
print "max =",max
gives (now) a correct index '0', but...
[3]
TY = normowanie(TY) #normalize the function
print TY
gives a non correct () list:
[1.0, 9.764861685914024, 9.6684191984269319, 9.5733984559832201,
9.479771649668697, 9.3875116471769786, 9.2965919731504503,
9.2069867901844269, 9.118670880469038, 9.0316196280445151,
8.9458090016465412, 8.8612155381193709, 8.7778163263753228,
8.695588991880193, 8.6145116816449576, 8.5345630497049747,
8.4557222430686831, 8.3779688881185095, 8.3012830774474473,
8.2256453571154164, 8.151036714310175, ...]
[conclusion]
So the only good item is '0' indexed. For better look there is the code
responsible for the bug:
def normowanie(TY,max):
"normalize the function"
for i in range(0,len(TY)-1):
TY[i] = TY[i]/float(TY[max])
return TY
The function call has arguments: max = '0' and the list TY from [1] at the
top of the post.
ps
Normalizing, i mean to divide (float) all the items in TY list by the max
value in the list. So the result list should contain of items between '0'
and '1' (float of course, not rounded to int).
--
Krzysztof Szynter :'''. :. : *
Dygi GG 1027078 :...' ..... : : : ..... . . . . . .....
http://newbie.friko.pl : : :.... : : : :.... :: :: :.. : :....
dygimail(at)poczta(dot)fm :...' :.... : ': :.... : : :..' : :....
More information about the Python-list
mailing list