Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyhedra coercion of base rings fails for number fields #28770

Closed
kliem opened this issue Nov 19, 2019 · 9 comments
Closed

Polyhedra coercion of base rings fails for number fields #28770

kliem opened this issue Nov 19, 2019 · 9 comments

Comments

@kliem
Copy link
Contributor

kliem commented Nov 19, 2019

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.

CC: @jplab @LaisRast

Component: geometry

Author: Jonathan Kliem

Branch/Commit: a0068cc

Reviewer: Léo Brunswic

Issue created by migration from https://trac.sagemath.org/ticket/28770

@kliem kliem added this to the sage-9.0 milestone Nov 19, 2019
@kliem

This comment has been minimized.

@kliem
Copy link
Contributor Author

kliem commented Nov 19, 2019

Commit: a272cfd

@kliem
Copy link
Contributor Author

kliem commented Nov 19, 2019

New commits:

a272cfdfix coercion of polyhedra with number fields

@kliem
Copy link
Contributor Author

kliem commented Nov 19, 2019

Branch: public/28770

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 19, 2019

Changed commit from a272cfd to a0068cc

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 19, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

a0068ccadded a doctest for the original bug

@fchapoton
Copy link
Contributor

comment:4

reviewer full name is missing

@kliem
Copy link
Contributor Author

kliem commented Nov 21, 2019

Reviewer: Léo Brunswic

@vbraun
Copy link
Member

vbraun commented Nov 30, 2019

Changed branch from public/28770 to a0068cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants