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

Fix some corner and special cases concerning localization of integral domains #33463

Closed
soehms opened this issue Mar 5, 2022 · 25 comments
Closed

Comments

@soehms
Copy link
Member

soehms commented Mar 5, 2022

The aime of this ticket is to fix the following issues:

sage: L = ZZ.localization(5)
sage: o = L(0)
sage: o.is_unit()
Traceback (most recent call last)
...
RecursionError: maximum recursion depth exceeded while calling a Python object
sage: R = ZZ.localization(5)
sage: S = R.localization(~5)
Traceback (most recent call last)
...
TypeError: no conversion of this rational to integer
sage: Lau.<u, v> = LaurentPolynomialRing(ZZ)
sage: LauL = Lau.localization(u+1)
sage: LauL(~u)
Traceback (most recent call last)
...
NotImplementedError:

In addition a method factor is added.

CC: @tscrim

Component: commutative algebra

Keywords: integral domain localization

Author: Sebastian Oehms

Branch/Commit: fc1865a

Reviewer: Travis Scrimshaw, Samuel Lelièvre

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

@soehms soehms added this to the sage-9.6 milestone Mar 5, 2022
@soehms
Copy link
Member Author

soehms commented Mar 5, 2022

@soehms
Copy link
Member Author

soehms commented Mar 5, 2022

Commit: ff2e83e

@soehms
Copy link
Member Author

soehms commented Mar 5, 2022

Author: Sebastian Oehms

@soehms
Copy link
Member Author

soehms commented Mar 5, 2022

New commits:

ff2e83e33463: initial version

@tscrim
Copy link
Collaborator

tscrim commented Mar 5, 2022

comment:3

Can you also add this to the docstring (copied from the polynomial factorization):

   Return the factorization of this polynomial.

   INPUT:

   - ``proof`` -- ignored

and a proof=None default argument (for compatibility, although not every factor() implementation seems to support it)?

Addendum: You can also leave off the INPUT: too if you want since it is ignored.

@slel
Copy link
Member

slel commented Mar 6, 2022

comment:4

Please capitalise and use double colon here:

-        check that :trac:`33463` is fixed:
+        Check that :trac:`33463` is fixed::

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2022

Changed commit from ff2e83e to 5df7f55

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2022

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

5df7f5533464: add kw proof to factor and style fixes

@soehms
Copy link
Member Author

soehms commented Mar 6, 2022

comment:6

Replying to @tscrim:

Can you also add this to the docstring (copied from the polynomial factorization):

   Return the factorization of this polynomial.

   INPUT:

   - ``proof`` -- ignored

and a proof=None default argument (for compatibility, although not every factor() implementation seems to support it)?

Addendum: You can also leave off the INPUT: too if you want since it is ignored.

Yes, you are right, Travis! But, I think instead of ignoring it it could by useful to pass the keyword to the factor method over the base ring in case it is given explicitely.

@soehms
Copy link
Member Author

soehms commented Mar 6, 2022

comment:7

Replying to @slel:

Please capitalise and use double colon here:

-        check that :trac:`33463` is fixed:
+        Check that :trac:`33463` is fixed::

Thanks for this hint, as well, Samuel!

@tscrim
Copy link
Collaborator

tscrim commented Mar 7, 2022

comment:8

That is fine with me, but factor() still needs a one-line description. Also, one other tweak:

-        - ``proof`` -- optional (default ``None``). If given it is passed
-          to the corresponding method of the numerator of ``self``.
+        - ``proof`` -- (optional) if given it is passed to the
+          corresponding method of the numerator of ``self``

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

Changed commit from 5df7f55 to ceeeebc

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

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

ceeeebc33463: add missing description of meth factor

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

Changed commit from ceeeebc to d48dc28

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

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

d48dc2833463: once again

@soehms
Copy link
Member Author

soehms commented Mar 7, 2022

comment:11

Replying to @tscrim:

That is fine with me, but factor() still needs a one-line description. Also, one other tweak:

Sorry!

@tscrim
Copy link
Collaborator

tscrim commented Mar 7, 2022

comment:12

Thanks (although I would normally put the optional in parentheses). I am okay with the current branch. Samuel?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

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

fc1865a33463: another one

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

Changed commit from d48dc28 to fc1865a

@soehms
Copy link
Member Author

soehms commented Mar 7, 2022

comment:14

Replying to @tscrim:

although I would normally put the optional in parentheses

Of course! Sorry again (that was not a good day).

@tscrim
Copy link
Collaborator

tscrim commented Mar 8, 2022

Reviewer: Travis Scrimshaw, Samuel Lelièvre

@tscrim
Copy link
Collaborator

tscrim commented Mar 8, 2022

comment:15

No problem. Thank you for the fixes.

I am going to set this to a positive review since the patchbot is (morally) green. Samuel, if you have other changes you want, feel free to revert.

@slel
Copy link
Member

slel commented Mar 8, 2022

comment:16

I wish one could change the display of the variables in the localisation.

Something like:

sage: P.<X, Y> = QQ[]
sage: L.<x, y> = P.localization(X - Y)

where the generators would display as X, Y in P
and as x, y in L.

That could be another ticket.

One could remove a pair of parentheses here:

-        fac = [(P(f), e) for (f, e) in F]
+        fac = [(P(f), e) for f, e in F]

but leaving them is fine too and even emphasizes
the transformation.

The shorter name extra_units might shorten
some lines with respect to additional_units.

One could split this line:

-            additional_units = [au for au in additional_units if ~au not in base_ring._additional_units]  # :trac:`33463`
+            additional_units = [u for u in additional_units
+                                if ~u not in base_ring._additional_units]

These are all minor points. No need to revert positive review.

@soehms
Copy link
Member Author

soehms commented Mar 8, 2022

comment:17

That could be another ticket.

I have opened #33482

@vbraun
Copy link
Member

vbraun commented Mar 9, 2022

Changed branch from u/soehms/fix_corner_cases_localization_33463 to fc1865a

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

4 participants