I'm making a small hacky notebook and want to avoid using external libraries. In my notebook, I'd like multiplication to be non-commutative only for a particular family of expressions whilst still using
The expressions have the form
Subscript[symb_Symbol, _Integer] where
symb is a member of (e.g.) [
C]. There are few symbols, so I'm happy to hardcode rules.
I'd like, for example
Times[Subscript[B, 2], Subscript[A, 1]]
to be unchanged, rather than have the order of the terms automatically commuted.
I'd actually prefer to substitute
Dot when it contains one of these expressions. I know I can define a function with the
HoldAll attribute and replace
Dot before Mathematica commutes the expression, but I'd like this behaviour everywhere, not just in the function argument.
In affect, this would give behaviour like (for special symbols
$B_2 A_2 + G F E$ would evaluate to $B_2 . A_2 + E F G$
Is this possible without immense complication?