## Comment: Modelling (Score 1) 1067 1067

I work as a mathematical epidemiologist, modelling disease spread in populations. In my work there are three cases when I encounter divide by zero.

1) Disease transmission. Say you have two types of individual, susceptible and infectious, the numbers of which are given by S(t) and I(t), and the total population size is N=S+I. Diseases typically transmits at a rate beta*S*I/N, where beta is the transmission coefficient. What happens when N=0? In this case we want the transmission rate to also be 0.

2) Poisson distributed random numbers. When events happen randomly at rate lambda, the number of events that occur in a time interval dt is n~Poisson(lambda*dt). When lambda=0, you'd always expect n=0. Strictly speaking the Poisson distribution isn't defined for lambda=0, but the limit as lambda->0 is indeed 0. The GNU Scientific Library, Octave, Matlab, and R all return 0 for Poisson(0), however Julia and Numpy both return an error.

3) Adaptive tau leaping. If you aren't using fixed tau leaping, then you need to work out how big a time step you can safely take, which requires bounding the relative change in a variable. This is done by dividing the variable size by the expected change in that variable, and finding the time step tau, repeating for every variable, and taking the smallest time step you get. In this case, it is entirely possible that the expected time step is zero, say when the population is at equilibrium. This doesn't mean that nothing is happening (you should also check that the variance is bounded), and so here you absolutely need that divide by zero is infinity, and that infinity is greater than any other number you might find.

The first two cases are actually undefined (0/0 is mathematically undefined, since you get different answers depending on how you approach the limit), but the desired outcome is clearly zero. The third case is either 0/0 or x/0, but either way you definitely want to interpret the result as infinity.

In my situation, I just wrote a small function called div0, which I use whenever I expect a divide by zero to occur, and know that I want to interpret that as zero, not infinity.