Skip to main content

simplifying expressions - How does `Simplify` resolve `LeafCount` ties?



The documentation for ComplexityFunction says



With the default setting ComplexityFunction->Automatic, forms are ranked primarily according to their LeafCount, with corrections to treat integers with more digits as more complex.



and



LeafCount[-a - b] == LeafCount[-(a + b)] == 7
>> True

so I would expect that Simplify would not change either expression. But


Simplify[-a - b]
>> -a - b

Simplify[-(a + b)]
>> -a - b


seems to imply that Mathematica considers the expression -a - b to be strictly simpler than -(a + b). Why is it doing so, since the two expressions seem to have the same complexity as measured by LeafCount? I'm not sure whether to interpret the quoted sentence in the documentation as saying that the integer-digit correction to LeafCount is the only correction, or if it is just giving the integer-digit correction as one example of multiple corrections.




Comments