[Tutor] Help with Recurring Function
Sanhita Mallick
sanhitam at yahoo.com
Sat Apr 26 01:32:27 CEST 2008
Hi.
I am struggling with a simple recurring function, but
can't understand why this is happening. Please help.
Here is the script. T(i) are trees (as in graphs).
The program operates great, until the step where
norm_ted is calculated. Mysteriously norm_ted becomes
0, even though "mag" value is calculated correctly.
Also, strangely, sum_norm_ted also becomes zero.
What am I missing?
Thanks.
-Sanhita
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T = [F1, F2, F3]
k = len(T)
mean_ted = {}
for i in range(k):
sum_norm_ted = 0.0
mag = 0.0
norm_ted = 0.0
for j in range(k):
if (i != j):
ted= alg.ted(T[i], T[j])
print 'TED ' + str(i) + str(j) + ' is ' +
str(ted)
mag = 2 * (T[i].n + T[j].n) - 1
print 'MAG ' + str(i) + str(j) + ' is ' +
str (mag) + ' and ' + str ( 2 * ted )
norm_ted = (2 * ted) / mag
print 'norm_ted ' + str(i) + str(j) + ' is
' + str (norm_ted)
sum_norm_ted = sum_norm_ted + norm_ted
print 'sum_norm_ted ' + str(i) + str(j) +
' is ' + str (sum_norm_ted)
More information about the Tutor
mailing list