# How to solve a system of nonlinear equations with a lagged variable?

I have a system of equations (f).
This system has a set of variables, among them the variables (x_t) and (x_{t-1}).
How can I represent the variable (x_{t-1}) within this system?

You mean a discrete dynamical system?

https://diffeq.sciml.ai/stable/types/discrete_types/

Yes.
Using “DifferentialEquations.jl” I understood how to specify a discrete problem (“give no dt and not tstops”).
But I still don’t know how to represent a lagged variable.
Here is an example for illustrative purposes only:

x_{t} = a\cdot y_{t-1}+ b
y_{t} = c\cdot x_{t-1} + d\cdot x_{t} + e
z_{t} = log(x_{t}- y_{t})

João Marcelo develops what I need, but using the R language. He identifies the lagged variables with [-1]

Oh I see, yeah you’ll need to put NonlinearSolve.jl in the right hand side.

That should work. I thought of creating a matrix with the results of NonlinearSolve.jl. Then I could call the elements of the last row of this matrix to be the lagged variables. Among the initial conditions would be these lagged variables.