Opened 6 years ago
Closed 6 years ago
#17849 closed defect (fixed)
substitute_function should not evaluate expression
Reported by:  rws  Owned by:  

Priority:  major  Milestone:  sage6.8 
Component:  symbolics  Keywords:  
Cc:  Merged in:  
Authors:  Ralf Stephan  Reviewers:  Marc Mezzarobba 
Report Upstream:  N/A  Work issues:  
Branch:  c8ebd30 (Commits, GitHub, GitLab)  Commit:  c8ebd3056e2800dc9c760d94fd2d6b088ee541ab 
Dependencies:  #17759  Stopgaps: 
Description
One expects substitute_function
to not do anything except exchanging parts of expressions but
sage: ex = sin(x) + atan2(0,0,hold=True) sage: ex.substitute_function(sin,cos) ... RuntimeError: arctan2_eval(): arctan2(0,0) encountered sage: ex = sin(x) + hypergeometric([1, 1], [2], 1) sage: ex hypergeometric((1, 1), (2,), 1) + sin(x) sage: ex.substitute_function(sin,cos) AttributeError: 'SubstituteFunction' object has no attribute 'tuple'
Change History (10)
comment:1 Changed 6 years ago by
 Dependencies set to #17759
comment:2 Changed 6 years ago by
comment:3 Changed 6 years ago by
 Branch set to u/rws/substitute_function_should_not_evaluate_expression
comment:4 Changed 6 years ago by
 Commit set to 82332bb5eb54696d076b78bf62f21257a872ffad
 Status changed from new to needs_review
New commits:
3781eec  17759: convenience class symbolic ExpressionTreeWalker(Converter)

9375510  Merge branch 'develop' into t/17759/public/17759

16aa81d  17759: handle hold=True and hypergeometric

d8767cd  Merge branch 'public/17759' of trac.sagemath.org:sage into t/17849/substitute_function_should_not_evaluate_expression

82332bb  17849: adapt SubstituteFunction; add doctest

comment:5 Changed 6 years ago by
 Branch changed from u/rws/substitute_function_should_not_evaluate_expression to u/rws/17849
comment:6 Changed 6 years ago by
 Branch changed from u/rws/17849 to u/rws/substitute_function_should_not_evaluate_expression
 Milestone changed from sage6.6 to sage6.8
comment:7 Changed 6 years ago by
 Branch changed from u/rws/substitute_function_should_not_evaluate_expression to u/rws/17849
 Commit changed from 82332bb5eb54696d076b78bf62f21257a872ffad to c8ebd3056e2800dc9c760d94fd2d6b088ee541ab
comment:8 Changed 6 years ago by
 Reviewers set to Marc Mezzarobba
 Status changed from needs_review to positive_review
comment:9 Changed 6 years ago by
Thanks.
comment:10 Changed 6 years ago by
 Branch changed from u/rws/17849 to c8ebd3056e2800dc9c760d94fd2d6b088ee541ab
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Calling
operator(*map(self, ex.operands()), hold=True)
as a quick fix inSubstituteFunction.composition
presupposes that all operators accept the keyword.