# [R] integration

Tue Dec 18 15:46:47 CET 2007

Hi Davide,

It is difficult to say what the problem is without knowing more about the nature of the integrand.  So, you should do a couple of preliminary things before attempting compute the integral.

First, is the integral is finite? You should establish this.  Second, plot the integrand over the entire interval.  Then you need to think about the following: Is the integrand unimodal, with the mass concentrated over a small region? Or is it multimodal? Does it have thick tail?

Assuming that the integral is finite, you could try a few things:
1.  Divide the interval of integration into several small intervals (say, 10 or 100), and then use integrate() on each and then add up the results.  You can make this process more efficient if you know where the mass is concentrated.
2.  Transform the integrand.
3.  Try a simple trapezoidal rule quadrature.

Ravi.

-----------------------------------------------------------------------------------

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

------------------------------------------------------------------------------------

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of dlavecchia at tiscali.it
Sent: Monday, December 17, 2007 11:03 AM
To: r-help at r-project.org
Subject: [R] integration

Dear All,
I need to perform a numerical integration of one dimensional
fucntions. The extrems of integration are both finite and the functions
I'm working on are quite complicated. I have already tried both area()
and integrate(), but they do not perform well: area() is very slow and
integrate() does not converge. Are in R other functions for numerical
integration of one dimentional functions?

Davide

____________________________________________________________
Tiscali.Fax: il tuo fax online in promo fino al 31 dicembre,
paghi 15€ e ricarichi 20€

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help