Skip to content

Commit 223ef47

Browse files
author
Release Manager
committed
gh-40102: fix conversion of expressions like SR(oo) Fix #40101 URL: #40102 Reported by: Martin Rubey Reviewer(s): Frédéric Chapoton
2 parents 80ff822 + 39550fb commit 223ef47

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/sage/symbolic/expression_conversions.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from sage.misc.lazy_import import lazy_import
2222
from sage.symbolic.ring import SR
23-
from sage.structure.element import Expression
23+
from sage.structure.element import Expression, InfinityElement
2424
from sage.functions.log import exp
2525
from sage.symbolic.operators import arithmetic_operators, relation_operators, FDerivativeOperator, add_vararg, mul_vararg
2626
from sage.rings.number_field.number_field_element_base import NumberFieldElement_base
@@ -708,7 +708,7 @@ def pyobject(self, ex, obj):
708708
sage: asin(pi)._fricas_() # optional - fricas
709709
asin(%pi)
710710
711-
sage: I._fricas_().domainOf() # optional - fricas
711+
sage: I._fricas_().domainOf() # optional - fricas
712712
Complex(Integer...)
713713
714714
sage: SR(I)._fricas_().domainOf() # optional - fricas
@@ -725,6 +725,11 @@ def pyobject(self, ex, obj):
725725
sage: (ex^2)._fricas_() # optional - fricas
726726
+-+
727727
(4 + 2 %i)\|2 + 5 + 4 %i
728+
729+
Check that :issue:`40101` is fixed::
730+
731+
sage: SR(-oo)._fricas_().domainOf() # optional - fricas
732+
OrderedCompletion(Integer)
728733
"""
729734
try:
730735
result = getattr(obj, self.name_init)()
@@ -735,6 +740,9 @@ def pyobject(self, ex, obj):
735740
from sage.rings.number_field.number_field_element_quadratic import NumberFieldElement_gaussian
736741
if isinstance(obj, NumberFieldElement_gaussian):
737742
return "((%s)::EXPR COMPLEX INT)" % result
743+
elif isinstance(obj, InfinityElement):
744+
# in this case, we leave the decision about the domain best to FriCAS
745+
return result
738746
return "((%s)::EXPR INT)" % result
739747

740748
def symbol(self, ex):

0 commit comments

Comments
 (0)