Does R have a known problem with uniroot and handling floating points?
>str(uniroot(function(x) x*(x^2-1) + .5, lower = -2, upper = 2,
+ tol = 0.0001))
List of 4
$ root : num -1.19
$ f.root : num -2.55e-07
$ iter : int 7
$ estim.prec: num 5e-05
> -1.19 * ( 1.19 ^ 2 - 1 ) + 0.5
[1] 0.004841
Clearly the value of f.root
is not equal to the value of the function calculated by hand.