Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6752

Re: How to integrate a function over a polygon

From Andrzej Kozlowski <akoz@mimuw.edu.pl>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to integrate a function over a polygon
Date 2011-11-26 10:14 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jaqe60$nif$1@smc.vnet.net> (permalink)
References <201111250957.EAA11225@smc.vnet.net>

Show all headers | View raw


Well, perhaps you mean this. Let the function be:

f[x_, y_, z_] := x^2 + y^2 + z^2

We want to integrate it over the simplex:  x+y+z==1, 0<=x<=1,0<=y<=1,0<=y<=1

On the simplex the function can be expressed in terms of only x and y as follows:

g[x_, y_] =
 Expand[Last[PolynomialReduce[f[x, y, z], {x + y + z - 1}, {z, x, z}]]]

2*x^2 + 2*x*y - 2*x + 2*y^2 - 2*y + 1

In terms of x and y the simplex can be described as:

cond[x_, y_] := x + y <= 1 && 0 <= x <= 1 && 0 <= y <= 1

So now we simply compute:

Integrate[Boole[cond[x, y]]*g[x, y], {x, 0, 1}, {y, 0, 1}]

1/4


Andrzej Kozlowski


On 25 Nov 2011, at 10:57, Mikael wrote:

> Well, as I wrote in my OP, it is a 2-diemnsional unit simplex so you can always re-parametrize the function to have 2 arguments.
>
> In any case, your answer is not useful unless you had also answered the original question apart from your remark.
>
>> First of all, f would need three arguments.
>>
>> Bobby
>>
>> On Wed, 23 Nov 2011 06:07:00 -0600, Mikael 
>> <mikaen.anderson.1969@gmail.com> wrote:
>>
>>> The subject line asks the general question but to
>> be more specific 
>>> suppose I have a 2-dimentional unit simplex defined
>> as
>>>
>>> Polygon[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}].
>>>
>>> I winder how I can integrate a function f(x,y) over
>> this simplex. Thanks.
>>>
>>
>>
>> --
>> DrMajorBob@yahoo.com
>>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: How to integrate a function over a polygon Andrzej Kozlowski <akoz@mimuw.edu.pl> - 2011-11-26 10:14 +0000

csiph-web