Opened 3 years ago
Closed 3 years ago
#28770 closed defect (fixed)
Polyhedra coercion of base rings fails for number fields
Reported by: | gh-kliem | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.0 |
Component: | geometry | Keywords: | |
Cc: | jipilab, gh-LaisRast | Merged in: | |
Authors: | Jonathan Kliem | Reviewers: | Léo Brunswic |
Report Upstream: | N/A | Work issues: | |
Branch: | a0068cc (Commits, GitHub, GitLab) | Commit: | a0068ccbab09b0102a64c5fbe4ffaffa71b44086 |
Dependencies: | Stopgaps: |
Description (last modified by )
Currently coercion of polyhedra with number fields does not work. The following results in a type error:
sage: z = QQ['z'].0 sage: K = NumberField(z^2 - 2,'s') sage: K.gen()*polytopes.simplex(backend='field')
But the backend can surely handle it, as the following does work:
sage: z = QQ['z'].0 sage: K = NumberField(z^2 - 2,'s') sage: K.gen()*polytopes.simplex(backend='field', base_ring=K) A 3-dimensional polyhedron in (Number Field in s with defining polynomial z^2 - 2)^4 defined as the convex hull of 4 vertices
The underlying error:
sage: z = QQ['z'].0 sage: K = NumberField(z^2 - 2,'s') sage: parent = polytopes.simplex().parent() sage: parent._coerce_base_ring(K) Rational Field
But it should be K
.
The problem is that _coerce_base_ring
of Polyhedra_base
just takes the base ring of K
, which are the rationals.
We fix this, by not taking the base ring, if the object is already a ring.
Change History (6)
comment:1 Changed 3 years ago by
- Branch set to public/28770
- Commit set to a272cfdb26a536eeb804ca2c66bf6660c27a79b5
- Description modified (diff)
- Status changed from new to needs_review
comment:2 Changed 3 years ago by
- Commit changed from a272cfdb26a536eeb804ca2c66bf6660c27a79b5 to a0068ccbab09b0102a64c5fbe4ffaffa71b44086
Branch pushed to git repo; I updated commit sha1. New commits:
a0068cc | added a doctest for the original bug
|
comment:3 Changed 3 years ago by
- Status changed from needs_review to positive_review
comment:4 Changed 3 years ago by
reviewer full name is missing
comment:5 Changed 3 years ago by
- Reviewers set to Léo Brunswic
comment:6 Changed 3 years ago by
- Branch changed from public/28770 to a0068ccbab09b0102a64c5fbe4ffaffa71b44086
- Resolution set to fixed
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
New commits:
fix coercion of polyhedra with number fields