Skip to content

Fix display of tensors on free modules of finite rank #22520

@egourgoulhon

Description

@egourgoulhon

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions