Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
egourgoulhon opened this issue Mar 5, 2017 · 7 comments
Closed

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

egourgoulhon opened this issue Mar 5, 2017 · 7 comments

Comments

@egourgoulhon
Copy link
Member

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

@egourgoulhon
Copy link
Member Author

New commits:

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

@egourgoulhon
Copy link
Member Author

@egourgoulhon
Copy link
Member Author

Commit: 7c02ed8

@tscrim
Copy link
Collaborator

tscrim commented Mar 5, 2017

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Mar 5, 2017

comment:2

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

@egourgoulhon
Copy link
Member Author

comment:3

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!

@vbraun
Copy link
Member

vbraun commented Mar 8, 2017

Changed branch from public/manifolds/bug-display-tensor-22520 to 7c02ed8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants