[Rd] uniroot warning (lack of) (PR#8750)
candrews at buffalo.edu
candrews at buffalo.edu
Wed Apr 5 20:33:10 CEST 2006
Full_Name: Chris Andrews
Version: 2.2.1
OS: Windows
Submission from: (NULL) (128.205.94.95)
The function page for uniroot indicates
If the algorithm does not converge in 'maxiter' steps, a warning
is printed and the current approximation is returned.
I have not been able to get a warning message even when I think I should get one
(see code below).
Perhaps the bug is in the .Internal(zeroin)
or how the warning condition is detected (val[2] < 0)
Perhaps (val[3]>tol) would work?
Thanks,
Chris
# define a function with a root
ff <- function(x) (x-pi)^3
# fail on a warning
options(warn = 2)
# find it
uniroot(ff, c(-10,10))
# start to find it but maxiter is reached (with no warning)
uniroot(ff, c(-10,10), maxiter=2)
# OUTPUT:
#$root
#[1] -1.663169
#
#$f.root
#[1] -110.9215
#
#$iter
#[1] 2
#
#$estim.prec
#[1] 8.336831
> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 2.1
year 2005
month 12
day 20
svn rev 36812
language R
> sessionInfo()
R version 2.2.1, 2005-12-20, i386-pc-mingw32
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
More information about the R-devel
mailing list