Open tpapp opened 3 months ago
@tpapp Might the issue be that the f(1)
and f(-1)
are not finite?
julia> function f(x::Real)
A = L = 1.0
x2 = abs2(x)
@show x, x2
@assert x2 ≤ 1
if x2 == 1
y = oftype(A + L + x, Inf)
x < 0 ? -y : y
else
A + L * x / √(1 - x2)
end
end
f (generic function with 1 method)
julia> f(1)
(x, x2) = (1, 1)
Inf
julia> f(-1)
(x, x2) = (-1, 1)
-Inf
Thanks, it is user error then. Is there a way to catch this in the finite differencing method though? Eg check that internal arguments remain isfinite
.
@tpapp It should be fairly simple to add a check whether the function evaluations are finite or not. I suppose that could help. :)
Adapted one-sided differences gives a
NaN
input while receiving finite values from the function.