[Rd] 0.5 != integrate(dnorm,0,20000) = 0

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Dec 7 08:41:16 CET 2010


On Mon, 6 Dec 2010, Spencer Graves wrote:

> Hello:
>
>
>      The example "integrate(dnorm,0,20000)" says it "fails on many systems". 
> I just got 0 from it, when I should have gotten either an error or something 
> close to 0.5.  I got this with R 2.12.0 under both Windows Vista_x64 and 
> Linux (Fedora 13);  see the results from Windows below.  I thought you might 
> want to know.

Well, isn't that exactly what the help page says happens?  That 
example is part of a section entitled

      ## integrate can fail if misused

and is part of the illustration of

      If the function is
      approximately constant (in particular, zero) over nearly all its
      range it is possible that the result and error estimate may be
      seriously wrong.



>
>
>      Thanks for all your work in creating and maintaining R.
>
>
>      Best Wishes,
>      Spencer Graves
> ###############################
>
> integrate(dnorm,0,20000) ## fails on many systems
> 0 with absolute error < 0
>> sessionInfo()
> R version 2.12.0 (2010-10-15)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list