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

Advice about time-based 'events' #504

Open
breisfeld opened this issue Sep 28, 2024 · 2 comments
Open

Advice about time-based 'events' #504

breisfeld opened this issue Sep 28, 2024 · 2 comments
Labels
question User queries

Comments

@breisfeld
Copy link

Hi, I am excited to try difftrax for my application, but am wondering about the recommended approach for the following.

I have an initial value ODE model that describes drug concentrations in various parts of the body over time. At various prescribed intervals, and for various durations, an additional amount of drug is added to a part of the body.

For example:
Dose 1: magnitude = 1, time =5, duration= 15
Dose 2: magnitude = 2, time =25, duration= 30
Dose 3: magnitude = 3, time = 100, duration = 0.1

Is there a way to specify certain 'special' time points (in the above example, these would be t = 5, 20, 25, 55, 100, 100.1) such that the integration will be sure to include them?

Alternatively, I suppose that I could break the integration into numerous pieces, each of which would include a separate dosing, or not, regigon.

Your advice would be greatly appreciated on the best way to handle the situation.

Thank you!

@patrick-kidger
Copy link
Owner

That is, you want the numerical solver to step exactly to those locations? For that you want either difrrax.StepTo or diffrax.StepSizeController(... step_ts=..., jump_ts=...), depending on desired behavior!

@patrick-kidger patrick-kidger added the question User queries label Sep 28, 2024
@breisfeld
Copy link
Author

Thank you! I'll try your suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question User queries
Projects
None yet
Development

No branches or pull requests

2 participants