On Wed, Feb 13, 2019 at 1:33 PM Daniel Krenn <[email protected]> wrote: > > On 2018-12-05 11:07, Dima Pasechnik 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. > >>>> [...] > >>> > >>> you need an orthonormal transformation, thus potentially square roots, > >>> if you just want to move over to > >>> P.affine_hull() and integrate there. > >> [...] > > 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). > > Why is it of importance that the transformation is orthogonal? (or is it > just a technical restriction as otherwise no matrix is returned at the > moment?)
It's been a while since that exchange, and I blissfully forgot the details, so perhaps my logic was that a non-orthogonal transform might change the measure in some hard to control way --- but perhaps it's merely some kind of re-scaling to be applied (perhaps it would be necessary to integrate each monomial (or a homogeneous component) separately). Dima > > > I'd actually propose to add an option to P.affine_hull() to give the caller > > both A,b and the resulting polytope. > > +1 > > > And perhaps there is a 1-line way to construct the ring homomorphism, too > > (there should be one like this, anyway). > > Would be interesting to know if there is a shortcut for this. > > Best, Daniel -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
