initial import
[iDMC.git] / models / Economic / cournot.lua
blob6ad9861d84dd756059eb26d588b5ad5895b0ca51
1 --% ft| BIFURCATION_1 sn| Period~-~doubling~route~to~chaos n| #0 d| 0.01 n| #1 d| 0.01 n| #2 d| 1 n| #3 d| b n| #4 d| 5.77 n| #5 d| 6.25 n| #6 d| -0.01 n| #7 d| 0.17 n| #8 d| 3000 n| #9 d| 200 n| #10 d| x
2 --% ft| TRAJECTORY_T0_V0_A1_O0 sn| Chaotic~attractor n| #0 d| 0.01 n| #1 d| 0.01 n| #2 d| 1 n| #3 d| 6.2 n| #4 d| 100 n| #5 d| 5000 n| #6 d| 5000 n| #7 d| x n| #8 d| y
3 --@@
4 name = "Cournot Olygopoly"
5 description = "See Model refs in user's guide"
6 type = "D"
7 parameters = {"a", "b"}
8 variables ={"x", "y"}
10 function f(a, b, x, y)
12 if (a*y <= 1) then
14 x1= math.sqrt(y/a)-y
16 else
18 x1=0
20 end
22 if (b*x <= 1) then
24 y1= math.sqrt(x/b)-x
26 else
28 y1=0
30 end
33 return x1, y1
35 end
39 function Jf(a,b,x,y)
42 if (a*y <= 1) then
44 dxdy =math.sqrt(1/(4*a*y))-1
46 else
48 dxdy = 0
50 end
53 if (b*x <= 1) then
55 dydx = math.sqrt(1/(4*b*x))-1
57 else
59 dydx = 0
61 end
64 return 0, dxdy,
65 dydx, 0
67 end