Use values computed in ODETerms inside of SaveAt
Hi, I would like to save some values that are computed inside of my ODETerms. Is it possible to have the term output other things than the differential equations parameters ? For example, if my term looks like this.
def terms(t,y,args):
y_dot = y + args
args_changed = args / y_dot
return y_dot
Would it be possible to save args_changed and use it inside of SaveAt? (This is a dummy example but it captures the idea)
You can use SaveAt(fn=...). This is a separate function to the one used in the vector field.
In general we don't allow saving extra values from the vector field. The reason is that the times at which this is evaluated are frequently not the same as the times at which we output values.
Is there a way to have access to y_dot inside of SaveAt ?
No. As above this is intended -- the values at which you save may not be the values at which you evaluate the vector field. So there's no way to map the values from one to the other.
Is there a way to have access to y_dot inside of SaveAt ?
Maybe what you want to do is putting the option "steps=True" to sync the values at which you save to the values that you evaluate.