[R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
Dear list, I'm seeking some advice regarding a particular numerical integration I wish to perform. The integrand f takes two real arguments x and y and returns a vector of constant length N. The range of integration is [0, infty) for x and [a,b] (finite) for y. Since the integrand has values in

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread David Winsemius
Baptiste; You should see if this meets your requirements: help(adaptIntegrate, package=cubature) (I got errors when I ran the code and NaN's when I looked at the output of test function, f.) vAverage(mixedrule, -4, 4, 0.0, 1, 20, f) - c(pi, pi/2, 2*pi) Error: object 'mixedrule' not found

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread Hans W Borchers
baptiste auguie baptiste.auguie at googlemail.com writes: Dear list, I'm seeking some advice regarding a particular numerical integration I wish to perform. The integrand f takes two real arguments x and y and returns a vector of constant length N. The range of integration is [0,

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
Hi, thanks for the pointer to cubature (which i had probably dismissed too quickly). Your tests with f should not work: the domain of f(x,.) is restricted to positive reals, but this domain of integration is then transformed in mixedrule() to map the semi-infinite range to a more reasonable

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
Thanks, adaptIntegrate() seems perfectly suited, I'll just need to figure a transformation rule for the infinite limit. The suggestion of x-1/x does not seem to work here because it also transforms 0 into -infinity. I think exp(pi* sinh(x)) could be a better choice, according to Numerical Recipes.

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread Hans W Borchers
baptiste auguie baptiste.auguie at googlemail.com writes: Thanks, adaptIntegrate() seems perfectly suited, I'll just need to figure a transformation rule for the infinite limit. The suggestion of x-1/x does not seem to work here because it also transforms 0 into -infinity. I think exp(pi*

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
Thanks. I am having trouble getting adaptIntegrate to work with a multivalued integrand though, and cannot find a working example. Anyone had better luck with it? library(cubature) f - function(x, y) { + res - 1 / (sqrt(x)*(1+x)) + c(res, res/2, 2*res) + } adaptIntegrate(f,

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread Hans W Borchers
baptiste auguie baptiste.auguie at googlemail.com writes: Thanks. I am having trouble getting adaptIntegrate to work with a multivalued integrand though, and cannot find a working example. Anyone had better luck with it? The function to be integrated needs a vector as input: f -

Re: [R] bivariate vector numerical integration with infinite range

2010-09-21 Thread baptiste auguie
Got it, thanks! baptiste On 21 September 2010 22:38, Hans W Borchers hwborch...@googlemail.com wrote: baptiste auguie baptiste.auguie at googlemail.com writes: Thanks. I am having trouble getting adaptIntegrate to work with a multivalued integrand though, and cannot find a working example.