1
$\begingroup$

This is a somewhat silly requirement, but would help a lot in my workflow. Whenever I output an algebraic expression which contains a number, mathematica always orders the number first whenever possible. For example, if I input

x+1

Mathematica will output

1+x

This repeats itself in other situations which I would prefer not to, as for example when writing to subscripts. Example:

Subscript[x, n] + 1

Outputs to

1+ Subscript[x, n]

Is there a way to prevent this or guide mathematica as to the wanted output? It happens often also in algebraic manipulations that mathematica alters the order of commutative operations.

Thanks

$\endgroup$
2

3 Answers 3

2
$\begingroup$

See this page Wolfram Support: default format.

Set Output option under New Cell Defaults, CommonDefaultFormatTypes "Output" to TraditionalForm. If you prefer it to stay that way?

$\endgroup$
2
$\begingroup$

TraditionalForm is useful, but let's just say there are a lot of traditions. (If you read books on Elasticity, the notation and the sign conventions are varied by each author. True for many technical fields.)

Mathematica made a very basic design decision at its inception regarding canonical order of symbols in an expression. See ref/Orderless in the documentation. By having a fixed internal order, Mathematica can have power and simplicity in other ways, especially in the pattern matcher. But if I type in y + x, as you note, it returns x + y. Because of this I've never found a way to duplicate the appearance of some equations from books or papers exactly.

My answer is what you want is not always possible in Mathematica.

$\endgroup$
0
$\begingroup$
clear
(*ClearAttributes[Plus,Orderless]*)
Unprotect[Plus];
ClearAttributes[Plus, Orderless]
Attributes[Plus]
b + a // StandardForm
a + b // StandardForm

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.