Skip to content

signs not correct in str(expr) #2806

Open
@sebastiendementen

Description

@sebastiendementen

Describe the bug
The equation expression is not showing correct sign when using -

To Reproduce

import cvxpy

a, b = cvxpy.Variable(1, name="a"), cvxpy.Variable(1, name="b")
c = a - b
print(c)
print(-c)

Expected behavior
Displaying

a + -b
-a + b

or

a + -b
-(a + -b)

Output
The current output of the expression -c is misleading

a + -b
-a + -b

Version

  • OS: windows
  • CVXPY Version:1.6.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions