Chapter 1 Modeling Change

1.1 Modeling changes with difference equations

10. Your grandparents have an annuity. The value of the annuity increases each month by an automatic deposit of 1% interest on the previous month’s 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?

\(\Delta a = a_n - a_{n+1} = 0.01a_n-1000\)

\(a_0 = 50000\)

library(knitr)
library(ggplot2)
annuity <- list()
an <- 50000
while (an > 0){
    an <- 1.01 * an -1000
    annuity <- c(annuity,an)
}

annuity.df <- as.data.frame(annuity)
annuity.df <- rbind(annuity.df,seq.int(ncol(annuity.df))) 
annuity.df <- as.data.frame(t(annuity.df))

colnames(annuity.df) <- c('money','month')
annuity.df <- annuity.df[c('month','money')]
rownames(annuity.df) <- seq.int(nrow(annuity.df))
kable(annuity.df)
month money
1 49500.0000
2 48995.0000
3 48484.9500
4 47969.7995
5 47449.4975
6 46923.9925
7 46393.2324
8 45857.1647
9 45315.7364
10 44768.8937
11 44216.5827
12 43658.7485
13 43095.3360
14 42526.2893
15 41951.5522
16 41371.0678
17 40784.7784
18 40192.6262
19 39594.5525
20 38990.4980
21 38380.4030
22 37764.2070
23 37141.8491
24 36513.2676
25 35878.4002
26 35237.1843
27 34589.5561
28 33935.4517
29 33274.8062
30 32607.5542
31 31933.6298
32 31252.9661
33 30565.4957
34 29871.1507
35 29169.8622
36 28461.5608
37 27746.1764
38 27023.6382
39 26293.8746
40 25556.8133
41 24812.3815
42 24060.5053
43 23301.1103
44 22534.1214
45 21759.4626
46 20977.0573
47 20186.8278
48 19388.6961
49 18582.5831
50 17768.4089
51 16946.0930
52 16115.5539
53 15276.7095
54 14429.4766
55 13573.7713
56 12709.5090
57 11836.6041
58 10954.9702
59 10064.5199
60 9165.1651
61 8256.8167
62 7339.3849
63 6412.7787
64 5476.9065
65 4531.6756
66 3576.9923
67 2612.7623
68 1638.8899
69 655.2788
70 -338.1684
plot(annuity.df$month,annuity.df$money)

From the numerical solution and the plot, we know that the annuity will run out after the 70th month.

1.2 Approximating Change with Difference Equations

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 = 47 ft.

a. Calculate and plot the change \(\Delta a_n\) versus n. Does the graph reasonably approximate a linear relationship?

sq_distance <- c(3, 6, 11, 21, 32, 47, 65, 87, 112, 140, 171, 204, 241, 282, 325, 376)
dt_9 <- data.frame(rbind(seq.int(16),sq_distance))
rownames(dt_9) <- c('n','an')

kable(dt_9)
X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16
n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
an 3 6 11 21 32 47 65 87 112 140 171 204 241 282 325 376
dt_9_long <- as.data.frame(t(dt_9))
dt_9_long$delta_a <- c(diff(dt_9_long$an),NA)

g1 <- ggplot(dt_9_long,aes(n,delta_a))
g2 <- g1 + geom_line()
g2
## Warning: Removed 1 rows containing missing values (geom_path).

The graph reasonably approximate a linear relationship.

b. Based on your conclusions in part (a), find a difference equation model for the stopping distance data. Test your model by plotting the errors in the predicted values against n. Discuss the appropriateness of the model.

The graph is roughly a straight line and pass through origin, so we can find the constant k of the proportional relationship.

k <- mean(dt_9_long$delta_a/dt_9_long$n, na.rm =T)
cat('k =',k)
## k = 3.051394

a difference equation model for the stopping distance data could be written as:

\(\Delta a_n = 3.05n\)

dt_9_long$pred_da <- 3.05*dt_9_long$n

g1 <- ggplot(dt_9_long,aes(n,y=value,color = variable))
g2 <- g1 + geom_point(aes(y = delta_a, col = "delta_a"))
g3 <- g2 + geom_point(aes(y = pred_da, col = "pred_da"))
g3
## Warning: Removed 1 rows containing missing values (geom_point).

The plot shows that the model agree fairly reasonably with the observations up to the speed 14 (14*5 = 70 mph).

Chapter 2. The modeling process, proportionality, and geometric similarity

2.1 Mathematical Models

Problems: For the scenarios presented in Problems 9-17, identify a problem worth studying and list the variables that affect the behavior you have identified. Which variables would be neglected completely? Which might be considered as constants initially? Can you identify any submodels you would want to study in detail? Identify any data you would want collected.

12. A company with a fleet of trucks faces increasing maintenance costs as the age and mileage of the trucks increase.

problem: At what mileage the maintenance cost will surpass the truck’s value?

variables: mileage, age, mileage, brand, industry sector. Assuming the company use the trucks very often, the mileage increases with the age. The age and mileage affect the cost in the same way so only keep one of them as independent variable. Assuming the fleet has the same make and model, brand of the truck is considered as constant initially. The constant k will be different for different carrier operations: less-than-truckload (LTL), full-truckload(TL), and specialized(SP). Therefore, the model will be divided into submodels according to the carrier operations. The problem will be simplified to predict the maintenance costs of the fleet as a function of the mileage of the trucks.

Submodel: maintenance costs of the fleet = cost of LTL + cost of TL + cost of SP

Data to collect: The cost of preventative checking fee, the cost of replacement of major systems (fuel, auxiliary, braking, exhaust, etc.), cabin comfort controls, tires, wheels, rims, fluids, lights, frame and undercarriage, safety features (horn, seat belt, etc.); repair of leaks, mounts, drive shafts, CV joints, belt and hoses.

Reference:

  1. An Analysis of the Operational Costs of Trucking: 2016 Update (American Transport Research Institute). (http://atri-online.org/wp-content/uploads/2016/10/ATRI-Operational-Costs-of-Trucking-2016-09-2016.pdf)

  2. Track Your Truck. (https://www.trackyourtruck.com/blog/top-5-tips-effective-fleet-maintenance-planning/)

2.2 Modeling Using Porpotionality

Problems:In Problems 7-12, determine whether the data set supports the stated proportionality model.

  1. \(y \propto x^3\)

y 0 1 2 6 14 24 37 58 82 114 x 1 2 3 4 5 6 7 8 9 10

dt_tb <- as.data.frame(rbind(c(0, 1, 2, 6, 14, 24, 37, 58, 82, 114),c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)))
rownames(dt_tb) <- c('y','x')
kable(dt_tb)
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
y 0 1 2 6 14 24 37 58 82 114
x 1 2 3 4 5 6 7 8 9 10
dt_tb_long <- data.frame(t(dt_tb))
dt_tb_long$x_3 <- (dt_tb_long$x)^3
ggplot(dt_tb_long,aes(x_3,y)) + geom_line()

From the plot we can see the relationship between \(y\) and \(x^3\) is a straight line passes through the origin. So we can say that the data set supports the proportionality model \(y \propto x^3\).