[Tutor] Lotka-Volterra Model Simulation Questions

Oscar Benjamin oscar.j.benjamin at gmail.com
Mon Oct 1 10:52:52 CEST 2012

On Oct 1, 2012 12:26 AM, "Alan Gauld" <alan.gauld at btinternet.com> wrote:
> On 30/09/12 11:50, Oscar Benjamin wrote:
>> While I can write a script like the OP's in less than 5 minutes, in
>> practise it takes longer to convince myself that the code is correct (if
>> it is important for it to be so). I spend most of the time when
>> developing such a script simply looking at the code and comparing it
>> with the mathematical problem I was trying to solve.
> Which is great if you understand the problem domain and the math
involved. If you don't you have to rely on getting the algorithm from the
experts and then translating it into something you can work with after the
expert has moved on.

I guess we won't get to find out but I assumed that the OP understood what
he was doing mathematically but was struggling with the Python code: his
code is correct in it's description of the mathematical model but the
integration algorithm had not been implemented. If I was correct about that
then it would have been bad advice to change the variable names. Also (even
if I was correct) it's still very likely that my own post went over his
head because of the level of assumed Python experience.

>> # Lotka-Volterra derivative
>> def f(Z, t):
> Although I would argue that 'f' is still a rotten name
> for any function!
> def lotka_volterra(Z,t):
> would be better. :-)

I'm not sure I would really use f in a real problem but I should say that
it is the mathematical convention to call this particular function f. I'll
meet you (sort of)half way:

def f_lotka_volterra(x, t):

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121001/b2531a60/attachment-0001.html>

More information about the Tutor mailing list