-
Notifications
You must be signed in to change notification settings - Fork 37
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
Error root #173
Comments
Why not opening an issue in julia> using Measurements
julia> a = measurement(1.0 , 0.1)
1.0 ± 0.1
julia> b = measurement(-3.0 , 0.1)
-3.0 ± 0.1
julia> c = measurement(-10.0, 0.1)
-10.0 ± 0.1
julia> f(x) = a*x^2 + b*x + c
f (generic function with 2 methods)
julia> f(-2.0)
0.0 ± 0.46
julia> f(-1.58)
-2.76 ± 0.31 |
I tried to reduce the code to using Roots, Measurements
using Measurements, Roots
a = measurement(1.0 , 0.1)
b = measurement(-3.0 , 0.1)
c = measurement(-10.0, 0.1)
x0 = measurement(0.0, 0.1)
f(x) = a*x^2 + b*x + c
# Compare with function which doesn't have uncertainties
g(x) = Measurements.value(a*x^2 + b*x + c)
𝑭𝑿 = ZeroProblem(f, x0)
𝑮𝑿 = ZeroProblem(g, x0)
M = Order0()
p = nothing
verbose = false
tracks = Roots.NullTracks()
Zf = Roots.init(𝑭𝑿, M, p; verbose, tracks)
solve!(Zf; verbose)
Zg = Roots.init(𝑮𝑿, M, p; verbose, tracks)
solve!(Zg; verbose) but now I'm lost in |
Perhaps one relevant thing is that julia> iszero(measurement(0, 0.1))
false
julia> measurement(0, 0.1) == 0
false
julia> isequal(measurement(0, 0.1), 0)
false which may screw up some logic in |
Hello Giordano. I forgot to comment: the error in the value only appears when the uncertainties are declared. |
Okay, I understand. The result was consistent and so were the uncertainties. Thank you for your response. |
An error occurs when using Roots.jl to solve an equation, the result should be -2.0, not -1.58.
The text was updated successfully, but these errors were encountered: