By definition, the first numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two. (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144… ). It is the reason for nature, if we understand these sequences, we will begin to understand nature.
History
At the beginning of the thirteenth century, a mathematician named Leonardo of Pisa (also known as Fibonacci) introduced a sequence of numbers: 1, 1, 2, 3, 5, 8, 13, 21 ,… 1,1,2,3,5,8,13,21,… in which the pattern is defined as follows: F1=1, F2=1, Fn=Fn−1+Fn−2 F1=1,F2=1,Fn=Fn−1+Fn−2.
This mathematician discovered it in the year 1202, that is, more than 800 years ago and we are still talking about this sequence. The original problem Fibonacci investigated was how quickly rabbits could reproduce under ideal circumstances.
Theoretical rabbits
Suppose a pair of newborn rabbits, a male and a female are placed in a field. Rabbits can mate at the age of one month, so that at the end of their second month a female can produce another pair of rabbits. Our rabbits never die and in addition the female always produces a new pair (a male, a female) every month from the second month. The puzzle that Fibonacci posed was… How many couples will there be in a year?
- At the end of the first month, they mate, but there is still only one couple. (1)
- At the end of the second month, the female produces a new pair, so there are now 2 pairs of rabbits in the field. (2)
- At the end of the third month, the original female produces a second pair, forming 3 pairs in total in the field. (3)
- At the end of the fourth month, the original female has produced another new pair, the female born two months ago also produces her first pair, forming 5 pairs. (5)
This assumption raised has some drawbacks. First… it is unlikely that a pair of rabbits of childbearing age from always litters of 2 rabbits, one female and one male. In addition, we are assuming that siblings must be mated which will lead to obvious genetic problems.
A more realistic assumption, cows
Henry E Dudeney (1857-1930), English mathematician, wrote several excellent puzzle/puzzle books. In one of them he adapts the Fibonacci rabbits to the cows, making the problem more realistic than the way we observed above. He solves the problems by realizing that only females are interesting, I mean the number of females.
He changes months into years and rabbits into bulls (males) and cows (females) in problem 175 of his book 536 puzzles and Curious Problems. If a cow produces its first calf at the age of two and then produces just another calf every year, how many calves are there after 12 years, assuming none die? This is a better simplification of the problem and is now quite realistic. But the Fibonacci sequence does what mathematicians usually do at the beginning, simplify the problem, and see what happens, and the series that bears its name has many other interesting and practical applications, as we will see later.
So, let’s look at another real-life situation that is exactly modeled by the Fibonacci series: bees.
Bees and family trees
There are more than 20,000 species of bees and in most of them bees live solitary lives. But let’s talk about the idea that we all have when we hear the word bees, that is, a type of bee that lives with others in a hive makes honey and they have an unusual family tree. In fact, there are many unusual features of bees and in this section, we will show how Fibonacci numbers count the ancestors of a bee.
- First of all, some unusual facts about bees are that not all of them have two parents.
- In a bee colony there is a special female called a queen bee.
- There are many worker bees that are also female, but unlike the queen bee, they do not produce eggs.
- There are some drone bees that are male and do not work. Males are produced by the queen’s unfertilized eggs, so male bees only have one mother, but not one father!
- All females occur when the queen has mated with one male and therefore has two parents. Females usually end up as worker bees, but some are fed a special substance called royal jelly that makes them grow and become queens ready to start a new colony when the bees form a swarm and leave their home (a hive) in search of a place to build a new nest.
Therefore, female bees have 2 parents, a male, and a female, while male bees have only one parent, a female.
If we look at the family tree of a male bee we must:
- He only had 1 father, one female.
- He has 2 grandparents, since his mother had two parents, a male and a female.
- He has 3 great-grandparents: his grandmother had two parents, but his grandfather only had one.
Again we find the fibonacci numbers. We can summarize it like this:
Number of | Parents | Grandparents | great grandparents | Great-great-grandfather | Great-great-great-grandfather |
a male bee | 1 | 2 | 3 | 5 | 8 |
a female bee | 2 | 3 | 5 | 8 | 13 |
The Fibonacci sequence and the golden number
The Fibonacci sequence is a well-known sequence of integers. The first two terms of the sequence are 0 and 1 and all the others are the sum of the previous two terms. Mathematically, the values of the Fibonacci sequence are given by the function:
f(0) = 0, f(1) = 1, f(n) = f(n – 1) + f(n – 2); n ≥ 2.The quotient of two successive terms converges to (1 + √5) / 2, the Golden number. If we take the ratio of two successive numbers in the Fibonacci series, (1, 1, 2, 3, 5, 8, 13, ..) and divide each by the previous number, we will find the following series of numbers:1/1 = 1, 2/1 = 2, 3/2 = 1.5, 5/3 = 1.666 …, 8/5 = 1.6, 13/8 = 1.625, 21/13 = 1.61538 …
The golden ratio 1.618034 is also called the golden section or the golden mean or simply the golden number or golden number. It is often depicted with a Greek letter Phi. The closely related value we write as phi with a small “p” is only the decimal part of Phi, i.e. 0.618034.
One of the goals of science is to find order in nature. We to better understand it always order it and name it, although we might think that molecules or chemical elements would not be necessary to name them, they are the succession of small changes that make an element called X is called element Y and so on.
How to create the Fibonacci sequence in Python
The following code describes how to create the Fibonacci sequence in Python.
# The Fibonacci series is defined
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' | ')
a, b = b, a+b
print()
# the function is called and we define n
fib(2000)
The result would be: 0 | 1 | 1 | 2 | 3 | 5 | 8 | 13 | 21 | 34 | 55 | 89 | 144 | 233 | 377 | 610 | 987 | 1597 .
The reserved word def is used to define functions. You must follow the name of the function and the list of formal parameters in parentheses. The statements that make up the body of the function begin on the next line, and must be indented. The first statement in the body of the function can optionally be a literal text string; this is the function documentation text string, or docstring.
How to create a Fibonacci sequence in R
The following code in turn describes how to create a Fibonacci sequence in R.
# Succession of Finonacci
# using a recursive definition
f <- function(i) {
if (i<=2) {
a <- 1
} else {
a <- f(i-1) + f(i-2)
}
return(a)
}
#
for (i in 1:20) {print(f(i))}
# Using a loop
tiempo.inicial <- proc.time()
Fibonacci <- rep(NA,20)
Fibonacci[1] <- Fibonacci[2] <- 1
for ( i in 3:20) {
Fibonacci[i] <- Fibonacci[i-2] + Fibonacci[i-1]
}
print(Fibonacci[20])
print(Fibonacci)
tiempo.final <- proc.time()
print(tiempo.final - tiempo.inicial)
Song Often a Bird. Artist Wim Mertens & Wim Mertens Ensemble. Album Jardin clos. Writers: Wim Mertens
I hope you found this post interesting. If so, leave a comment.
Bibliography:
- http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fibnat.html#section1.3.1
- https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4267455/
- https://es.wikipedia.org/wiki/Leonardo_de_Pisa