Except in the tests you should use a more directed, efficient simplification function than simplify(). cancel() should be sufficient for this case.
Aaron Meurer On Sat, Mar 28, 2015 at 10:12 AM, James Crist <[email protected]> wrote: > One way that's pretty common is to do something like: > > result = whatever your testing > solution = something you type in > assert simplify(result - solution) == 0 > > This is better than constructing a special case form, because that form may > change in the future. > > > On Saturday, March 28, 2015 at 9:28:00 AM UTC-5, Joachim Durchholz wrote: >> >> I need to update a unit test where integrate now returns something that >> contains 1/(2*(s+1)). >> However, when I write that subexpression, SymPy gives me 1/(2*s + 2), >> which compares unequal. >> >> What would be the best way forward? >> Alternatives that I can think of: >> - have integrate() do whatever SymPy does when constructing 1/(2*s + 2) >> - have the unit test do it and leave integrate() as it is >> - rewrite the unit test to directly construct the Expr object (how?) > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/cf30c58e-2fc2-4baa-b308-fa8335b41b3f%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6JB1Lq3qSWUsPXDgVkHPdf1Fw%2ByEEo3Bsr5mWRx06q_2g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
