Hi all, This is probably a blindingly obvious question: Why does it matter in the uniroot function whether the f() values at the end points that you supply are of the same sign?
For example: f <- function(x,y) {y-x^2+1} #this gives a warning uniroot(f,interval=c(-5,5),y=0) Error in uniroot(f, interval=c(-5, 5), y = 0) : f() values at end points not of opposite sign #this doesn't give a warning uniroot(f,interval=c(.1,5),y=0) $root [1] 1 $f.root [1] 1.054e-05 $iter [1] 9 $estim.prec [1] 6.104e-05 If I comment out the two lines of script in the uniroot function that produce this warning and create a new function, call it uniroot2, everything works as I'd like. But for didactic purposes, why did the creators of uniroot want the f() values at endpoints to be of opposite sign? Thanks in advance, Matt ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.