[Tutor] script comparing two values
Mic Forster
micforster@yahoo.com
Mon Feb 24 22:17:14 2003
Hi Guys,
I am attempting to fit an expected geometric series of
relative species abundance with an observed set of
relative species abundance. In doing so one has to
determine a constant, k. This is done by iterating the
following equation:
Nmin / N = (k / (1 - k)) * (pow((1 - k),s)) / (1 -
(pow((1 - k),s)) = j
where Nmin is the number of individuals in the least
abundant species, N is the total number of individuals
and s is the number of species. In my example:
Nmin = 1
N = 862
s = 11
Nmin / N = 0.00116 in this example and therefore the
equation:
j = (k / (1 - k)) * (pow((1 - k),s)) / (1 - (pow((1
-k),s)) must also equal 0.00116
Obviously this involves iterating through a list of
values between 0 and 1 so that the program returns a
value, k, when Nmin / N = j (where 0 < k < 1).
This is what I have and I know that it is completely
wrong:
def constant(j):
result = []
i = 0.0
while i is not j:
result.append(k)
i, k = (k / (1 - k)((1 - k)^s) / (1 - (1 - k)^s), i
+ 0.0001
return result
SyntaxError: invalid syntax
Any help?
Cheers,
Mic
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/