Finite and infinite sums

Dear All,

I am currently working on a New Keynesian model with Dynare. One equation has a particular form. The variable w is forward looking and notably depends on the expected future values for pi in the following way (here I omit arguments that have no impact on my topic):

w_t = E_t [Beta(pi_t+1) + Beta^2(pi_t+1 + pi_t+2) + Beta^3 (pi_t+1 + pi_t+2 + pi_t+3) + Beta^4 (pi_t+1 + pi_t+2 + pi_t+3 + pi_t+4) … up to infinity]

I would be grateful if you could tell me how to write it with Dynare. Especially the way to write the sequence for pi.

Best

Thank you very much for this answer.

In fact, I have already tried to write this equation in a recursive way, as it is suggested in the user guide. However, I was not able to find such a representation, since what happens with pi is not exactly an infinite sum. This is rather an infinity of finite sums (pi_t+1 + pi_t+1 + pi_t+2 + pi_t+1 + pi_t+2 + pi_3 + …).

Note also that the model is already written in a linear form, since pi is the inflation rate.

I think writing the pi in a recursive way would be the solution. But I do not see how to this with this kind of sum.