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

Bad handling of tensor names in unary negation operator #33938

Open
egourgoulhon opened this issue May 30, 2022 · 0 comments
Open

Bad handling of tensor names in unary negation operator #33938

egourgoulhon opened this issue May 30, 2022 · 0 comments

Comments

@egourgoulhon
Copy link
Member

In Sage 9.7.beta1, we have

sage: M = Manifold(2, 'M')
sage: X.<x,y> = M.chart()
sage: a = M.vector_field(1, 2, name='a')
sage: b = M.vector_field(-y, x, name='b')
sage: c = -(a + b)
sage: c.display()
-a+b = (y - 1) ∂/∂x + (-x - 2) ∂/∂y

The left-hand side should be -(a+b), not -a+b.

The culprit is FreeModuleTensor.__neg__, as defined in line 2022 of src/sage/tensor/modules/free_module_tensor.py: it should invoke sage.tensor.modules.format_utilities.format_unop_txt to set up the output name.

Component: manifolds

Keywords: tensor, unary negation

Issue created by migration from https://trac.sagemath.org/ticket/33938

@egourgoulhon egourgoulhon added this to the sage-9.7 milestone May 30, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Sep 19, 2022
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
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

2 participants