This is an interesting question. Definitely is_zero should work.
Actually, it's not so bad. It's just not implemented enough to know
that zero + zero == zero:
In [4]: a.is_zero
Out[4]: True
In [3]: var('a b',positive=False,negative=False,real=True, zero=False)
AssertionError: ('inconsistency between facts', {'real': True,
'prime': False, 'comparable': False, 'commutative': True, 'composite':
False, 'positive': False, 'negative': False, 'zero': False, 'complex':
True, 'imaginary': False, 'nonzero': True}, 'real', False)
I think this should be considered in the context of the new
assumptions system, because that is what we eventually use. There,
the refine() function simplifies expressions based on assumptions.
Right now it doesn't work for this:
In [7]: refine(a, ~Q.positive(a)&~Q.negative(a)&Q.real(a))
Out[7]: a
But I think what we should look at is making refine smart enough to do
this, rather than trying to fix the old system to be smart about these
things, because, again, the old system is going away. Not only that,
but there's a reason that we're going with a model where you call
refine rather than things trying to simplify automatically.
Aaron Meurer
On Thu, Nov 24, 2011 at 9:16 PM, smichr <[email protected]> wrote:
>>>> var('a b',positive=False,negative=False,real=True)
> (a, b)
>>>> a+b
> a + b
>>>> _.is_zero
>
> Should such symbols be allowed or should 0 have been returned instead?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.