[apologies for possible multiple post]
Hi
The manpage for integrate() does not mention imaginary numbers. 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)
One can write a little wrapper, but it's not straightforward. Would it be hard to accommodate such functions in integrate()?
Some other functions returning complex values cause integrate() to trip up:
> integrate(function(x){exp(1i*x)},0,1)
Error in integrate(function(x) { : maximum number of subdivisions reached
-- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre European Way, Southampton SO14 3ZH, UK tel 023-8059-7743
______________________________________________ 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