On Thu, Dec 4, 2014 at 7:38 AM, Paul Royik <[email protected]> wrote:
> Suppose that I have an expression
>
> e = x**2+sqrt(a**2*b**2)
> What is the best way to assign to expression assumption that all variables
> are Positive, so that equivalent of e is x**2+ab?

It should be done like this:

In [11]: refine(e, Q.positive(a) & Q.positive(b))
Out[11]:
        _______
 2     ╱  2  2
x  + ╲╱  a ⋅b


But unfortunately that doesn't work. So the only other way is the old
way like this:

In [12]: a = Symbol("a", positive=True)

In [13]: b = Symbol("b", positive=True)

In [14]: x**2+sqrt(a**2*b**2)
Out[14]:
       2
a⋅b + x


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].
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/CADDwiVALOT_JKL_4RYEJwWvru7seC1o2%2BcR8tTOj02xEkbdKvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to