Opened 5 months ago

Closed 4 months ago

#34175 closed defect (fixed)

`global_height` for polynomials fails when passed the zero polynomial

Reported by: Jing Guo Owned by:
Priority: minor Milestone: sage-9.7
Component: algebra Keywords: gsoc2022
Cc: Ben Hutz, Alexander Galarraga Merged in:
Authors: Jing Guo Reviewers: Ben Hutz
Report Upstream: N/A Work issues:
Branch: b8a2b44 (Commits, GitHub, GitLab) Commit: b8a2b4491cf2ce7d2e8499b91e3c27821279c932
Dependencies: #34060 Stopgaps:

Status badges


The global_height for polynomials would fail when passed the zero polynomial, since number_of_terms would return 0, and then it would create a projective space of dimension -1:

sage: R.<x> = QQ[]
sage: f = 0 * x
sage: f.global_height()

This ticket aims to fix this.

Change History (6)

comment:1 Changed 5 months ago by Jing Guo

Branch: u/gh-guojing0/34175_zero_height
Commit: 913fe1511bb171fae3ae4d6bd57958700bf38838
Status: newneeds_review

New commits:

913fe1534175: global_height returns zero for zero poly

comment:2 Changed 5 months ago by Ben Hutz

Reviewers: Ben Hutz
Status: needs_reviewneeds_work

The idea here is fine, but the return value needs to be of the correct type (i.e., a real number of the appropriate precision)

comment:3 Changed 5 months ago by git

Commit: 913fe1511bb171fae3ae4d6bd57958700bf38838b8a2b4491cf2ce7d2e8499b91e3c27821279c932

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

b8a2b4434175: Return zero as real of specific precision

comment:4 Changed 5 months ago by Jing Guo

Status: needs_workneeds_review

I thought Sage/Python? would cast to appropriate type, and hence precision.

comment:5 Changed 5 months ago by Ben Hutz

Status: needs_reviewpositive_review

comment:6 Changed 4 months ago by Volker Braun

Branch: u/gh-guojing0/34175_zero_heightb8a2b4491cf2ce7d2e8499b91e3c27821279c932
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.