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. ----------------------------------------------------------------------------------- Ravi Varadhan, Ph.D. 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 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html ------------------------------------------------------------------------------------ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Monday, December 17, 2007 11:03 AM To: r-help@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? Thanks in advance Davide ____________________________________________________________ Tiscali.Fax: il tuo fax online in promo fino al 31 dicembre, paghi 15€ e ricarichi 20€ ______________________________________________ R-help@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. ______________________________________________ R-help@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.