Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 1f4edf2

Browse files
committed
Merge branch 'public/17759' of trac.sagemath.org:sage into t/9424/provide_symbolic_sum_function_with_evalf
* 'public/17759' of trac.sagemath.org:sage: 17759: handle hold=True and hypergeometric
2 parents 5a1ac7e + 16aa81d commit 1f4edf2

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/sage/symbolic/expression_conversions.py

+22-2
Original file line numberDiff line numberDiff line change
@@ -1663,6 +1663,10 @@ def __init__(self, ex):
16631663
16641664
sage: from sage.symbolic.expression_conversions import ExpressionTreeWalker
16651665
sage: from sage.symbolic.random_tests import random_expr
1666+
sage: ex = sin(atan(0,hold=True)+hypergeometric((1,),(1,),x))
1667+
sage: s = ExpressionTreeWalker(ex)
1668+
sage: bool(s() == ex)
1669+
True
16661670
sage: foo = random_expr(20, nvars=2)
16671671
sage: s = ExpressionTreeWalker(foo)
16681672
sage: bool(s() == foo)
@@ -1725,12 +1729,16 @@ def composition(self, ex, operator):
17251729
17261730
sage: from sage.symbolic.expression_conversions import ExpressionTreeWalker
17271731
sage: foo = function('foo')
1728-
sage: f = foo(foo(x))
1732+
sage: f = foo(atan2(0, 0, hold=True))
17291733
sage: s = ExpressionTreeWalker(f)
17301734
sage: bool(s.composition(f, f.operator()) == f)
17311735
True
17321736
"""
1733-
return operator(*map(self, ex.operands()))
1737+
from sage.symbolic.function import Function
1738+
if isinstance(operator, Function):
1739+
return operator(*map(self, ex.operands()), hold=True)
1740+
else:
1741+
return operator(*map(self, ex.operands()))
17341742

17351743
def derivative(self, ex, operator):
17361744
"""
@@ -1745,6 +1753,18 @@ def derivative(self, ex, operator):
17451753
"""
17461754
return operator(*map(self, ex.operands()))
17471755

1756+
def tuple(self, ex):
1757+
"""
1758+
EXAMPLES::
1759+
1760+
sage: from sage.symbolic.expression_conversions import ExpressionTreeWalker
1761+
sage: foo = function('foo')
1762+
sage: f = hypergeometric((1,2,3,),(x,),x)
1763+
sage: s = ExpressionTreeWalker(f)
1764+
sage: bool(s() == f)
1765+
True
1766+
"""
1767+
return ex.operands()
17481768

17491769
class SubstituteFunction(ExpressionTreeWalker):
17501770
def __init__(self, ex, original, new):

0 commit comments

Comments
 (0)