Simplify x(x-1)

Issue #90 wontfix
Former user created an issue

Simplify x(x-1) or x*(x-1) return x(x-1). Should return x^2-1, shouldn't it?

Comments (3)

  1. Axel Kramer repo owner

    Simplify uses the LeafCount() function to "measure" which expression is "easier".

    >>> LeafCount(x*(x-1))
    5 
    
    >>> LeafCount(x^2-x)
    7
    

    If you look at the FullForm of the expressions you can see that -x is represented as Times(-1, x) which has a LeafCount of 3:

    >>> FullForm(x*(x-1))
    "Times(x, Plus(-1, x))"
    
    >>> FullForm(x^2-x)
    "Plus(Times(-1, x), Power(x, 2))"
    
  2. Log in to comment