Timeline for Ordering of positive and negative terms in output
Current License: CC BY-SA 3.0
Post Revisions
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 3, 2017 at 10:26 | vote | accept | Ubiquitous | ||
| Dec 31, 2016 at 19:36 | answer | added | Jens | timeline score: 4 | |
| Dec 31, 2016 at 13:17 | history | edited | Ubiquitous | CC BY-SA 3.0 |
edited body
|
| Dec 30, 2016 at 23:48 | comment | added | theorist | @george2079 : As I understand it, this is a concern if do what you illustrated (applying TraditionalForm to an input) (and is also a concern if you copy-and-paste TraditionalForm output into a new input), but is not an issue if you globally set output to TraditionalForm in Preferences -> Evaluation. For more information, see "tutorial/HowInputAndOutputWork" in MMA's help documentation. | |
| Dec 30, 2016 at 23:41 | comment | added | theorist |
@march : I'm not sure if this is due to Plus being Orderless, since if you evaluate ClearAttributes[Plus, Orderless], a - 2 still becomes -2 + a. Also, I'm not sure if it's due to LeafCount either, since a - 2 and -2 + a both have a LeafCount of 3.
|
|
| Dec 11, 2016 at 13:55 | history | edited | J. M.'s missing motivation |
edited tags
|
|
| Sep 27, 2016 at 18:53 | comment | added | george2079 |
TraditionalForm will do what you want, but take care to only use it for display purpose, eg do TraditionalForm[solution = Solve[(1 - a) x == (2 - a) y, x]] so that solution holds the unformatted expression.
|
|
| Sep 27, 2016 at 16:01 | comment | added | march |
Mathematica has a canonical ordering behind the scenes. Since Plus is Orderless, Plus[a, -2] will always become Plus[-2, a], because numbers come before symbols in the canonical ordering. Furthermore, when Mathematica simplifies, it's figure of merit for simplifying includes LeafCount, which is a proxy for the complexity of the expression, and ((-2 + a) y)/(-1 + a) has a smaller LeafCount than ((2 - a) y)/(1 - a). Now, there are ways to display this more nicely, if all you care about is displaying. Maybe I'll search for an example Q&A that answers your question.
|
|
| Sep 27, 2016 at 14:50 | history | edited | Ubiquitous | CC BY-SA 3.0 |
added 8 characters in body
|
| Sep 27, 2016 at 14:42 | history | asked | Ubiquitous | CC BY-SA 3.0 |