 # Time dependent parameters in ODEs

Hi,
I have read a related post but no solution was provided I believe because the question was not clear. I will try to explain clearly what I am asking here.
The point is that in the code you have to specify something like this:
`dx_dt = x*theta`
But what if I know that the parameter theta has different values at different time points?
`x(t+1)=x(t)*theta[1,t]`
For instance, let’s imagine I know that it has 2 different values, then I could use to 2 parameters doing something like this:
`x(t+1)=x(t)*theta*(t<k)+x(t)*theta*(t>=k)`
where `k` can be fixed or even another parameter.
Is this possible?

Thanks!!!

Hi,
I believe what you propose is - at least technically - possible. Do you have any issues implementing it? I would however worry that if the derivative is not continuous at `k`, it could give the solver a hard time, so I would suggest that you interpolate smoothly between the values.

Does that make sense?

Also note that you can use backticks (`) to mark code in your post making it more legible - I’ve edited the post for you.

1 Like