2011-04-01, 08:27 PM
Thanks, that was very helpful 
unfortunately we can't import things since we haven't really 'learned' how to use it, on the test we can only use things that we've been taught.
I have another problem now, it's about lotka-volterra's equations.
if x is rabbits and y are wolves and the eco system variables are
a=3e-2
b=4e-5
c=5e-2
d=6e-6
I have to follow the equation for how it decreases everyday until rabbits are extinct:
x decrease = x(a-by)
y decrease = -y(c-dx)
if there's 300 rabbits and 400 wolves then how many days does it take for it to be rabbits<1
I have:
and the correct code is:
I just can't see what's wrong with mine.
Edit: I found out what was wrong, apparently the condition for some reason is that wolves<1 which in my head makes no sense since it's rabbits that I'm waiting to be extinct.... my code is fine except that I thought the condition instead of just copying what was there

unfortunately we can't import things since we haven't really 'learned' how to use it, on the test we can only use things that we've been taught.
I have another problem now, it's about lotka-volterra's equations.
if x is rabbits and y are wolves and the eco system variables are
a=3e-2
b=4e-5
c=5e-2
d=6e-6
I have to follow the equation for how it decreases everyday until rabbits are extinct:
x decrease = x(a-by)
y decrease = -y(c-dx)
if there's 300 rabbits and 400 wolves then how many days does it take for it to be rabbits<1
I have:
Code:
a=3e-2
b=4e-5
c=5e-2
d=6e-6
con=300.0
lob=400.0
t=0
while con > 1:
p=con*(a-(b*lob))
q=-lob*(c-(d*con))
con=con-p
lob=lob-q
t=t+1
print 'con=',con
print 't=',t
print 'Los conejos se extinguiran en '+str(t)+' dias'and the correct code is:
Code:
a = 3e-2
b = 4e-5
c = 5e-2
d = 6e-6
x = 300.0
y = 400.0
dias = 0
while y>1 :
xi = x
x = x + x*(a - b*y)
y = y - y*(c - d*xi)
dias += 1
print 'Los conejos se extinguen en', diasEdit: I found out what was wrong, apparently the condition for some reason is that wolves<1 which in my head makes no sense since it's rabbits that I'm waiting to be extinct.... my code is fine except that I thought the condition instead of just copying what was there

