Skip to content

Commit 9b73d6c

Browse files
author
Release Manager
committed
gh-36841: Change default domain of SR.var() This patch fixes #36833 by changing the default domain of SR.var() function to complex. By this way, every variable whose domain is not defined will be considered in complex plane, by default. The issue was with the default value only because whenever we were defining a variable without specifying any domain it was calling symbol() function with domain=None; Subsequently, it calls new_Expression_symbol() function with domain=None. In this code, I found that it was not giving any specific domain to the variable and so when we define a new variable using SR.var() function, it is passing the is_real() (Because it does not have any specific domain) test but giving the wrong answer on factor() function, if we assume that the variable is in complex plane by default which is correct according to the documentation. <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36841 Reported by: Ruchit Jagodara Reviewer(s): Dima Pasechnik, Ruchit Jagodara
2 parents 152035b + 053d50c commit 9b73d6c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sage/symbolic/ring.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing):
760760
761761
- ``n`` -- (optional) positive integer; number of symbolic variables, indexed from `0` to `n-1`
762762
763-
- ``domain`` -- (optional) specify the domain of the variable(s); it is the complex plane
763+
- ``domain`` -- (optional) specify the domain of the variable(s); it is None
764764
by default, and possible options are (non-exhaustive list, see note below):
765765
``'real'``, ``'complex'``, ``'positive'``, ``'integer'`` and ``'noninteger'``
766766
@@ -780,7 +780,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing):
780780
781781
EXAMPLES:
782782
783-
Create a variable `zz` (complex by default)::
783+
Create a variable `zz`::
784784
785785
sage: zz = SR.var('zz'); zz
786786
zz

0 commit comments

Comments
 (0)