- #1
Dustinsfl
- 2,281
- 5
How can I get Mathematica to construct a cobb webb for
$$
N_{t+1} = \frac{(1+r)N_t}{1+rN_t}
$$
$$
N_{t+1} = \frac{(1+r)N_t}{1+rN_t}
$$
dwsmith said:How can I get Mathematica to construct a cobb webb for
$$
N_{t+1} = \frac{(1+r)N_t}{1+rN_t}
$$
[COLOR=#333333][FONT=Courier][B]ClearAll[CobwebPlot][/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B]SetAttributes[CobwebPlot, HoldAll][/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B]CobwebPlot[f_, start_?NumericQ, n_, {xrange:{xmin_, xmax_}, yrange:{_, _}}]:=Module[{[/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]cob[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B], [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]x[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B], [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]g1[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B], [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]coor[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B]},[/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B] [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]cob[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B] = NestList[[/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B][I]f[/I][/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B], [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B][I]start[/I][/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B], [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B][I]n[/I][/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B]];[/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B] [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]coor[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B] = Partition[Riffle[[/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]cob[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B], [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]cob[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B]], 2, 1];[/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B] [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]coor[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B][[1, 2]] = 0;[/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B] [/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B] [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]g1[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B] = Graphics[{Red, Line[[/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]coor[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B]]}];[/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B] Show[{Plot[{[/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]x[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B],[/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B][I]f[/I][/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B][[/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]x[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B]]},{[/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]x[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B],xmin,xmax}, PlotStyle->{{Thick,Black}, Black}, PlotRange->{xrange,yrange}],[/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B]g1[/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B]}]
[/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B]CobwebPlot[-4(-1 + [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B][I]#[/I][/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B]) [/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B][I]#[/I][/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B] -3([/B][/FONT][/COLOR][COLOR=#428957][FONT=Courier][B][I]#[/I][/B][/FONT][/COLOR][COLOR=#333333][FONT=Courier][B] -0.6)^3&, -0.318,10, {{-2, 2}, {-1,2}}][/B][/FONT][/COLOR]
[COLOR=#333333][FONT=Courier][B]][/B][/FONT][/COLOR]
CobwebPlot[.2 #/(1 + .3 #)^{3} &, -1.2, 50, {{-2, 2}, {-2, 2}}]
Cobb-Webbing Mathematica is a mathematical model used to study the dynamics of economic systems. It was developed by American economist Alfred Marshall Cobb and mathematician Paul H. Douglas in the 1920s.
"rNt+1" represents the population size in a given time period (t+1) in the model. It is a variable that is used to measure the growth or decline of populations in an economic system.
Cobb-Webbing Mathematica uses a system of difference equations to predict the changes in population size over time. It takes into account factors such as birth rates, death rates, and resource availability to calculate the value of rNt+1.
Cobb-Webbing Mathematica can be used to analyze and predict the behavior of economic systems, such as markets, industries, and populations. It has also been used to study the effects of government policies and external factors on economic systems.
While Cobb-Webbing Mathematica is a useful tool for studying economic systems, it has its limitations. It assumes that all individuals and firms act rationally and that there is perfect information in the market, which may not always be the case in reality. It also does not take into account external factors such as natural disasters or political events, which can greatly impact economic systems.