-
Notifications
You must be signed in to change notification settings - Fork 26
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
NaNs inputs to function when using one-sided differences #239
Comments
@tpapp Might the issue be that the 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 |
@tpapp It should be fairly simple to add a check whether the function evaluations are finite or not. I suppose that could help. :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adapted one-sided differences gives a
NaN
input while receiving finite values from the function.The text was updated successfully, but these errors were encountered: