[R] integrate() and complex values
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Jan 11 13:21:56 CET 2005
On Tue, 11 Jan 2005, Robin Hankin wrote:
> The manpage for integrate() does not mention imaginary numbers.
The help page does say
f: an R function taking a numeric first argument and returning a
numeric vector of the same length.
and in R complex numbers are not numeric (see ?numeric). So you are
misusing it,
> I found the following unexpected:
>
> > integrate(function(x){0*x+1+1i},0,1)
> 1 with absolute error < 1.1e-14
> >
>
> (I would expect 1+1i here)
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list