Path: news.mathworks.com!not-for-mail From: "zedong " <zdongwu@gmail.com> Newsgroups: comp.soft-sys.matlab Subject: Re: How to integration a polynomial on a polygon? Date: Mon, 22 Dec 2008 08:14:06 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 47 Message-ID: <gini8e$3mo$1@fred.mathworks.com> References: <gikgkj$4qp$1@fred.mathworks.com> <gikgtu$mfv$1@fred.mathworks.com> <bb03a633-a402-444a-aed7-00ca729eba07@s16g2000vbp.googlegroups.com> Reply-To: "zedong " <zdongwu@gmail.com> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1229933646 3800 172.30.248.38 (22 Dec 2008 08:14:06 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Mon, 22 Dec 2008 08:14:06 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1639198 Xref: news.mathworks.com comp.soft-sys.matlab:508296 Peter <petersamsimon2@hotmail.com> wrote in message <bb03a633-a402-444a-aed7-00ca729eba07@s16g2000vbp.googlegroups.com>... > On Dec 21, 10:06=A0pm, Peter <petersamsim...@hotmail.com> wrote: > > On Dec 20, 8:33=A0pm, "zedong =A0" <zdon...@gmail.com> wrote: > > > > > Could you give me a general algorithm?Or is there any easy implementati= > on? > > > Thank you very much. > > > > Here is another way to approach the problem that allows a systematic > > formulation of a computer program for an arbitrary simple polygon and > > an arbitrary polynomial containing a finite number of coefficients... > > > > Suppose the polynomial you want to integrate is p(x,y). =A0(Example: p > > (x,y) =3D 1 + x +2xy + y^2). > > Compute the polynomials P(x,y) and Q(x,y) such that (d/dy) P(x,y) =3D > > (-1/2) * p(x,y) and (d/dy) Q(x,y) =3D (1/2) * p(x,y). Here (d/dx) means > > the partial derivative with respect to x, and similarly for (d/dy). > > For our example polynomial these are P(x,y) =3D (-1/6)(3y + 3xy + 3xy^2 > > + y^3) and Q(x,y) =3D (1/4)(2x + x^2 + 2yx^2 + 2xy^2). =A0Then the surfac= > e > > integral over the polygon of p(x,y) dx dy is equal to the surface > > integral over the polygon of [(d/dx) Q(x,y) - (d/dy) P(x,y)] dx dy > > which is equal (by Green's theorem in the plane) to the closed line > > integral of [P(x,y) dx + Q(x,y) dy] around the perimeter of the > > polygon in the counter-clockwise direction. =A0This latter integral can > > be written as the sum of the line integrals along each side of the > > polygon. =A0Since each of these is a portion of a straight line, it is > > trivially easy to parameterize and evaluate these integrals (the > > integrand being merely a polynomial, whose anti-derivative can be > > written down immediately). > > > > I've used a similar approach in the past to evaluate the Fourier > > transform of a polygonal functions defined on polygonal domains. =A0The > > resulting formulas are compact and efficient. > > > > Hope this helps, > > --Peter > > After a few more minutes of thought, I realized that you don't need > both P and Q. For instance, if you define Q(x,y) so that (d/dx) Q > (x,y) =3D p(x,y), you can simply choose P(x,y) =3D 0, and you only have a > single function to integrate around the perimeter of the polygon. > > --Peter Thanks you all.I must give my thanks to everybody for paying attention to this message.I can understand it now very clearly.Especially thanks should be given to Roger Stafford and Peter.Thank you for your kind help.