递推方程
问题
有一家汽车租赁公司在奥兰多和坦帕都有分公司。历史数据揭示该公司每天约有60%在奥兰多出租的车辆换到了奥兰多,另外40%还到了坦帕,在坦帕分公司出租的车中,约有70%仍旧还到了坦帕,另外30%的车辆还到了奥兰多。
1. 动力系统模型
graph TD
A[奥兰多] -->|40%| B[坦帕]
B[坦帕] --> |30%| A[奥多兰]
A[奥兰多] -->|60%| A[奥兰多]
B[坦帕] --> |70%| B[坦帕]
2. 令n表示营业天数,定义
On = 第n天营业结束时在奥兰多的车辆数
Tn = 第n天营业结束时在坦帕的车辆数
3. 递推方程
4. 平衡点
平衡点是使系统不再发生变化的On和Tn的值
如果存在这样的平衡点,则同时有O=On+1=On和T=Tn+1=Tn
带入模型,给出下列对平衡点的要求
- 输入
Solve[o == 0.6 o + 0.3 t && t == 0.4 o + 0.7 t, {t, o}]
- 输出
{{o -> 0. + 0.75 t}}
满足这个方程组
5. 解递推方程
利用Rsolve[ ]求解上述递推方程,并令 o[0]=ovalue,t[0]=tvalue
- 输入
RSolve[o[n+1]==0.6o[n]+0.3t[n] && t[n+1]==0.4o[n]+0.7t[n] && o[0]==ovalue && t[0]==tvalue,{o[n],t[n]},n]
- 输出
{{o[n] ->
0.571429 5.6295*10^15^(-1. n) (1. 1.68885*10^15^n ovalue +
0.75 5.6295*10^15^n ovalue - 0.75 1.68885*10^15^n tvalue +
0.75 5.6295*10^15^n tvalue),
t[n] -> -0.571429 5.6295*10^15^(-1. n) (1. 1.68885*10^15^n ovalue -
1. 5.6295*10^15^n ovalue - 0.75 1.68885*10^15^n tvalue -
1. 5.6295*10^15^n tvalue)}}
结果中给出 o[n]与ovalue、t[n]与tvalue 的函数关系
此时我们想要知道第n天奥兰多和坦帕的车辆数,只需要知道第0天时,两地的车辆数即可
6. 分析不同初始情况
奥兰多 ovalue | 坦帕 tvalue | 第0天到第n天 | |
---|---|---|---|
情形 1 | 7000 | 0 | 8 |
情形 2 | 2000 | 5000 | 8 |
我们先用solution1和solution2分别将之前递推方程的解储存起来:
solution =
RSolve[o[n + 1] == 0.6 o[n] + 0.3 t[n] &&
t[n + 1] == 0.4 o[n] + 0.7 t[n] && o[0] == ovalue &&
t[0] == tvalue, {o[n], t[n]}, n];
solution1 = solution[[1]][[1]][[2]];
solution2 = solution[[1]][[2]][[2]];
情形 1
- 输入
data = Table[{n, solution1 /. ovalue -> 7000 /. tvalue -> 0}, {n, 0, 8}]
tdata = Table[{n, solution2 /. ovalue -> 7000 /. tvalue -> 0}, {n, 0, 8}]
ListPlot[{odata, tdata}, PlotRange -> {{0, 9}, {0, 7000}},
PlotMarkers -> Automatic,
Joined -> True,
PlotLegends -> {"奥兰多", "坦帕"}]
-
输出
输出中的表格 {x, y} 代表第x天,该地有多少辆车
情形 2
- 输入
odata = Table[{n, solution1 /. ovalue -> 2000 /. tvalue -> 5000}, {n, 0, 8}]
tdata = Table[{n, solution2 /. ovalue -> 2000 /. tvalue -> 5000}, {n, 0, 8}]
ListPlot[{odata, tdata}, PlotRange -> {{0, 9}, {0, 7000}},
PlotMarkers -> Automatic,
Joined -> True,
PlotLegends -> {"奥兰多", "坦帕"}]
-
输出
7. 初步结论
上述两种情形最后结果(O->4000,T->3000)偏向于平衡点的情况()
该系统平衡点是稳定的,对初始值不敏感