Opened 9 months ago

Closed 9 months ago

#22520 closed defect (fixed)

Fix display of tensors on free modules of finite rank

Reported by: egourgoulhon Owned by:
Priority: major Milestone: sage-7.6
Component: linear algebra Keywords: tensor
Cc: tscrim Merged in:
Authors: Eric Gourgoulhon Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 7c02ed8 (Commits) Commit: 7c02ed84fdce8c7c6fb2b1a9518c26a215f932c6
Dependencies: Stopgaps:

Description

The following is a bug:

sage: M = FiniteRankFreeModule(SR, 3, name='M')
sage: e = M.basis('e')
sage: t = SR.var('t', domain='real')
sage: (2*e[0]).display()
2 e_0
sage: (t*e[0]).display()
0

The outcome of the last line should be t e_0. This bug arises because of the nonzero check performed to avoid displaying zero components. This check is written as t != 0, which returns False. The fix proposed in this ticket is to replace it by not (t==0), which returns True.

Change History (4)

comment:1 Changed 9 months ago by egourgoulhon

  • Branch set to public/manifolds/bug-display-tensor-22520
  • Cc tscrim added
  • Commit set to 7c02ed84fdce8c7c6fb2b1a9518c26a215f932c6
  • Status changed from new to needs_review

New commits:

7c02ed8Fix display of tensors on free modules of finite rank (#22520)

comment:2 follow-up: Changed 9 months ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

It's somewhat ugly, but a necessary evil because of how symbolic works (i.e., t could be 0).

comment:3 in reply to: ↑ 2 Changed 9 months ago by egourgoulhon

Replying to tscrim:

It's somewhat ugly, but a necessary evil because of how symbolic works (i.e., t could be 0).

I agree. Thanks for the review!

comment:4 Changed 9 months ago by vbraun

  • Branch changed from public/manifolds/bug-display-tensor-22520 to 7c02ed84fdce8c7c6fb2b1a9518c26a215f932c6
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.