Академический Документы
Профессиональный Документы
Культура Документы
Solutions
Page 8: #10
10. Your grandparents have an annuity. The value of the annuity increases each month by an automatic
deposit of 1% interest on the previous months balance. Your grandparents withdraw $1000 at the
beginning of each month for living expenses. Currently, they have $50,000 in the annuity. Model the
annuity with a dynamical system. Will the annuity run out of money? When? Hint: What value will
an have when the annuity is depleted?
Giordano, Frank R.; Fox, William P.; Horton, Steven B. (2013-02-14). A First Course in Mathematical
Modeling (Page 8). Cengage Textbook. Kindle Edition.
Dynamical system model:
an+1 = an + 0.01 an 1000,
a0 = 50000
# Starting value
annuity = c(50000)
# x axis
month = 0:(length(annuity) - 1)
# plot
plot(month, annuity)
abline(h=0, col="red")
1
50000
30000
annuity
10000
0
0 10 20 30 40 50 60 70
month
Page 17: #9
9. The data in the accompanying table show the speed n (in increments of 5 mph) of an automobile and
the associated distance an in feet required to stop it once the brakes are applied. For instance, n = 6
(representing 6 x 5 = 30 mph) requires a stopping distance of a6 = 47f t.
n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Giordano, Frank R.; Fox, William P.; Horton, Steven B. (2013-02-14). A First Course in Mathematical
Modeling (Page 17). Cengage Textbook. Kindle Edition.
a. Calculate and plot the change an versus n. Does the graph reasonably approximate a linear relation-
ship?
2
# initialize differences vector
delta <- numeric()
# compute differences
for(i in n){
diff <- braking.distance[i+1] - braking.distance[i]
delta <- c(delta, diff)
}
#plot
plot(n, delta,
xlab = "n", ylab = "delta a[n]",
main = "delta a[n] vs n")
abline(lm1, col="blue")
delta a[n] vs n
50
40
delta a[n]
30
20
10
2 4 6 8 10 12 14
Visually you can see that the graph reasonably approximates a linear relationship.
b. Based on your conclusions in part (a), find a difference equation model for the stop- ping distance data.
Test your model by plotting the errors in the predicted values against n. Discuss the appropriateness of
the model.
3
Based on the relationship established in part a:
an+1 an = k n + C, where k = 3.25 and C = 1.1 So the difference equation model is:
an+1 = 3.25 n + an + (1.1)
Generating values with this model and calculating the errors at each point we have:
a0 = 0
k = lm1$coefficients[2]
intercept = lm1$coefficients[1]
predicted.dist = k * 1 + a0 + intercept
# plot errors
plot(predicted.dist - braking.distance)
predicted.dist braking.distance
2
1
0
1
2
5 10 15
Index
4
300
braking.distance
200
100
0
5 10 15
Index
From an intuitive perspective this model makes sense. It is acurately capturing the growth. It corresponds
quite well to the data we have. It is reasonable to assume that as speed continues to increase, the stopping
distance will also continue to increase in this manner, i.e. unlike the examples, there would not be a limit to
the the stopping distance. On the low end, we would expect the braking distance to be 0 when your speed is
zero. This model has a slight error there, but introducing that error leads to much better agreement with the
other data.
13. Consider the spreading of a rumor through a company of 1000 employees, all working in the same
building. We assume that the spreading of a rumor is similar to the spreading of a contagious disease
(see Example 3, Section 1.2) in that the number of people hearing the rumor each day is proportional to
the product of the number who have heard the rumor previously and the number who have not heard
the rumor. This is given by
rn+1 = rn + k rn (1000 rn )
where k is a parameter that depends on how fast the rumor spreads and n is the number of days.
Assume k = 0.001 and further assume that four people initially have heard the rumor. How soon will
all 1000 employees have heard the rumor?
Giordano, Frank R.; Fox, William P.; Horton, Steven B. (2013-02-14). A First Course in Mathematical
Modeling (Page 34). Cengage Textbook. Kindle Edition.
5
while(r[length(r)] < 1000){
r[length(r) + 1] <- r[length(r)] + k * r[length(r)]*(1000 - r[length(r)])
# print(c(r[length(r)], k, (1000 - length(r))))
}
plot(day, r)
abline(h=999, col="red")
1000
800
600
r
400
200
0
0 2 4 6 8 10 12 14
day
By the 11th day, all employees will have heard the rumor.
Page 55: #6
6. An economist is interested in the variation of the price of a single product. It is ob- served 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 represents the quantity. Find the equilibrium values for this system.
a. Does the model make sense intuitively? What is the significance of the constants 100 and 500? Explain
the significance of the signs of the constants -0.1 and 0.2.
6
b. Test the initial conditions in the following table and predict the long-term behavior.
Price Quantity
Giordano, Frank R.; Fox, William P.; Horton, Steven B. (2013-02-14). A First Course in Mathematical
Modeling (Page 55). Cengage Textbook. Kindle Edition.
For equilibrium, Pn+1 = Pn = P and Qn+1 = Qn = Q so we have:
P = P 0.1(Q 500)
Q = Q + 0.2(P 100)
or
0.1(Q 500) = 0 Q = 500
0.2(P 100) P = 100
(a) Does the model make sense intuitively? What is the significance of the constants 100 and 500? Explain
the significance of the signs of the constants -0.1 and 0.2.
The model make sense in that it captures the relationship proposed by the economist. The 100 and 500 set
the equilibrium values for price and quantity and the -0.1 and 0.2 determine how strongly or quickly the
model reacts to changes away from those quantities. From the first equation, there is downward pressure on
price when the quantity is above 500 and upward pressure on price when quantity is below 500 (that is the
significance of the sign of -0.1). From the second equation this is reversed due to the difference in the sign of
0.2. When the price is above 100, there is upward pressure on quantity and when the price is below 100 there
is downward pressure on quantity.
7
# Plot parameters
y.limits <- c(-400, 1000)
In the following graphs, price is shown in red and quantity is shown in blue:
# Case A
response.A <- simulation(time.steps, 100, 500)
Case A
1000
600
response.A[[1]]
0 200
400
# Case B
response.B <- simulation(time.steps, 200, 500)
8
Case B
1000
600
response.B[[1]]
0 200
400
# Case C
response.C <- simulation(time.steps, 100, 600)
9
Case C
1000
600
response.C[[1]]
0 200
400
# Case D
response.D <- simulation(time.steps, 100, 400)
10
Case D
1000
600
response.D[[1]]
0 200
400
In all cases except when the system starts at the equilibrium values, the system is unstable and price and
quantity exhibit a continuously increasing oscillatory pattern as described in part (a). The oscilations are 90
degrees out of phase, which makes sense. Obviously, this model falls apart when it starts predicting negative
prices and quantities. Something should be added to establish upper and lower bounds on price and a lower
bound on quantity.
11