Yes, unfortunately, unevaluated expressions tend to be "unstable". Sometimes things will do what would normally be an innocuous transformation that ends up evaluating it. These bugs have been mostly fixed for the pretty printer, but I guess they are still there for the latex printer.
Aaron Meurer On Mon, Nov 18, 2013 at 4:30 AM, <[email protected]> wrote: > Hi, > > I work with unevaluated Adds and Muls and today found this: > >>>> from sympy import latex, Mul, Symbol >>>> x = Symbol('x') >>>> e = Mul(-2, x + 1, evaluate=False) >>>> print e > -2*(x + 1) >>>> print latex(e) > - 2 x + 2 > > The first print is correct but the second one is not. It's not about simply > dropping parentheses when they are needed. In that case the second print > would read - 2 x + 1 so some computation took place. > > Regards > -- > Greg > > -- > 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 post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. -- 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
