@njit
def tinker_bell_map(X, params, out):
    out[0] = X[0] ** 2 - X[1] ** 2 + params[0] * X[0] + params[1] * X[1]
out[1] = 2 * X[0] * X[1] + params[2] * X[0] + params[3] * X[1]

def simulator_factory(f):

    def simulator(x0, params, x):
        for i in range(2):
            x[i, 0] = x0[i]
for t in range(1, x.shape[1]):
    f(x[:, (t - 1)], params, x[:, (t)])
return x
return njit(simulator)
xs = np.zeros((2, 10))
sim = simulator_factory(tinker_bell_map)
print(sim(x0, params, xs))
Efficient simulation of arbitrary dynamical system in Python via numba?