Fix display of tensors on free modules of finite rank
Closed this issue · 7 comments
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.
CC: @tscrim
Component: linear algebra
Keywords: tensor
Author: Eric Gourgoulhon
Branch/Commit: 7c02ed8
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/22520
New commits:
7c02ed8 | Fix display of tensors on free modules of finite rank (#22520) |
Commit: 7c02ed8
Reviewer: Travis Scrimshaw
It's somewhat ugly, but a necessary evil because of how symbolic works (i.e., t could be 0).
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!
Changed branch from public/manifolds/bug-display-tensor-22520 to 7c02ed8