Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Events through root finding in controller #25

Open
CGMossa opened this issue Jan 17, 2024 · 2 comments
Open

feature: Events through root finding in controller #25

CGMossa opened this issue Jan 17, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@CGMossa
Copy link

CGMossa commented Jan 17, 2024

Hey! First, I'd like to say, that this is a great project, and I was investigating the possibility to write something like this myself, but this is way better than what I would have scraped together.

I'd like to open the discussion, if I may, for adding event / callback functions. This was mentioned in #1.

This is available in the R-package desolve and
the julia package DifferentialEquations.jl as callbacks.

  • stopping the integration before the specified $t_{max}$
  • stopping the integration regardless of $t_{max}$
  • change the state when an event occurs, that is specified as a root for some function

Currently, I make use of the 2nd point, in that I use this to accurately determine a certain duration using deSolve.
E.g.

deSolve::lsodar(
  times = c(0, Inf),
  rootfunc = 
    # estimate for prevalence - prevalence threshold
    ...
)

I'd like to be able to do (2), but (1) and (3) are cool to have. It would be nice to collate thoughts,
ideas, concerns, about this, and maybe eventually someone could do it? I would very much like to
contribute, and if it becomes somewhat clear, what needs to happen, I'd like to do it!

@srenevey srenevey added the enhancement New feature or request label Jan 21, 2024
@srenevey
Copy link
Owner

Hi @CGMossa,

I think it would be a nice addition to implement an event detection mechanism to the crate. I won't have time to work on it myself but feel free to propose an implementation design. For (1) and (2), how is that different than implementing solout for your system?

@CGMossa
Copy link
Author

CGMossa commented Jan 22, 2024

Thanks for the positive reply back! I'm very happy with that. I'm not an expert myself, so I'll take a stab at it.

Right! So with the way I defined deSolve, the system will stop at exactly the root. I will have the exact
time in which the event occurred, and not "just" when we crossed a certain threshold, that is mostly dictated by the stepsize in time.

In my work, I use this time as a measure of how long, numerically exactly, the system spent until it reached this condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants