next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Polyhedra :: hypercube

hypercube -- Returns the d-dimensional hypercube

Synopsis

Description

Produces the d-dimensional hypercube $[-1,1]^d$. If provided with a scaling factor $s$, the hypercube $[-s,s]^d$ is returned. Alternatively one can specify the edge directly as $[a,b]$, then the hypercube $[a,b]^d$ is returned

i1 : P = hypercube 3

o1 = P

o1 : Polyhedron
i2 : vertices P

o2 = | -1 1  -1 1  -1 1  -1 1 |
     | -1 -1 1  1  -1 -1 1  1 |
     | -1 -1 -1 -1 1  1  1  1 |

              3        8
o2 : Matrix QQ  <--- QQ
i3 : P = hypercube(3,2)

o3 = P

o3 : Polyhedron
i4 : vertices P

o4 = | -2 2  -2 2  -2 2  -2 2 |
     | -2 -2 2  2  -2 -2 2  2 |
     | -2 -2 -2 -2 2  2  2  2 |

              3        8
o4 : Matrix QQ  <--- QQ
i5 : P = hypercube(3,0,1)

o5 = P

o5 : Polyhedron
i6 : vertices P

o6 = | 0 1 0 1 0 1 0 1 |
     | 0 0 1 1 0 0 1 1 |
     | 0 0 0 0 1 1 1 1 |

              3        8
o6 : Matrix QQ  <--- QQ

Ways to use hypercube :

For the programmer

The object hypercube is a method function.