I have the following problem:
I have a set of ODEs and some discrete variables which I can solve successfully. Now I want mathematica to check at every $0.1 \,t$ time step, wether it would increase the function $url' [t]$ to decrease the variable $\eta[t]$ and do so, if that's the case.
So I constructed the following
WhenEvent[Mod[t,0.1],If[url'[t] > With[{eta[t] -> 0.9 eta[t]}, url'[t]],
eta[t] -> 0.9 eta[t]]
However I get the error
"Variable NDSolve`SetState[eta[t],0.9 eta[t]] in local
variable specification \{NDSolve`SetState[eta[t],0.9 eta[t]} requires a value."
From what I understand, the braces somehow inhibit the SetState and following reevaluation of the function.
Thank you for your time :)
url'[t]
is treated as a variable, not as a function depending oneta[t]
, you might have to write the formula instead ofWith[..]
(which has incorrect syntax in any case). Also, I can't decipher the error with the information given. I can see what went wrong, but I can't tell why or how to fix it without code that reproduces it. $\endgroup$url'[t]
is treated as a variable. The value is computed once during a step and that value is used throughout the event processing. $\endgroup$