Opened 2 years ago

Last modified 22 months ago

#23304 new defect

hold=True does not always prevent evaluation

Reported by: mmezzarobba Owned by:
Priority: major Milestone: sage-8.2
Component: symbolics Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Fixed upstream, in a later stable release. Work issues:
Branch: Commit:
Dependencies: #10035 Stopgaps:

Description (last modified by rws)

sage: x = SR.var(x)
sage: x + 1/3
x + 1/3
sage: (x + 1/3).power(2, hold=True)
(x + 1/3)^2
sage: (x + 1/3).power(2, hold=True).mul(2, hold=True) # <<< evaluates!
2*(1/9*(3*x + 1)^2)
sage: (x + 1/3).mul(2, hold=True)
2*(x + 1/3)

Reported as https://github.com/pynac/pynac/issues/262

Change History (3)

comment:1 Changed 2 years ago by rws

See also #21754 and #21758.

comment:2 Changed 2 years ago by rws

  • Description modified (diff)
  • Milestone changed from sage-8.0 to sage-8.1
  • Report Upstream changed from N/A to Reported upstream. Developers acknowledge bug.

comment:3 Changed 22 months ago by rws

  • Dependencies set to #10035
  • Milestone changed from sage-8.1 to sage-8.2
  • Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, in a later stable release.

Operations like this are now better done in a hold context. With #10035:

sage: hold.start()
sage: x + 1/3
x + 1/3
sage: (x + 1/3)^2
(x + 1/3)^2
sage: (x + 1/3)^2*2
2*(x + 1/3)^2
sage: (x + 1/3)*2
2*(x + 1/3)
Note: See TracTickets for help on using tickets.