# How to elegantly transform a model in a recursive equation

I would like to know if there is an elegant way to develop a model as :

$$\begin{array}{l} C_t=cY_{t-1}+C_0,\ I_t= I_0 + \gamma (C_t - C_{t-1}), \ Y_t=C_t+I_t \end{array}$$

to obtain a resursive equation in $Y_t$ which can be put in a natural format to be solved by rsolve(). I can do it in a brute force way. The problem is to cope with the time index.

My problem is the following

Y = Function('Y')
C = Function('C')
I = Function('I')
C(t)=c*Y(t-1)+C_0
I(t)= I_0 - γ* (C(t) - C(t-1))
Y(t)=C(t)-I(t)
A(t)=C(t)-C(t-1)
show(A(t))


Until there no problems. But I do not know you to substite the value of A(t) in I(t)

edit retag close merge delete

Sort by » oldest newest most voted

By a couple of substitutions: $$C_t = c(C_{t-1} + I_0 + \gamma(C_{t-1} - C_{t-2})) + C_0$$ $$=c(1+\gamma)C_{t-1} - c\gamma C_{t-2} + cI_0 + C_0,$$ which then translates into that for $Y$: $$Y_t = c(1+\gamma)Y_{t-1} - c\gamma Y_{t-2} + C_0+I_0.$$ Is this what you want?

more

Yes. My problem is to cope with the indexes from the begining .

( 2023-06-11 15:06:28 +0200 )edit

Max I do not understand this type of answer. I am perfectly able to write the solution on a paper. What I cannot do is to ask sagemath to do it for me.

( 2023-06-12 21:02:19 +0200 )edit

If you need to solve one particular equation, then there is nothing wrong in using some paper. If it's not a single equation, then formulate your general problem and we'll see how sagemath can step in.

( 2023-06-13 16:24:11 +0200 )edit