I would only do that just for the printing. Telling SymPy that two symbols don't commute means that it will no longer do any simplifications on it that aren't valid without commuting them.
Aaron Meurer On Sat, Apr 23, 2022 at 3:32 AM Andre Bolle <[email protected]> wrote: > > You can always tell Sympy that as far as I am concerned "a" is > non-commutative. Then tradition is preserved. > > >>> var('F m') > (F, m) > >>> var('a') > a > >>> print(Eq(F,m*a)) > Eq(F, a*m) > >>> var('a', commutative=False) > a > >>> print(Eq(F,m*a)) > Eq(F, m*a) > On Thursday, April 21, 2022 at 8:23:51 PM UTC+1 Andre Bolle wrote: >> >> I think mathematicians prefer the order of symbols preserved. >> >> On Thursday, April 21, 2022 at 7:54:20 PM UTC+1 [email protected] wrote: >>> >>> On Thu, Apr 21, 2022 at 12:16 PM Oscar Benjamin >>> <[email protected]> wrote: >>> > >>> > On Thu, 21 Apr 2022 at 18:53, Aaron Meurer <[email protected]> wrote: >>> > > >>> > > If you want the expression to print in the same way that it was >>> > > originally entered, then it needs to keep track of that information >>> > > when it is created. That's not something that currently happens. >>> > > >>> > > If you just want the printers to have more options in how they sort >>> > > things, that is technically already possible, although it's not >>> > > particularly straightforward and not very well documented. >>> > >>> > It should be easier to do each of these things. At the moment you can >>> > create an Add(y, x, evaluate=False) and the printers do have an >>> > "order" setting (for init_printing) but there isn't a value for the >>> > order parameter that just prints the terms in the exact order that >>> > they appear in the Add. >>> > >>> > This is a very commonly requested option on StackOverflow etc. It >>> > would be good to fix it so that the printers can just print in args >>> > order. >>> >>> The order flag needs to be documented much better. Also I think it >>> would be useful if you could just pass a sort key function directly to >>> the printer, with some examples of how to do that. >>> >>> Aaron Meurer >>> >>> > >>> > -- >>> > Oscar >>> > >>> > -- >>> > You received this message because you are subscribed to the Google Groups >>> > "sympy" group. >>> > To unsubscribe from this group and stop receiving emails from it, send an >>> > email to [email protected]. >>> > To view this discussion on the web visit >>> > https://groups.google.com/d/msgid/sympy/CAHVvXxQU5MSP45UFe1ioztrW6%3DJF1TPEdVXC3o9qOROMFw9_cw%40mail.gmail.com. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/4a04c3f8-881e-4e80-a00e-a01c4b280a52n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6KHsDkYtcZQw6okkuDpUGBrtzhD6VegiXhb2mHkuB6h%2Bg%40mail.gmail.com.
