Opened 15 months ago

Last modified 2 months ago

#31652 new defect

formal sums with non-atomic support elements print incorrectly

Reported by: mmezzarobba Owned by:
Priority: major Milestone: sage-9.7
Component: user interface Keywords:
Cc: slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by slelievre)

An issue noticed by Emre Sertöz:

sage: P.<x> = QQ[]
sage: FormalSum([(2, x + 1)])
2*x + 1


2*(x + 1)

Change History (6)

comment:1 Changed 15 months ago by gh-DaveWitteMorris

I think the bad output is coming from repr_lincomb:

sage: repr_lincomb([[x + 1, 2]])
'2*x + 1'

This function is only documented to "Compute a string representation of a linear combination of some formal symbols." It does not work correctly for linear combinations of more complicated expressions, because it does not insert any parentheses.

comment:2 Changed 14 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Moving to 9.4, as 9.3 has been released.

comment:3 Changed 11 months ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5

comment:4 Changed 7 months ago by mkoeppe

  • Milestone changed from sage-9.5 to sage-9.6

comment:5 Changed 5 months ago by slelievre

  • Cc slelievre added
  • Description modified (diff)

comment:6 Changed 2 months ago by mkoeppe

  • Milestone changed from sage-9.6 to sage-9.7
Note: See TracTickets for help on using tickets.