On 06/15/2013 01:47 PM, Aaron Meurer wrote:
Ah, that's a deficiency in refine(). It doesn't recognize that the
product of Abs is the Abs of the product. If you don't set the symbols
to be positive in the first place, you won't get Abs, and it will
work.
To replace Abs with its argument, you can do expr.replace(Abs, Id).
That will replace all instances of Abs with the identity function.
Aaron Meurer
Thank you.
expr.replace(Abs, Id)
does what I need when normalizing certain types of expressions.
On Sat, Jun 15, 2013 at 12:41 PM, Alan Bromborsky <[email protected]> wrote:
On 06/15/2013 01:27 PM, Aaron Meurer wrote:
And more specifically, to simplify square roots, use refine
In [50]: refine(sqrt((x + 1)**2), Q.positive(x + 1))
Out[50]: x + 1
Aaron Meurer
On Sat, Jun 15, 2013 at 12:24 PM, Matthew Rocklin <[email protected]>
wrote:
This is possible in new assumptions
In [1]: expr = x**2
In [2]: ask(Q.positive(expr + 1), Q.positive(expr))
Out[2]: True
On Sat, Jun 15, 2013 at 12:21 PM, Alan Bromborsky <[email protected]>
wrote:
In the latest build is there anyway to specify that the sympy
expression/function (not symbol) you are taking the sqrt of is real and
positive?
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
My problem is I don't know the form of g to start with, but I do know it is
always positive.
g = a**2*sin(b)**2
refine(sqrt(g), Q.positive(g))
Abs(a)*Abs(sin(b))
rather than a*sin(b).
Is it possible to get replace all the Abs in an expression with their
arguments?
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.