Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.4K Views
|
5 Replies
|
1 Total Like
View groups...
Share
Share this post:

Separating product terms and keep a custom order in addition

5 Replies
POSTED BY: Gianluca Gorni

I think for the addition order I cannot avoid the hard way:

ClearAttributes[Plus, Orderless] 

while for the product terms:

Replace[expression, Times[x_, y_] -> HoldForm[HoldForm[x]*y], Infinity]

Thank you for your reply. This really works with the multiplication term, but how can I keep also the order of addition.

You can try with a pattern replacement. For example

(1/2 y + 3/8 x == 2/5 z + w) /.
 coeff_?NumberQ*v__Symbol :>
  Inactive[Times][coeff, v]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard