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

Replace "... is SR" by isinstance(..., sage.rings.abc.SymbolicRing) to handle symbolic subrings #32724

Closed
mkoeppe opened this issue Oct 19, 2021 · 26 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 19, 2021

There are a number of tests ... is SR in the Sage library, as found by git grep 'is SR' src/sage/

These tests ignore symbolic subrings, as constructed by SR.subring(...).

All or most of these uses should be changed to isinstance(..., sage.rings.abc.SymbolicRing) or isinstance(..., sage.symbolic.ring.SymbolicRing) (if the module already imports other things from sage.symbolic)

In addition to handling the case of subrings, this will help with modularization (#32601).

We leave a few uses of is SR to follow-up tickets #31988, #31999.

CC: @dkrenn @egourgoulhon @orlitzky

Component: symbolics

Author: Matthias Koeppe

Branch/Commit: ff83c4c

Reviewer: Michael Orlitzky

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

@mkoeppe mkoeppe added this to the sage-9.5 milestone Oct 19, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 20, 2021

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 20, 2021

Commit: 45aab88

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 20, 2021

comment:2

here's one such change, cherry-picked from #32601


New commits:

45aab88src/sage/rings/polynomial/polynomial_element.pyx: Use isinstance(..., sage.rings.abc.SymbolicRing) instead of ... is SR

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 20, 2021

Author: Matthias Koeppe, ...

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

da82ac5src/sage/rings/polynomial/polynomial_element.pyx: Use isinstance(..., sage.rings.abc.SymbolicRing) instead of ... is SR
3c821bdsage.functions.other._eval_floor_ceil: Handle elements of symbolic subrings like elements of SR

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

Changed commit from 45aab88 to 3c821bd

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

Changed commit from 3c821bd to f1c9258

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

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

f1c9258src/sage/combinat/q_analogues.py: Handle symbolic subrings like SR

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

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

f98855bsrc/sage/dynamics/arithmetic_dynamics/projective_ds.py: Use sage.rings.abc.SymbolicRing instead of 'is SR'
7f1500esrc/sage/geometry/polyhedron/parent.py: For backend='normaliz', accept subrings of SR

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

Changed commit from f1c9258 to 7f1500e

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

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

76e0962[Diff]ScalarFieldAlgebra._coerce_map_from_: Also coerce from subrings of SR

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

Changed commit from 7f1500e to 76e0962

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

Changed commit from 76e0962 to 5fca7fc

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

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

b7470d1Matrix.is_{positive_operator,cross_positive,lyapunov_like}_on: Handle symbolic subrings like SR
5fca7fccontinued_fraction: Handle symbolic subrings like SR

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

Changed commit from 5fca7fc to 038eb9f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

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

038eb9fsrc/sage/symbolic/pynac_impl.pxi (py_is_integer, py_is_exact): Handle symbolic subrings like SR

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

Changed commit from 038eb9f to ff83c4c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 1, 2021

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

ff83c4csage.repl.ipython_kernel (widget_from_tuple, slider): Handle symbolic subrings like SR

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 1, 2021

Changed dependencies from #32665 to none

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 1, 2021

Changed author from Matthias Koeppe, ... to Matthias Koeppe

@mkoeppe

This comment has been minimized.

@orlitzky
Copy link
Contributor

orlitzky commented Nov 6, 2021

comment:13

Now that we have a passing patchbot, this LGTM. I think "the symbolic ring (or a symbolic subring)" is awkward to repeat so many times and would be better phrased "a symbolic ring," but it's not important.

@orlitzky
Copy link
Contributor

orlitzky commented Nov 6, 2021

Reviewer: Michael Orlitzky

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 6, 2021

comment:14

Thank you!

I used this phrasing because I didn't want to think about the status of callable symbolic rings in this ticket.

@vbraun
Copy link
Member

vbraun commented Nov 12, 2021

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