On Tue, Dec 4, 2018 at 4:23 PM Vincent Delecroix
<20100.delecr...@gmail.com> wrote:
>
>
>
> Le 04/12/2018 à 15:36, Dima Pasechnik a écrit :
> > On Tue, Dec 4, 2018 at 1:47 PM Daniel Krenn <kr...@aon.at> wrote:
> >>
> >> For integrating a polynomial over a polyhedron LattE is used but if the
> >> dimension is not full, then it is not implemented, see
> >>
> >>      sage: x, y = polygens(QQ, 'x, y')
> >>      sage: P = Polyhedron(vertices=[[0,0],[1,1]])
> >>      sage: P.integrate(x*y)    # optional - latte_int
> >>      Traceback (most recent call last):
> >>      ...
> >>      NotImplementedError: The polytope must be full-dimensional.
> >>
> >> from
> >>
> >> http://doc.sagemath.org/html/en/reference/discrete_geometry/sage/geometry/polyhedron/base.html#sage.geometry.polyhedron.base.Polyhedron_base.integrate
> >>
> >> I wonder if there is a (simple) way to come around this?
> >>
> >> [I might not be that familiar with integration over polyhedra, but
> >> shouldn't that basically be a somehow "nice" transformation where some
> >> Jacobi-determinant comes into play?
> >
> > you need an orthonormal transformation, thus potentially square roots,
> > if you just want to move over to
> > P.affine_hull() and integrate there.
>
> Of course not. There is a well defined *rational* Lebesgue measure on
> the affine hull H of your polyhedron. Just consider the Lebesgue measure
> so that the lattice Z^d \cap H has covolume 1. With this normalization,
> any integral is rational.
>
Oh, where is the facepalm emoji here...It seems I have to teach
multivariate calculus every year in order not to forget how it all
works :-[

I suppose that in fact everything needed is actually available in Sage
already, just not connected together. Indeed,
(A,b)=P.affine_hull(as_affine_map=True, orthogonal=True)
gives the rational change of coordinates,
and so all you need is to use (A,b) to construct a ring homomorphism from
R[x,y] to R[t], apply it to the integrand, integrate the result over
P.affine_hull(orthogonal=True) # hopefully it would use the same (A,b)
and scale the result by something like the square root of det(AA^T).

I'd actually propose to add an option to P.affine_hull() to give the caller
both A,b and the resulting polytope.

And perhaps there is a 1-line way to construct the ring homomorphism, too
(there should be one like this, anyway).

Dima







> This is what you obtain for the volume (ie integration of the
> constant function 1) with the option measure='induced'.
>
> > But the restriction to full-dimensional isn't really hard to overcome
> > with a generalisation of the method
> > in LattE, and I see how to do this, I think.
> > If anyone cares I could implement this.
>
> If you do anything please respect the convention naming from the
> volume function.
>
> Vincent
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to