#18213: A lot of polytopes constructor are broken
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.7
Component: geometry | Resolution:
Keywords: | Merged in:
Authors: Vincent Delecroix | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vdelecroix/18213 | c1804d5879eedab9140d07096bfd1ad29ae75fa0
Dependencies: #18211 | Stopgaps:
-------------------------------------+-------------------------------------
Old description:
> A lot of polytopes constructors in `sage.geometry.polyhedron.library`.
> For example
>
> 1. The Rhombicuboctahedron does not return what it should (as Python
> division was thought as Sage integer divisions). There is in the code
> {{{
> verts = [ [-3/2, -1/2, -1/2], [-3/2, -1/2, 1/2], [-3/2, 1/2, -1/2],
> ...
> }}}
>
> 2. The `great_rhombicuboctahedron` is defined over `QQ` but it should be
> defined over `QQ[sqrt(2)]`! There are in two places rough approximation
> of sqrt(2) in the code
> {{{
> v1 = QQ(131739771357/54568400000) # ~ sqrt(2) + 1 but actually 2 due to
> Python division
> v2 = QQ(104455571357/27284200000) # ~ 2 sqrt(2) but actually 3 due to
> Python division
> }}}
> Instead, we should use the `base_ring` argument (with appropriate
> defaults) and use `base_ring(2).sqrt()` instead.
>
> While we're at it, remove the deprecations from #11634.
>
> During the process I discovered two annoying bugs:
> - #18214 Bug in volume computation of polyhedron
> - #18220 Bug when creating a polyhedron with coefficients in RR
> Moreover, we can get a great speed up with the following because many
> polytopes have now coordinates in a quadratic number fields:
> - #18215: Huge speed up for hash of quadratic number field elements
> - #18226: Native _mpfr_ method on quadratic number field elements
New description:
A lot of polytopes constructors in `sage.geometry.polyhedron.library`. For
example
1. The Rhombicuboctahedron does not return what it should (as Python
division was thought as Sage integer divisions). There is in the code
{{{
verts = [ [-3/2, -1/2, -1/2], [-3/2, -1/2, 1/2], [-3/2, 1/2, -1/2],
...
}}}
2. The `great_rhombicuboctahedron` is defined over `QQ` but it should be
defined over `QQ[sqrt(2)]`! There are in two places rough approximation of
sqrt(2) in the code
{{{
v1 = QQ(131739771357/54568400000) # ~ sqrt(2) + 1 but actually 2 due to
Python division
v2 = QQ(104455571357/27284200000) # ~ 2 sqrt(2) but actually 3 due to
Python division
}}}
Instead, we should use the `base_ring` argument (with appropriate
defaults) and use `base_ring(2).sqrt()` instead.
3. The functions unrelated to construction of Polytopes are moved out of
the class `Polytopes`:
- `Polytopes.orthonormal_1`, `Polytopes.project_1` will be renamed
respectively `zero_sum_projection` and `project_points`
- the one line `Polytopes._pfunc` is just removed
While we're at it, remove the deprecations from #11634.
During the process I discovered two annoying bugs:
- #18214 Bug in volume computation of polyhedron
- #18220 Bug when creating a polyhedron with coefficients in RR
Moreover, we can get a great speed up with the following because many
polytopes have now coordinates in a quadratic number fields:
- #18215: Huge speed up for hash of quadratic number field elements
- #18226: Native _mpfr_ method on quadratic number field elements
--
Comment (by vdelecroix):
Replying to [comment:18 ncohen]:
> Okay. Then could you at least change the description of this ticket to
explain all changes that you made? (you apparently reated new functions,
for example.. Why?)
done in the ticket description.
--
Ticket URL: <http://trac.sagemath.org/ticket/18213#comment:19>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.