[Date Index]
[Thread Index]
[Author Index]
Simultaneous equations
*To*: mathgroup at smc.vnet.net
*Subject*: [mg25282] Simultaneous equations
*From*: "N.Tsotros" <travis at beackle.fsnet.co.uk>
*Date*: Tue, 19 Sep 2000 03:45:08 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
Hi,
The following problem may, at first sight, look like a "debugging" problem
but, in fact, it is not. I'd therefore be very grateful if you could have a
quick look at it.
Consider the following simple code:
g=0.983; d=0.1; dg=0.1; a=0.36; z=0.2; rtp=0.04; s=g/(1+rtp); prod=1;
r[-1]=0.0434463; c[-1]=0.706982; y[-1]=0.604069;
w[-1]=12.8993; h[-1]=10.4277; q[-1]=1.34837; k[-1]=2.36875;
invgp[-1]=0.0943875;
inv[-1]=0.236875; gp[-1]=0.943857;
For[t=0, t<=400, t++,
tp[t]=0.07,
tc[t]=0.23,
k[t]=y[t-1]+(1+r[t-1])*k[t-1]-c[t-1],
gp[t]=invgp[t-1]+(1-dg)*gp[t-1],
r[t]=a*(1-tp[t]-tc[t])*prod*(k[t]^(a-1))*(gp[t]^z)-d,
q[t]=prod*(k[t]^a)*(gp[t]^z),
y[t]=(1-a)*(1-tp[t]-tc[t])*prod*(k[t]^a)*(gp[t]^z),
invgp[t]=tp[t]*q[t],
h[t]=((1+r[t-1])*(h[t-1]-y[t-1]))/g,
w[t]=h[t]+(1+r[t])*k[t],
c[t]=(1-s)*w[t]
}];
Print[" "]
Print["q k gp "]
Print["_________________"]
For[t=-1, t<=400, t++,
{
var[t,1]=N[q[t]/q[-1],4],
var[t,2]=N[k[t]/k[-1],4],
var[t,3]=N[gp[t]/gp[-1],4],
Print[var[t,1]," ",var[t,2]," ",var[t,3]]
}
]
I want to find how variables like q, k and gp evolve over time (400
periods), from t=0 to t=400. Running the program, however, I find that,
after a few periods, the path (FOR loop) "explodes". The right transition
path should produce a value of unity for all variables in each period t. Any
ideas why is this so? The equations of the program are correct (checked n
times, believe me!) so I wonder whether the problem arises simply because
Mathematica cannot handle these sort of simultaneous calculations, ie.
solving the 9 difference equations in the FOR loop simultaneously.
Any help/reply would be greatly appreciated.
Nick
Prev by Date:
**Re: Service multiple mathlinks**
Next by Date:
**Re: Use of Miscellaneous`RealOnly` Package**
Previous by thread:
**Re: Q: How to avoid WriteBinary to write an extra nul after each call ?**
Next by thread:
**Re: Simultaneous equations**
| |