On 2012-06-16, Alastair Irving <[email protected]> wrote: > Hi > > I want to numerically evaluate the integral of a function f(x,y) over a > region defined by linear inequalities, for example > 1/8<=y<=x<=1/3 > x+y<=1/3. > I can do this with a repeated call to numerical_integral because I can > re-write the constraints as y<=min(x,1/3-x). However, this solution > isn't very satisfying in general. If I have more constraints and/or > more variables then working out the limits on the repeated integrals by > hand is going to be rather unpleasant. > > Is there any way I can get sage to compute the integral directly from > the inequalities. For example, if I use a Polyhedron object to store > the region of interest is there any way of getting functions from it > which describe the limits of integration? Ideally, if P is a Polyhedron > it would be nice to have something like P.integral(f) which computes the > integral of f over P.
there are plans to create a Sage interface to LattE Integrale, a package that can in particular solve these kinds of tasks. (see http://www.math.ucdavis.edu/~latte/) For the time being you can roll your own, at least for compact P: compute a triangulation of P and for each simplex of triangulation use an explicit formula. HTH, Dmitrii > > Many thanks > > Alastair Irving > -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
