Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Computational modelling techniques

Exercise set 1
Solutions

Hint: For all exercises you may use a standard spreadsheet software.

1. Suppose that during every day of an epidemic:


a. x% of ill people die,
b. y% of ill people recover and become immune, and
c. z% of susceptible people become ill.

(i) Write a model for this system.

( ⁄ ) ( ⁄ ) ( )
( )
( )
( )

= The number of ill people on day n


= The number of susceptible people on day n
= The number of recovered and immune people on day n
= The number of dead people on day n

(ii) Consider that there are 5000 susceptible people to start with and there is no ill
or immune one and assume x=0.25%, y=2%, z=3%. Find the number of ill
people in days 10 and 50 and plot the model (you may use a spreadsheet
calculator).

day 10: 1180.853


day 50: 2048.844

5000

4000

3000
Susceptible
Ill
2000
Immune
Dead
1000

0
0 25 50 75 100 125 150

-1000

1
2. You wish to buy a new car and narrow your choice to Saturn, Cavalier, and Hyundai. Each
company offers you its best deal:

Saturn $13,990 $1000 down 3.5% interest for up to 60 month


Cavalier $13,550 $1500 down 4.5% interest for up to 60 month
Hyundai $12,400 $500 down 6.5% interest for up to 48 month

You are able to spend at most $475 a month on a car payment.


(i) Formulate a dynamical system for the evolution in time of your loan, assuming full
monthly payments of $475 a month (with the possible exception of the last month
when the sum to pay might be lower). How long does it take to pay for each of the
cars? For which car you end up paying the most?

( )

Saturn Cavalier Hyundai


No. of months 28 26 26
Total payment 14081.53 13709.98 12845.88
Extra payment 91.52648 159.9815 445.8751

(ii) What is the minimum you should pay per month for each of the cars so that you
eventually (even if it is after an unreasonably long time) manage to pay the car.

We assume fixed monthly payments, and we impose the condition that in the last allowed
month the remaining sum is 0.
( ) , where x is the monthly interest and m is the monthly payment.

We have an affine dynamical system (see lecture 2):

, whose solution is where

( )
⇔( ) ( ) ⇔
( )
where n is maximum number of months.
Saturn Cavalier Hyundai
minimum monthly payment 236.3108 224.6484 282.2079

(iii) Which car do you buy? Formulate the criterion on which you base your decision.

Saturn, because it has a lower interest rate, and the down payment is less than Cavalier. Also
the extra payment is the lowest for Saturn.

3. The following data were obtained for the growth of a sheep population introduced into a new
environment on the island of Tasmania:

Year 1814 1824 1834 1844 1854 1864


Population 125 275 830 1200 1750 1650

2
Plot the data. Is there a trend? Plot the 10-year change in population versus years elapsed after
1814. Formulate a discrete dynamical system that reasonably approximates the change you
have observed.

Population
2000
1800
1600
1400
1200
1000
Population
800
600
400
200
0
1810 1820 1830 1840 1850 1860 1870

There is a trend: the sheep population appears to reach a maximum level, and the last data
point suggests that the maximum is below 1750.

Years elapsed 0 10 20 30 40
Change pn+1-pn 150 555 370 550 -100

Change in population
600

500

400

300
Change in population
200

100

0
0 10 20 30 40
-100

( ) where k is a constant and M is the maximum level of


supported population.

Plot for values of M in the range 1650-1750 and choose the best k and M.
( )

3
0.0016

0.0014

1660
0.0012
1670

0.001 1680
1690
0.0008 1700
1710
0.0006

0.0004
1810 1815 1820 1825 1830 1835 1840 1845 1850 1855 1860

Model:
( )

2000
1800
1600
1400
1200
1000 Population

800 Prediction

600
400
200
0
1814 1824 1834 1844 1854 1864

