[R] Double Infinite Integration
David Winsemius
dwinsemius at comcast.net
Thu Dec 5 18:35:34 CET 2013
On Dec 4, 2013, at 12:07 PM, Aya Anas wrote:
> Hello all,
>
> I need to perform the following integration where the integrand is the
> product of three functions:
> f(x)g(y)z(x,y)
Since f(x) does not depend on y, could you not do:
Int( f(x) * Int( Int( g(y)*z(x,y).dy)).dx) # not R code
Then use the standard approaches described in several postings to R-help over the years. I'm not a mathematician so anyone is free to correct this.
>
> the limits of x are(0,inf) and the limits of y are(-inf,inf).
>
> Could this be done using R? I tried using the function integrate 2 times,
> but it didn't work:
> z<- function(x,y) {
>
>
> }
What we see above is empty space where a body of a function should be.
> f<-function(x){
> rr<-"put here the function in x" *integrate(function(y) z(x, y),
> -Inf,Inf)$value
> return(rr)
> }
Surely you didn't enter that!
>
> rr2<-integrate(function(x) f(x), 0, Inf)$value
> print(rr2)
Perhaps using a more modern tool would be quicker than learning how to do multiple integration with `integrate()`:
http://cran.r-project.org/web/packages/cubature/index.html
>
> I didn't get any output at all!!!
Rather that send extraneous exclamation marks, please read the Posting Guide and learn how to get your mail client to send plain text so that the full R code can flow freely onto our devices from yours.
>
> Thanks,
> Aya
>
>
> --
> Best Regards
>
> [[alternative HTML version deleted]]
No, no, no.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
\/\/\/\/\/\/\/
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
/\/\/\/\/\/\/\
> and provide commented, minimal, self-contained, reproducible code.
--
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list