Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread Duncan Murdoch
On 21/09/2010 1:29 PM, baptiste auguie wrote: I see, thank you. I'm still worried by the very dramatic error I obtained just from shifting so slightly the support of the integrand, it took me a while to figure what happened even with this basic example (I knew the integral couldn't be so small!

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread baptiste auguie
I see, thank you. I'm still worried by the very dramatic error I obtained just from shifting so slightly the support of the integrand, it took me a while to figure what happened even with this basic example (I knew the integral couldn't be so small!). For a general integration in [0, infty), ther

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread Thomas Lumley
On Tue, 21 Sep 2010, baptiste Auguié wrote: Thanks, I'll do that too from now on. It strikes me that in a case such as this one it may be safer to use a truncated, finite interval around the region where the integrand is non-zero, rather than following the advice of ?integrate to use Inf as in

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread baptiste Auguié
) > plot(shift, sapply(shift, shiftedGauss)) > > > Hope this helps, > Ravi. > > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of baptiste auguie > Sent: Tuesday, September 21, 2010 8:38 AM >

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread Ravi Varadhan
half Of baptiste auguie Sent: Tuesday, September 21, 2010 8:38 AM To: r-help Subject: [R] puzzle with integrate over infinite range Dear list, I'm calculating the integral of a Gaussian function from 0 to infinity. I understand from ?integrate that it's usually better to specify Inf expli

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread Matt Shotwell
ilto:r-help-boun...@r-project.org] On > Behalf Of baptiste auguie > Sent: Tuesday, September 21, 2010 8:38 AM > To: r-help > Subject: [R] puzzle with integrate over infinite range > > Dear list, > > I'm calculating the integral of a Gaussian function from 0 to >

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread baptiste Auguié
ct.org] On > Behalf Of baptiste auguie > Sent: Tuesday, September 21, 2010 8:38 AM > To: r-help > Subject: [R] puzzle with integrate over infinite range > > Dear list, > > I'm calculating the integral of a Gaussian function from 0 to > infinity. I understand from

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread Ravi Varadhan
ct: [R] puzzle with integrate over infinite range Dear list, I'm calculating the integral of a Gaussian function from 0 to infinity. I understand from ?integrate that it's usually better to specify Inf explicitly as a limit rather than an arbitrary large number, as in this case integr

[R] puzzle with integrate over infinite range

2010-09-21 Thread baptiste auguie
Dear list, I'm calculating the integral of a Gaussian function from 0 to infinity. I understand from ?integrate that it's usually better to specify Inf explicitly as a limit rather than an arbitrary large number, as in this case integrate() performs a trick to do the integration better. However,