[R] Double integration using R
R. Michael Weylandt <michael.weylandt@gmail.com>
michael.weylandt at gmail.com
Sun Nov 6 20:56:37 CET 2011
There do exist packages for multi-variate integration in R, but sticking to base functions, what you've described should work but the inner integral will need to be vectorized before it's passes to the outer integral: Vectorize() can do this directly, but it won't be particularly fast since it's not true vectorization. Send real code if this doesn't help and we can take a look at it.
Michael
On Nov 6, 2011, at 12:15 PM, "Robert A'gata" <rhelpacc at gmail.com> wrote:
> Hi,
>
> I have a function that I need to do double integration:
>
> \int^T_0 \int^t_0 N(\delta / \sigma \sqrt(u)) (1-N(\delta / \sigma
> \sqrt(u))) du dt
>
> where N(x) is a standard normal probability of x.
>
> I start off by writing an inner integral into a function. Meaning
> \int^t_0 N(\delta,\sigma \sqrt(u)) (1-N(\delta,\sigma \sqrt(u))) du.
> Then calling integrate function on this function. This straightforward
> way does not seem to work. I am not sure if there is any sample code
> to do such integration? Thank you.
>
> Regards,
>
> Robert
>
> ______________________________________________
> 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.
More information about the R-help
mailing list