For Beginners
Challenge 2 – Stories of Fish and Shellfish
In the 1920s, the mathematician Vito Volterra used a mapping, called logistic mapping to explain the periodic fluctuations in fish populations of the Mediterranean.
Consider a population of crustaceans and fish that feed on crustaceans. Let us assume that crustaceans have a small reproduction rate K = 1.01 and its initial population is X = 0.6 (A population normalized with respect to the maximum that might get).
So if we do not consider that there are predators (or that the food is limited), crustaceans grow in population every year K · X. After 10 years the population of shellfish would be K10 · X. A good approximation to the limitations of growth in crustaceans would be that the more of these there are, the less food and more will be attractive to predators. This translates as the population the following year will be K · X · (1-X), or write the mapping as:
Xn = Xn-1 K · · (1-Xn-1)
Hopefully, if K <1, then the population will be reduced, so that over time, gradually the percentage of crustaceans disappear. But what happens if K> 1?
The challenge takes place in several parts. First, you have to see which stocks are obtained for large values of n. If K = 1, if K = 1.5, K = 1.8, if K = 2 if K = 2.5 and if K = 3. Does it converge or not to some value?
The second part of the challenge is to graph its values or convergence of the mapping, for large n, as a function of K. That is, Xn vs K.
The graphics are especially nice and form a fractal with a chaotic region.
Have fun making this program.
Challenge 1 – Square root in Babylon
The calculation of the square root problem is usually tedious for high school students. In ancient times there were no calculators, so having tables of values of the different square roots could be very important in the design of astronomical observatories or other engineering systems.
The Babylonians were pioneers in the development of mathematics and invented one of the most powerful methods to calculate the square root of a number. The method is as follows:
Let x be the number you want to take square root. Let b be an approximation to the square root of x. Then follow the following algorithm:
h = x / b
assign b = (h + b) / 2
h = x / b
if h is approximately the algorithm for b and the root is (h + b) / 2. If not, return to step 2.
As an example we obtain an approximation to the square root of 2. Suppose it is plus or minus 1, then b = 1 and h = 2. In the second and third step, b = (2 +1) / 2 = 1.5 h = 2/1.5 = 1.33333333. As yet the values are so close, we return to step 2.
b = (1.33333333 +1.5) / 2 = 2.83333333 / 2 = 1.41666667 1.41176471 = h = 2/1.41666667. Now values h and b are alike, so we will say that the square root of 2 is approximately (h + b) / 2 = 1.41421569. The real value of the root of 2 is 1.41421356 (with 8 decimal places).
The challenge is to implement a program in any computer language that calculates the square root of a number x, with an error range less than delta, a number that the user of the program decides.
The program should prompt the user for a couple of numbers, x and delta and once entering this data, it should display the result of the value of the root with an error range less than delta. For example, for the values, x = 2, delta = 0.00001, the program throws the result: root = 1.41421569.
This challenge will be trivial for experts, but to the initiated in programming is a good exercise.
Note: Do not use any function like sqrt(x) to calculate the value of x nor to compare the value obtained by the method and the real value of the square root.
No trackbacks yet.