run_simu expects numpy or python values for theta2 and theta3, but it gets symbolic theano variables. So your loop doesn’t work as it should. If final_t is small, you could just use a loop anyway, and build up a large theano graph that contains an unrolled version of that loop. So something like this:
records = []
z_t = z0
for day in range(final_t):
z_t = z_t * params['theta2'] + np.sin(2 * np.pi * day / params['theta3']) + params['theta1']\
* np.cos(2 * np.pi * z_t)
records.append(z_t)
return tt.concatenate(records)[dates]
The graph size will grow linearly with final_t however. So if that is large you need to explain the loop itself to theano. theano.scan does that: http://deeplearning.net/software/theano/library/scan.html
You could also use theano.as_op, but unless you want to implement the gradients on your own, most samplers won’t work with that.
This might help you to understand theano a bit better: https://docs.pymc.io/PyMC3_and_Theano.html