[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,

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread Ravi Varadhan
] 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 integrate() performs a trick

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread baptiste Auguié
: [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 integrate

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread Matt Shotwell
, 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 explicitly as a limit rather than an arbitrary large number

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread Ravi Varadhan
, 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 explicitly as a limit rather than an arbitrary large number

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread baptiste Auguié
, 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 explicitly as a limit rather than an arbitrary large

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

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),

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