-
-
Notifications
You must be signed in to change notification settings - Fork 660
Open
Description
It is possible to add assumptions on sympy symbols:
sage: from sympy import Symbol
sage: n = Symbol("n", integer=True)
However, these are lost when converting to SR
:
def _sympysage_symbol(self):
"""
EXAMPLES::
sage: from sympy import Symbol
sage: assert x._sympy_() == Symbol('x')
sage: assert x == Symbol('x')._sage_()
"""
from sage.symbolic.ring import SR
return SR.var(self.name)
This is the indirect cause for the different results below (based on a doctest in src/sage/tests/french_book/recequadiff.py
):
sage: from sympy import Symbol, rsolve_hyper
sage: n = Symbol("n", integer=True)
sage: rsolve_hyper([-2,1], 2^(n+2), n)
2**n*C0 + 2**(n + 2)*(C0 + n/2)
sage: rsolve_hyper([-2,1], 2^(2+n), n)
2**n*C0 - 2**(n + 2)
Depends on #24067
CC: @rwst
Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/24334