7 thoughts on “Programming Dynamic Models in Python”

  1. I looked at the code before reading the article and decided not to bother.

    S I R N t .. ?
    sList iList rList?

    Where the f*ck did you learn to program?

  2. @VLDR
    Maybe you missed the part where we explain that this is part of a set of tutorials for those new to programming. Maybe you missed the part where we indicate that these variables are named to correspond with the variables from the differential equation model.

    Or maybe you’re just a troll and missed a proper raising.

  3. Unlike VLDR, I did read the article. I don’t like his tone very much, but he is right that your use of single letter variable names is bad form. Comments are useful for deciphering the code, but susceptibles = 1000 #number of susceptibles, etc. would not add much typing, and would greatly increase legibility.

    Perhaps the most important core tenet of python is that code is read far more often than it is written, so legibility is of paramount importance.

    Other than that, this is a good starting point for new programmers, and I am glad to see python taking such a large role in education nowadays (as opposed to icky icky java).

  4. At my work, we write it first to get the logic working, then re-write to make the code standarized and optimized. So your python code is good.

    What I found meaningful is how you used it. I now something I didn’t before, and thanks to you code, have a starting point should I use need it.

    I’m looking forward to more.


  5. @VLDR
    There’s nothing wrong with this code. S, I and R are obvious acronyms for the numbers of susceptible, infected and recovered. It’s standard to do this (google “SIR model”).

  6. I have to agree with @VLDR. To use long variable names in mathematical formula vcan obscure the formula and introduce mistakes. I am in favour of keeping the code similar to the mathematical formula (but maybe that is because I am a mathematician and write mathematical programs for a living). In other cases, then I think it is good practice to use long and descriptive variable names.

Leave a Reply

Your email address will not be published. Required fields are marked *