4. Your grandparents have an annuity. The value of the annuity increases each month, as 1%
interest on the previous month’s balance is deposited. Your grandparents withdraw $1000
each month for living expenses. Currently, they have $50,000 in the annuity. Model the
annuity with a dynamical system. Find the equilibrium value. What does the equilibrium
value represent for this problem? Build a numerical solution to determine when the annuity is
depleted.

An+1 = 1.01An-1000

For an affine dynamical system the equilibrium value is

equilibrium value = (-1000)/(1-1.01)=100000

4
The equilibrium value represents the initial amount of money for which they wouldn't lose
any of their capital and they would only take the $1000 interest monthly.

( ) ⇔ ( )
⇔ ⇔
The annuity is depleted in the 70th month.

5. You plan to save for your retirement. You want to have enough in the account to draw $1000
a month every month for 20 years. The account pays 0.3% interest per month. You plan to
retire 40 years from now.

a. How much money do you need in the account when you retire so that you have
enough for 20 years after that?

We need to have a sum of money S0 in the account at the beginning of the 20 years.
Each month, the sum of money Sn+1 = 1.003Sn-1000
We have an affine dynamical system (see lecture 2):

The solution is where

By the end of the 20 years (240 months) the account is empty:

⇔ ( ) ⇔ ( )
S0 = 170907.6

b. How much should you deposit per month (fixed sum) during the next 40 years so that
you reach the sum calculated at a.?

After 40 years (480 months) we need to have S0 = $170907.6 in the account, in


this case let b’ denote the amount deposited every month and S’0 = 0 the initial
deposited amount.

⇔ ( )

( )
⇔ ⇔

6. An economist is interested in the variation of the price of a single product. It is observed that
a high price for the product in the market attracts more suppliers. However, increasing the
quantity of the product supplied tends to drive the price down. Over time, there is an
interaction between price and supply. The economist has proposed the following model,
where Pn represents the price of the product at year n, and Qn the quantity:

Pn+1 = Pn - 0.1 (Qn - 500)


Qn+1 = Qn + 0.2 (Pn - 100)

(a) Does the model make sense intuitively? What is the significance of the constants 100 and
500? Explain the significance of the sign of the constants -0.1 and 0.2.

5
Yes, the model is intuitive. The constants 500 and 100 work as thresholds. The
quantity has a positive effect on the price, as long as it does not exceed 500. If the
price is over 100, the quantity will be increased.
The constant -0.1 has to be negative because a big quantity of product takes the
price down. The constant 0.2 has to be positive to show that a high price attracts
more suppliers, thus the quantity increases.

(b) Test the initial condition in the following table and predict the long-term behaviour:

Price Quantity
Case A 100 500
Case B 200 500
Case C 100 600
Case D 100 400

600

500

400

300 Case A: P
Case A: Q
200

100

0
0 5 10 15 20
Case A: represents the stable situation where (100,500) is the equilibrium point. Both price and
quantity remain the same.

6
700

600

500

400
Case B: P
300
Case B: Q
200

100

0
0 5 10 15 20 25
-100
Case B: The initial price is much higher than the equilibrium value, so the demand will be less,
but the quantity increases for a long time, and the price will decrease dramatically.

700

600

500

400
Case C: P
300
Case C: Q
200

100

0
0 10 20 30 40 50 60
-100
Case C: The price is 100 but the quantity is more than 500. The price will decrease until when the
quantity goes below 500, where an increase in the price will be observed. Since it does not come
to the equilibrium point, oscillations can be seen.

7
800

700

600

500

400 Case D: P
300 Case D: Q

200

100

0
0 20 40 60 80
-100
Case D: The price is 100 and the quantity less than 500. The price and quantity will oscillate
more than in the previous case, but in the end there is again a dramatic decrease of the price.

The last plot below shows all four cases with quantity and price plotted against each other
rather than against time. Such plots may provide more insight about the behavior of two
variable models. In our case it shows that the equilibrium point is not stable (all trajectories are
spiraling outward).

700

600

500
A
400
B
300 C
D
200

100

0
-50 0 50 100 150 200 250

You might also like