Opened 11 years ago

Closed 10 years ago

## #12193 closed defect (fixed)

# Dimension of Polyhedron is not well defined

Reported by: | jipilab | Owned by: | mhampton |
---|---|---|---|

Priority: | major | Milestone: | sage-5.6 |

Component: | geometry | Keywords: | dimension, polytope, polyhedron |

Cc: | Merged in: | sage-5.6.beta3 | |

Authors: | Volker Braun | Reviewers: | David Loeffler |

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | #11634, #13638, #11763 | Stopgaps: |

### Description (last modified by )

Given a vector space V and a polyhedron P, the dimension of P is the dimension of its affine hull, i.e. the smallest affine subspace of V in which P can live. (For a reference, see G.M. Ziegler's book "Lectures on Polytopes" p.5)

Right now, the dimension of a Polyhedron is defined as:

def dim(self): """ Return the dimension of the polyhedron. EXAMPLES:: sage: simplex = Polyhedron(vertices = [[1,0,0,0],[0,0,0,1],[0,1,0,0],[0,0,1,0]]) sage: simplex.dim() 3 sage: simplex.ambient_dim() 4 """ return self.ambient_dim() - self.n_equations()

But this is obviously not the truthful definition. With the way things are now, this leads to various problems such as:

sage: P1=Polyhedron(vertices=[[1,0,0],[0,1,0],[0,0,1]]) sage: P2=Polyhedron(vertices=[[2,0,0],[0,2,0],[0,0,2]]) sage: Inter=P1.intersection(P2) sage: Inter The empty polyhedron in QQ^3. sage: Inter.dim() 1

While the right answer should be -1.

One can produce many other examples...

Apply trac_12193_fix_dimension.patch

### Attachments (1)

### Change History (17)

### comment:1 Changed 11 years ago by

Authors: | → Volker Braun |
---|---|

Dependencies: | → #11763 |

Description: | modified (diff) |

Status: | new → needs_review |

### comment:2 Changed 11 years ago by

I've added a new patch which will stop the patchbot whining about trailing whitespace and commit messages.

Apply trac_12193_fix_dimension-v2.patch

### comment:4 Changed 11 years ago by

Status: | needs_review → positive_review |
---|

### comment:5 Changed 11 years ago by

Dependencies: | #11763 → #11634, #11763 |
---|---|

Milestone: | sage-5.0 → sage-pending |

### comment:9 Changed 10 years ago by

Milestone: | sage-pending → sage-5.5 |
---|

### comment:10 Changed 10 years ago by

Dependencies: | #11634, #11763 → #11634, #13638, #11763 |
---|---|

Milestone: | sage-5.5 → sage-pending |

### comment:11 Changed 10 years ago by

Reviewers: | → David Loeffler |
---|

### comment:13 Changed 10 years ago by

The patchbot found a machine-dependent issue in a cmp() doctest, fixed now.

### comment:15 Changed 10 years ago by

Milestone: | sage-pending → sage-5.6 |
---|

### comment:16 Changed 10 years ago by

Merged in: | → sage-5.6.beta3 |
---|---|

Resolution: | → fixed |

Status: | positive_review → closed |

**Note:**See TracTickets for help on using tickets.

Fixed by attached patch.