I'm would like to do a linear progression for a recursive relation of a consumption function. Combining my program skills and my sparse knowledge of mathematica, I was thinking about doing it in a while-loop as follows:
While[\[CapitalDelta]Cp < 1,
Cp = 0.4 \[CapitalDelta]Y +
0.407 (0.9 Subscript[Yl, -1] + 0.1 Subscript[Wl, -1] - Subscript[
Cp, -1]) + Subscript[Cp, -1];
\[CapitalDelta]Cp = Cp - Subscript[Cp, -1];
W = Subscript[Wl, -1] + (\[CapitalDelta]Y + Subscript[Yl, -1]) - Cp;
Subscript[Wl, -1] = W;
Subscript[Cp, -1] = Cp;
]
Though, it doesn't work.
EDIT: Clearifying----
I have to functions, one that determines consumption (Cp) and one that determines the fortune (Wp). They are recursive in that I need to determine the consumption before I can determine the fortune.
$$ Cp=0.4\Delta Y+0.407(0.9Y_{-1}+0.1Wp_{-1}-Cp_{-1})\\ Wp=Wp_{-1}+Y-Cp $$
The symbol $_{-1}$ states that the data are lagged meaning that it is last years value.
Initially I append the following data to the variables in order for the loop to start, since I would like to project the value of Cp and Wp ten year ahead.
$$ Y_{-1}=1\\ Wp_{-1}=1\\ Cp_{-1}=1\\ \Delta Y=1\\ $$
Then I would like to make a loop that iterates through the functions 10 times, whereas they after each iteration automatically assign the newly calculated value to the lagged variables, being:
$$ Y_{-1}=Y\\ Wp_{-1}=Wp\\ \vdots $$
I would like for $\Delta Y$ to increment by 1% each year automatically as well. How is this possible? Please ask if the question is still unclear.
OBJECTIVE
The purpose of this whole head-ache of mine is to make a prototype of a consumption model of a given society. Therefore, I would like to be able to write the acquired data in a graph, with the percentage of change in the different variables on the Y-axis and the years of projection on the X-axis (i.e. 1, 2, 3, ... 10).
In short, the consumption equation is defined as: $$ dlog(C)=0.4 dlog(Y)+0.407(log(Y_{-1}^{0.9} W_{-1}^{0.1})-0.200 log(C_{-1}))+0.011 $$ Whilst the fortune equation corresponds to: $$ W=W_{-1}+Y+C $$
The reason I've used the above annotation is because I wanted to linearize the consumption equation with the purpose of placing both of the equation in a matrix system (correspondingly $dlog(C)=log(C)-log(C_1)=\Delta C_l,\text{where}C_l=log(C)$). Firstly, though, I wanted to get it to work.
The initial values of the lagged variables are set to 1. In my first example I left out the parameters to simplify the projection. Then, when the system worked, I wanted to add them. Hope it clarifies it well enough.
OBJECTIVE END
----EDIT END
How can I solve this?
Subscript[Cp,-1]
sinceCp
has a value, lets say for example10.1
then what you are really doing isSubscript[10.1, -1]
which I doubt is what you want. Can you describe what you want mathematically, ie the recurrence relation you actually want to solve, and example initial values. Then it will be easy to help you get the correct code. $\endgroup$Attributes@Subscript
isNHoldRest
soc = 3; Subscript[c, 1] // Trace
gives{{c,3},Subscript[3, 1]}
which, as Gabriel says, is probably not what you intended. $\endgroup$Y
and shouldC
inWp
have a lagged subscript? $\endgroup$