Unfortunately, we have two assumptions systems, the old one, and the
new one (which will someday completely replace the old one), and they
aren't fully integrated. Symbol('p', positive=True) and p.is_positive
is the old system. This is the system that most parts of SymPy use,
so it should work the best. In particular, for your use case, you can
do something like
In [1]: x = Symbol('x', real=True)
In [2]: solve(x**3 + x, x)
Out[2]: [0]
(with generic x, you would get [0, I, -I])
The ask() and Q are the new assumptions. These are still a work in
progress, but will ultimately provide a much more expressive system,
since you can assume things on arbitrary expressions instead of just
symbols, and combine them into arbitrary logical expressions.
Aaron Meurer
On Wed, Sep 19, 2012 at 5:34 PM, G B <[email protected]> wrote:
> I'm trying to figure out how assumptions work and how they might be used to
> reject complex solutions.
>
> The first problem I'm having is how to test assumptions manually. I'm
> finding that:
> ask(Q.positive(1)) --> True
> ask(Q.positive(-1)) --> False
>
> but:
> d=symbols('d',positive=True)
> ask(Q.positive(d)) --> None
>
> d.is_positive does True (though I could swear it returned None before I
> started this email...).
>
> What is the right interface for testing assumptions?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/1Ws-C-kKRoIJ.
> 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.