Haiyong, There may be better ways, but this what I'd do. (And I'm not an expert on this.)
(a) surround the polygon with a rectangle, (b) define, via an indicator function, a new function that is equal to your desired function within the polygon, and zero outside it, (c) use adapt() to integrate the new function over the whole rectangle. The tricky part is (b). How difficult this is depends on how complicated the polygon is. If it's convex then it can be represented by a set of inequalities Ax >= 0 and Bx <= 0. Ted. Haiyong Xu wrote on 02/15/2007 01:06 PM: > Hi there, > > I want to integrate a function over an irregular polygon. Is there > any function which can implement this easily? Otherwise, I am > thinking of divide the polygon into very small rectangles and use > "adapt" to approximate it. Do you have any suggestions to get the > fine division? Any advice is appreciated. > > Haiyong > > ______________________________________________ > R-help@stat.math.ethz.ch 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. > -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia _ and University of Kent, Canterbury, England 'v' - www.pems.adfa.edu.au/~ecatchpole / \ - fax: +61 2 6268 8786 m m - ph: +61 2 6268 8895 ______________________________________________ R-help@stat.math.ethz.ch 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.