Opened 5 years ago

Closed 5 years ago

#17849 closed defect (fixed)

substitute_function should not evaluate expression

Reported by: rws Owned by:
Priority: major Milestone: sage-6.8
Component: symbolics Keywords:
Cc: Merged in:
Authors: Ralf Stephan Reviewers: Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: c8ebd30 (Commits) 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 5 years ago by rws

  • Dependencies set to #17759

comment:2 Changed 5 years ago by rws

Calling operator(*map(self, ex.operands()), hold=True) as a quick fix in SubstituteFunction.composition presupposes that all operators accept the keyword.

comment:3 Changed 5 years ago by rws

  • Branch set to u/rws/substitute_function_should_not_evaluate_expression

comment:4 Changed 5 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 82332bb5eb54696d076b78bf62f21257a872ffad
  • Status changed from new to needs_review

New commits:

3781eec17759: convenience class symbolic ExpressionTreeWalker(Converter)
9375510Merge branch 'develop' into t/17759/public/17759
16aa81d17759: handle hold=True and hypergeometric
d8767cdMerge branch 'public/17759' of trac.sagemath.org:sage into t/17849/substitute_function_should_not_evaluate_expression
82332bb17849: adapt SubstituteFunction; add doctest

comment:5 Changed 5 years ago by rws

  • Branch changed from u/rws/substitute_function_should_not_evaluate_expression to u/rws/17849

comment:6 Changed 5 years ago by rws

  • Branch changed from u/rws/17849 to u/rws/substitute_function_should_not_evaluate_expression
  • Milestone changed from sage-6.6 to sage-6.8

comment:7 Changed 5 years ago by rws

  • Branch changed from u/rws/substitute_function_should_not_evaluate_expression to u/rws/17849
  • Commit changed from 82332bb5eb54696d076b78bf62f21257a872ffad to c8ebd3056e2800dc9c760d94fd2d6b088ee541ab

New commits:

fa7328517759: convenience class symbolic ExpressionTreeWalker(Converter)
c8ebd30Merge branch 'u/rws/substitute_function_should_not_evaluate_expression' of trac.sagemath.org:sage into tmp3

comment:8 Changed 5 years ago by mmezzarobba

  • Reviewers set to Marc Mezzarobba
  • Status changed from needs_review to positive_review

comment:9 Changed 5 years ago by rws

Thanks.

comment:10 Changed 5 years ago by vbraun

  • 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.