At that point in the routine we know the expression is constant so either it is zero or it is some other constant. So a set or random values for symbols is computed and if it is *not* zero we have an answer, otherwise we have to work harder to try *prove* that it's zero.
See also the discussion in https://github.com/sympy/sympy/issues/8516 and the routine I wrote there in response at https://github.com/sympy/sympy/pull/8561 /c On Monday, February 9, 2015 at 5:46:51 PM UTC-6, Aaron Meurer wrote: > > I'm unclear what this line is doing > > https://github.com/sympy/sympy/blob/e015652bf34987128bca3176d1c939fbd0d486cf/sympy/core/expr.py#L613. > > > It looks like it evaluates it, at least in some cases. > > Probably Chris Smith could give a more definite answer. > > Aaron Meurer > > On Mon, Feb 9, 2015 at 5:20 PM, Ondřej Čertík <[email protected] > <javascript:>> wrote: > > On Mon, Feb 9, 2015 at 4:15 PM, Aaron Meurer <[email protected] > <javascript:>> wrote: > >> On Mon, Feb 9, 2015 at 5:11 PM, Ondřej Čertík <[email protected] > <javascript:>> wrote: > >>> On Mon, Feb 9, 2015 at 3:37 PM, Aaron Meurer <[email protected] > <javascript:>> wrote: > >>>> Doesn't expr.equals also do something similar to this? > >>> > >>> No, that uses symbolics (thus it is not able to check complex > >>> expressions or it will be slow). > >>> > >>> Btw, you already asked this exact question here: > >>> > >>> https://github.com/sympy/sympy/pull/8036#issuecomment-55969269 > >>> > >>> and my answer is right below it. > >> > >> Heh. > >> > >> But I seem to remember equals plugging in values. Maybe it used to do > >> it, but doesn't any more? > > > > The code is here: > > > > > https://github.com/sympy/sympy/blob/e015652bf34987128bca3176d1c939fbd0d486cf/sympy/core/expr.py#L563 > > > > > Ondrej > > > > -- > > 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] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > 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/CADDwiVCB2Ftb_bAQUNnh2F%3DeHZA_Oy1dOrTn7W5ApkfATfOpsQ%40mail.gmail.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/514c7d89-1ecb-4cf2-b392-0891af33e31e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
