From 7d10eb25d7e5e61f56d9f55c64cc136f9c76619a Mon Sep 17 00:00:00 2001 From: RuchitJagodara Date: Fri, 8 Dec 2023 21:47:14 +0530 Subject: [PATCH] Changed the default domain of SR.var() to complex This is a fix to the issue trac:`36833`. Variables whose domain is not defined should be considered in the complex plane by default as described in the documentation. --- src/sage/symbolic/ring.pyx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx index f3f32b9c922..486cc5689b1 100644 --- a/src/sage/symbolic/ring.pyx +++ b/src/sage/symbolic/ring.pyx @@ -748,7 +748,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing): if asm.has(symbol): asm.forget() - def var(self, name, latex_name=None, n=None, domain=None): + def var(self, name, latex_name=None, n=None, domain="complex"): r""" Return a symbolic variable as an element of the symbolic ring. @@ -862,6 +862,16 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing): Traceback (most recent call last): ... ValueError: cannot specify n for multiple symbol names + + Check that :trac:`36833` is fixed: Variables whose domain is not + defined should be considered in complex plane as described in documentation:: + + sage: y = SR.var("y"); y + y + sage: f = y * conjugate(y); f + f + sage: f.factor() + y*conjugate(y) """ if isinstance(name, Expression): return name