Re: [R] two dimensional integration

2013-02-17 Thread julia cafnik
This function is separable. If calculating by hand with bounds a <-0 and b <- 1 i got the result: theta / kappa * ( 1 + exp( - kappa) / kappa - 1 / kappa) by putting theta <- 0.1 kappa <-0.3 in the above result I got 0.04535 I implemented it in R this way: integrate(function(y) { sapply(

Re: [R] two dimensional integration

2013-02-17 Thread Berend Hasselman
On 17-02-2013, at 10:01, julia cafnik wrote: > thank for your help. already solved it. > Show us how. So that others looking for answers to similar problems in future can find an answer. Berend __ R-help@r-project.org mailing list https://stat.eth

Re: [R] two dimensional integration

2013-02-17 Thread julia cafnik
thank for your help. already solved it. Cheers, J. On Sun, Feb 17, 2013 at 9:41 AM, Berend Hasselman wrote: > > On 16-02-2013, at 18:01, julia cafnik wrote: > > > Dear R-users, > > > > I'm wondering how to calculate this double integral in R: > > > > int_a^b int_c^y g(x, y) dx dy > > > > wher

Re: [R] two dimensional integration

2013-02-17 Thread Berend Hasselman
On 16-02-2013, at 18:01, julia cafnik wrote: > Dear R-users, > > I'm wondering how to calculate this double integral in R: > > int_a^b int_c^y g(x, y) dx dy > > where g(x,y) = exp(- alpha (y - x)) * b > A very similar question was asked about nine years ago: http://tolstoy.newcastle.edu.a

Re: [R] two dimensional integration

2013-02-16 Thread David Winsemius
On Feb 16, 2013, at 9:01 AM, julia cafnik wrote: > Dear R-users, > > I'm wondering how to calculate this double integral in R: > > int_a^b int_c^y g(x, y) dx dy > > where g(x,y) = exp(- alpha (y - x)) * b > > Thanks for answering! One way would be to install the cubature package. -- Davi

Re: [R] two dimensional integration

2013-02-16 Thread Rui Barradas
Hello, Though I think you should compute that integral symbolically by hand and then define a function with the result, maybe package pracma can do what you want. [functions dblquad(9 and quad2d()] Hope this helps, Rui Barradas Em 16-02-2013 17:01, julia cafnik escreveu: Dear R-users, I'

Re: [R] Two dimensional integration

2012-03-12 Thread baptiste auguie
Hi, Try the cubature package, and maybe play with the tolerance. HTH, b. On 13 March 2012 18:39, Niroshan wrote: > Dear R Members, > > I want to know a fast R function to do multidimensional integration.  I used > the function 'cuhre' in R2cuba library. But it takes painful time to get the > a