uniroot warning (lack of) (PR#8750)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

uniroot warning (lack of) (PR#8750)

Chris Andrews-2
Full_Name: Chris Andrews
Version: 2.2.1
OS: Windows
Submission from: (NULL) (

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?


# 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)
#[1] -1.663169
#[1] -110.9215
#[1] 2
#[1] 8.336831

> version
platform i386-pc-mingw32
arch     i386          
os       mingw32        
system   i386, mingw32  
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"

[hidden email] mailing list