None in this case means that SymPy doesn't know how determine the fact. It looks like the sathandlers has an even/odd fact for Mul but not for Add https://github.com/sympy/sympy/blob/71eb404921a4596b9fe42a7a4a0ccfa7d63a62c0/sympy/assumptions/sathandlers.py#L339. If I remember correctly, it's because the corresponding fact for Add requires counting, and I wasn't sure how to do that efficiently (without adding an exponential number of clauses for large Adds).
You can always tell SymPy the facts that it needs to know to deduce things, in this case >>> with assuming(Q.positive(c), Q.integer(c), Q.positive(d), Q.integer(d), >>> Q.odd(c*(d + 1)), Q.odd(d + 1) >> Q.even(d)): ... print(ask(Q.odd(d))) False here >> means "implies" (you could also use Implies(Q.odd(d + 1), Q.even(d))). Aaron Meurer On Mon, May 29, 2017 at 9:45 PM, mike <[email protected]> wrote: > Hi, > > I am new to learn sympy. This is a very simple question but I do not know > how to deal with it. > > The question is: both c and d are positive integers, is c*d even if c*(d+1) > is odd. > > my code: > > from sympy import Symbol > from sympy.assumptions import assuming, Q, ask > c = Symbol('c') > d = Symbol('d') > with assuming(Q.positive(c), Q.integer(c), Q.positive(d), Q.integer(d)): > with assuming(Q.odd(c*(d +1))): > print(ask(Q.odd(c))) > print(ask(Q.odd((d+1)))) > > This code works. c is odd and (d+1) is odd, but how to evaluate d is odd or > even. > I run the code > ask(Q.odd(d)), > but the result is "NONE" > > Ask for help. > Thanks, > > -- > 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 https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/5206e651-feeb-4cd9-a4c5-ba85f17ec6f0%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 https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6Kzhb_OOyvLnLcg4Z%2B-HNVAs6O82772cpn%3DV%3DC5JJ4j1w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
