Friday, 25 June 2021

Dying Rabbits

The title of this post may seem unusual for a mathematical blog but rabbits of course have a close association with the Fibonacci sequence. Well live, reproducing rabbits at least. The following explains what the rabbits are all about (source):

Fibonacci's Rabbits

In the West, the Fibonacci sequence first appears in the book Liber Abaci (1202) by Leonardo of Pisa, known as Fibonacci. Fibonacci considers the growth of an idealized (biologically unrealistic) rabbit population, assuming that:
    1. a single newly born pair of rabbits (one male, one female) are put in a field;
    2. rabbits are able to mate at the age of one month so that at the end of its second month a female can produce another pair of rabbits;
    3. rabbits never die and a mating pair always produces one new pair (one male, one female) every month from the second month on.
The puzzle that Fibonacci posed was: how many pairs will there be in one year?


Suppose we let the number of rabbit pairs in the field at the end of the nth month be denoted by \(F_n\).

Consider just the new "baby rabbit pairs" in the nth month. They must be equal in number to the pairs of rabbits that are mature enough to give birth to baby rabbits. This, of course, is precisely the number of rabbit pairs alive two months previously, \(F_{n−2}\).

Now the total number of rabbit pairs in the nth month is the number of pairs alive in the previous month (i.e., \(F_{n−1}\)) plus the number of new baby rabbit pairs, \(F_{n−2}\).

Thus, we have the following recursive definition for the nth Fibonacci number: $$F_0=F_1=1 \text{ and } F_n=F_{n−1}+F_{n−2}$$

The assumption that "rabbits never die" is big presumption for they do die and the formula for the Fibonacci sequence can be modified to account for this. I discovered this because my diurnal age at the time of writing this post is 26381 and this number happens to be a member of OEIS A023440:


 A023440

Dying rabbits: a(n) = a(n-1) + a(n-2) - a(n-10)                      


The sequence members, up to 26381, are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 88, 142, 228, 367, 590, 949, 1526, 2454, 3946, 6345, 10203, 16406, 26381.

The sequence is identical to the Fibonacci up to to the 10th term (55): 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 88, … because a(10) = a(9) + a(8) - a(0) = 34 + 21 - 0 = 55. However, with a(11) = a(10) + a(9) - a(1) = 55 + 34 - 1, it begins to differ because the oldest generation of rabbits dies off.

It’s easier to generate the terms using the generating function rather than a recursive sequence. In the case of OEIS A023440, this generating function is:$$\frac{x}{(x - 1)(x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 - 1)}$$Here is the SageMath code to generate the terms together with a permalink :

L, k=[], var('k')
S=sum(x^k for k in [2..9])
P=x/((x - 1)*(S - 1))
T=taylor(P,x,0,23).coefficients()
for t in T:
    L.append(t[0])
print(L)

It is easy to generalise this function to accommodate longevities other than 10. For example, changing the 9 to an 8 in the code above will generate OEIS A023439:

 
 A023439

Dying rabbits: a(n) = a(n-1) + a(n-2) - a(n-9)                        


Here is the SageMath code together with a permalink:

L, k=[], var('k')
S=sum(x^k for k in [2..8])
P=x/((x - 1)*(S - 1))
T=taylor(P,x,0,23).coefficients()
for t in T:
    L.append(t[0])
print(L)

There are OEIS sequences corresponding to a(n-3) to a(n-12). Of course the ratio of successive terms doesn't approach the golden ratio as it does with the Fibonacci terms. In the case of OEIS A023440, the ratio approaches 1.6079827279... rather than 1.6180339887... and in the case of OEIS A023439, the ratio approaches 1.6013473338...

So that's the story of the dying rabbits.

No comments:

Post a Comment