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

Commit 82332bb

Browse files
committed
17849: adapt SubstituteFunction; add doctest
1 parent d8767cd commit 82332bb

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/sage/symbolic/expression.pyx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4428,6 +4428,17 @@ cdef class Expression(CommutativeRingElement):
44284428
sage: f = foo(x) + 1/foo(pi*y)
44294429
sage: f.substitute_function(foo, bar)
44304430
1/bar(pi*y) + bar(x)
4431+
4432+
TESTS:
4433+
4434+
Make sure :trac:`17849` is fixed::
4435+
4436+
sage: ex = sin(x) + atan2(0,0,hold=True)
4437+
sage: ex.substitute_function(sin,cos)
4438+
arctan2(0, 0) + cos(x)
4439+
sage: ex = sin(x) + hypergeometric([1, 1], [2], -1)
4440+
sage: ex.substitute_function(sin,cos)
4441+
cos(x) + hypergeometric((1, 1), (2,), -1)
44314442
"""
44324443
from sage.symbolic.expression_conversions import SubstituteFunction
44334444
return SubstituteFunction(self, original, new)()

src/sage/symbolic/expression_conversions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ def composition(self, ex, operator):
18071807
if operator == self.original:
18081808
return self.new(*map(self, ex.operands()))
18091809
else:
1810-
return operator(*map(self, ex.operands()))
1810+
return super(SubstituteFunction, self).composition(ex, operator)
18111811

18121812
def derivative(self, ex, operator):
18131813
"""

0 commit comments

Comments
 (0)