On 08/11/2011 07:04 PM, Tomo Lazovich wrote:
I just tried this in isympy and as long as you specify both real and positive, it seems to work:

In [1]: r = Symbol('r', real=True, positive=True)

In [2]: sqrt(r*r)
Out[2]: r

In [3]: r = Symbol('r', real=True)

In [4]: sqrt(r*r)
Out[4]: │r│


On Thu, Aug 11, 2011 at 6:01 PM, Alan Bromborsky <[email protected] <mailto:[email protected]>> wrote:

    I have a symbol r which should be assumed real and greater than
    zero.  What I want is for sqrt(r*r) to evaluate to r.  Can this be
    currently done in sympy.  I am trying to clean up some old code
    that has a lot of hacks in it (curvilinear coordinates).

-- You received this message because you are subscribed to the Google
    Groups "sympy" group.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:sympy%[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.
That worked fine. Now for another similar and more difficult problem. Evaluate sqrt(r**2*cos(theta)**2) where -pi/2<theta<pi/2. This should evaluate to r*cos(theta). Are symbol assumptions flexible enough yet to handle this case (again curvilinear coordinates)?

--
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.

Reply via email to