Description
Hello,
I was wondering if there was a way other than
try
find_zero(f, (a,b))
catch
missing
end
to handle the case when there is no root.
To contextualise: I am trying to find the solutions to a parametric integral function. And for a certain range of the parameter the solution does not exists (can be proven theoretically).
Exactly pinning down the critical value of the parameter from which to start looking at the solutions (knowing that they exist) is not always possible. Hence i found myself trying to find zeros in the whole range.
At first i used find_zeros
which in case it doesn't find any root it simply returns an empty array which then can be handled via a simple isempty()
. But when using find_zero
for a parameter value without root, it crashes the whole computation instead of simply returning a return code.
I realise that the convergence error message can be helpful and also needed in other situations.
But maybe it can be changed to return a missing
and print the convergence error as a warning so it doesn't distrupt other routines that implement the function and does not requires the use of try ... catch ... end
.