On Wed, Feb 27, 2019 at 1:52 PM Daniel Krenn <[email protected]> wrote:
>
> On 27.02.19 14:34, Dima Pasechnik wrote:
> > On Wed, Feb 27, 2019 at 1:02 PM Daniel Krenn <[email protected]> wrote:
> >> Is there an easy way in SageMath to compute the in- or outward surface
> >> normal vector of these faces of P? (in contrast to doing it all from
> >> scratch). If not, are there methods that might help, so that not
> >> everything needs to be built from scratch?
> >>
> >> Note: What I search for, is a method that works for a general compact
> >> polyghedron in any dimension and their faces of dimension-1.
> >
> >
> > In the full-dimensional case, say, P=polytopes.cube()
> > P.inequalities() is more or less what you need (as they correspond to
> > the facets,
> > a.k.a. faces of codimension 1)
> > e.g. P.inequalities()[0].vector()[1:]
> > (0, 0, -1)
> > is one of the 6 normal vectors.
>
> In the full-dimensional case this indeed is the result.
>
> > I suppose in non-full-dimensional case you still can use
> > P.inequalities() as above,
> > projecting them on the affine hull of P.
>
> Yes, this is the interesting case. The problem then is going back from
> the projection. I guess that orthogonality is ususally destroyed here...
One can ensure it is orthonormal:

sage: P = polytopes.simplex(2)
sage: 
M=P.affine_hull(orthonormal=True,as_affine_map=True,extend=True)[0].matrix()
sage: v=P.inequalities()[0].vector()[1:]
sage: M*(v*M)
(0.6666666666666667?, -0.3333333333333334?, -0.3333333333333334?)
sage: v=P.inequalities()[1].vector()[1:]
sage: M*(v*M)
(-0.3333333333333334?, 0.6666666666666667?, -0.3333333333333334?)
sage: v=P.inequalities()[2].vector()[1:]
sage: M*(v*M)
(-0.3333333333333334?, -0.3333333333333334?, 0.6666666666666667?)

So you get your normal vectors in the subspace parallel to the affine hull of P.

Dima

-- 
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.

Reply via email to