Tuesday, September 27, 2011

Math! Simluation Modeling Exercises 2.1

1. Consider a population [in] which cells divide into 3 every time step. What mathematical model will describe this population? 
x(n) = 3x(n - 1)
= 3[3x(n-2)]
= 3{3[3x(n - 3)]} ...
= a3^n
2. Formulate the model with triple growth in terms of a differential equation and solve it. Is the difference between the discrete and continuous models larger or smaller than in the double growth model?
 x(t + dt) = x(t) + 2x(t)dt
[x(t + dt) - x(t)] / dt = 2x(t)
dx/dt = 2x
dx/x = 2dt ... Integrating gives:
ln x = 2t + C
x(t) = ae^(2t)

Now that we have the continuous and discrete models (ie., continuously compounded vs. compounded once per "t"), I plugged the equations into Excel to see how different they are. And they're hugely different! And the difference is much greater for the tripling equations: there's a million-fold difference between the two computation methods by the 16th generation!


time 2x discrete 2x cont. 3x discrete 3x cont. 2x ratio 3x ratio
1 2.00E+00 2.72E+00 3.00E+00 7.39E+00 1.36E+00 2.46E+00
2 4.00E+00 7.39E+00 9.00E+00 5.46E+01 1.85E+00 6.07E+00
3 8.00E+00 2.01E+01 2.70E+01 4.03E+02 2.51E+00 1.49E+01
4 1.60E+01 5.46E+01 8.10E+01 2.98E+03 3.41E+00 3.68E+01
5 3.20E+01 1.48E+02 2.43E+02 2.20E+04 4.64E+00 9.06E+01
6 6.40E+01 4.03E+02 7.29E+02 1.63E+05 6.30E+00 2.23E+02
7 1.28E+02 1.10E+03 2.19E+03 1.20E+06 8.57E+00 5.50E+02
8 2.56E+02 2.98E+03 6.56E+03 8.89E+06 1.16E+01 1.35E+03
9 5.12E+02 8.10E+03 1.97E+04 6.57E+07 1.58E+01 3.34E+03
10 1.02E+03 2.20E+04 5.90E+04 4.85E+08 2.15E+01 8.22E+03
11 2.05E+03 5.99E+04 1.77E+05 3.58E+09 2.92E+01 2.02E+04
12 4.10E+03 1.63E+05 5.31E+05 2.65E+10 3.97E+01 4.98E+04
13 8.19E+03 4.42E+05 1.59E+06 1.96E+11 5.40E+01 1.23E+05
14 1.64E+04 1.20E+06 4.78E+06 1.45E+12 7.34E+01 3.02E+05
15 3.28E+04 3.27E+06 1.43E+07 1.07E+13 9.98E+01 7.45E+05
16 6.55E+04 8.89E+06 4.30E+07 7.90E+13 1.36E+02 1.83E+06
17 1.31E+05 2.42E+07 1.29E+08 5.83E+14 1.84E+02 4.52E+06
18 2.62E+05 6.57E+07 3.87E+08 4.31E+15 2.50E+02 1.11E+07
19 5.24E+05 1.78E+08 1.16E+09 3.19E+16 3.40E+02 2.74E+07
20 1.05E+06 4.85E+08 3.49E+09 2.35E+17 4.63E+02 6.75E+07


3. Suppose you have $10,000 on your savings bank account with an annual interest rate of 3%. Build a model to calculate your interest earnings in 5 years. What will be the difference in your earnings if the interest is calculated monthly instead of annually? How much does the bank make on your account by calculating the interest monthly, instead of doing it continuously?

Continuous interest accumulates by the formula:
A = Ao x e^(rt)
Where A is the final amount, Ao is the initial amount, r is the interest rate, and t is time elapsed.

So after five years:
A5 = $10,000 x e^(0.03 x 5) = $11,618.34
If the interest is compounded in discrete steps, the operative formula is:

  (thanks, Wikipedia!)
where n is the number of compounding periods per year, in this case 12, so:
A5 = $10,000 x (1 + 0.03/12)^(12 x 5) = $11,616.17
So the bank pockets $2.17 every five years by compounding interest monthly rather than continuously.

Is this discrepancy so much smaller than for the doubling and tripling functions because of the low interest rate? If, instead of a savings account, this were a delinquent credit account that accumulated interest at 28%, after five years, the $10k would be:
Monthly compounding: $39.904.99
Continuous compounding: $40,552.00
Indeed, the difference after five years at 28% (~$550) is about 5% of the initial amount, where the difference after five years at 3% (~$2) is about 0.02% of the initial amount. Since these are exponential functions, as more time elapses, the difference will become more pronounced, as it did in the doubling and tripling exercises.

So the take home message from these exercises seems to be: the greater the rate of change, the more important the time increment.

No comments:

Post a Comment