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

Missing code line? #1107

Open
rp-47 opened this issue Mar 1, 2024 · 1 comment
Open

Missing code line? #1107

rp-47 opened this issue Mar 1, 2024 · 1 comment

Comments

@rp-47
Copy link

rp-47 commented Mar 1, 2024

Looking at the code line


and the block following it, I am thinking: Are you missining fmax = fmid; there?

Also, are you sure that the condition

if (max_range_f * min_range_f > 0)

is generally valid and robust? I do get new exceptions because of that. If I ignore them, the root is found as before. (Unfortunately, my solved function can't be easily reproduced for your testing, sorry.)

@jzmaddock
Copy link
Collaborator

and the block following it, I am thinking: Are you missining fmax = fmid; there?

No... I think if anything the fmin = fmid in the following block is superfluous: the only thing fmin and fmax are used for within the inner loop of bisection is to check their sign to see which side of the root mid is.

Also, are you sure that the condition
is generally valid and robust? I do get new exceptions because of that. If I ignore them, the root is found as before. (Unfortunately, my solved function can't be easily reproduced for your testing, sorry.)

Generally, I think error handling here is a good thing - if the test fails then the two end points of the range do not bracket the root, so something has clearly gone wrong. It would certainly be useful to have an example in hand to try and see what has gone wrong, I guess there may be some numerical instability in the function being inverted?

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

2 participants