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

Optionally return the smallest interval #170

Closed
MartinOtter opened this issue Feb 2, 2020 · 5 comments
Closed

Optionally return the smallest interval #170

MartinOtter opened this issue Feb 2, 2020 · 5 comments

Comments

@MartinOtter
Copy link

In DifferentialEquations.jl an issue is reported that could probably be solved with a missing option in Roots.jl:

DifferentialEquations.jl uses Roots.jl for event detection: The zero crossing of f(t) defines an event (where t is time). With a bracketing method an interval is computed [t1,t2] in which the root resides. For event handling of differential equations it is important that the root is returned that has an opposite sign as the zero crossing function had before the event. This means that as root t2 should be used, since it is guaranteed that f(t2)*f(t1)<=0. Roots.jl seems to return a more precise approximation of the root t1 <= tstar <= t2, but there is no guarantee that f(tstar)*f(t1) <= 0.

It would be very helpful for DifferentialEquations.jl if an option could be added to Roots.jl so that optionally the interval of the result point is also returned, something like:

tstar, (t1,t2) = find_zero(...; returnInterval=true) 

(info to @ChrisRackauckas)

@jverzani
Copy link
Member

jverzani commented Feb 3, 2020

This is possible, but would require some reworking of the convergence assessment functions to make it happen. At one point, the default for bracketing was bisection, but this was switched to the A42 method, as it typically takes far fewer steps. Do you know which method is called?

There is an issue to consider, as to what to do when an exact 0 is found and not a zero crossing.

@ChrisRackauckas
Copy link
Member

@kanav99

@kanav99
Copy link

kanav99 commented Feb 4, 2020

AlefeldPotraShi is used in DifferentialEquations.

@jverzani
Copy link
Member

jverzani commented Feb 8, 2020

Does #173 provide a reasonable interface for this purpose? It introduces an alternative function Roots.find_bracket to provide the bracket (instead of a keyword argument).

@MartinOtter
Copy link
Author

MartinOtter commented Feb 10, 2020

Does #173 provide a reasonable interface for this purpose? It introduces an alternative function Roots.find_bracket to provide the bracket (instead of a keyword argument).

Thanks very much. Yes, this looks good.

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

No branches or pull requests

4 participants