Skip to content

[R-sig-dyn-mod] How to solve ODEs with an internal threshold?

1 message · Thomas Petzoldt

#
Hi Lilith,

your script does exactly what is expected from an ODE system, i.e. the 
new state depends on the *past* state and the derivatives. You cannot 
set a new state directly to a fixed value in a "pure" ODE system.

Fortunately, package deSolve has a solution for your problem, called 
"root finding" in combination with "events" -- see example 3 on the 
?events help page.

Hope it helps

Thomas Petzoldt

PS: The list address is r-sig-dynamic-models at r-project.org i.e. without 
"-owner". AN email to "-owners" is only sent to the list moderators.
On 10/31/2012 6:31 PM, Lilith wrote: