How to simplify expressions

32 views
Skip to first unread message

AlexHaifa

unread,
Jun 5, 2017, 4:03:36 PM6/5/17
to sympy
Hi gays,
I am an expirence user of Mathematica (Wolfram) and newbie of Sympy.  I have an expression which Mathematica (and even me alone) can easily simplify. I do not know how can I doit using Sympy functions. The expression is as follows:

(x+sqrt(x**2+y**2))/(x**2+y**2+x*sqrt(x**2+y**2)).

Since the denominator can be rewritten as

(x+sqrt(x**2+y**2))*sqrt(x**2+y**2)

the expression reduces to 
1/sqrt(x**2+y**2).
Thank you in advance,
Alex]

Aaron Meurer

unread,
Jun 5, 2017, 5:00:39 PM6/5/17
to sy...@googlegroups.com
You can use radsimp() (short for "radical simplify") to simplify the
expression. For whatever reason, simplify() isn't calling it
automatically.

>>> radsimp((x+sqrt(x**2+y**2))/(x**2+y**2+x*sqrt(x**2+y**2)))
1/sqrt(x**2 + y**2)

Aaron Meurer
> --
> 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 sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/e0738f1a-1a42-4c3b-8498-cc5888cd0265%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

AlexHaifa

unread,
Jun 7, 2017, 2:13:54 PM6/7/17
to sympy
Thanks a lot!
I have a qouple of questions related to integration of function sqrt(x**2+y**2) by Sympy.
I am going to ask them on a separate post.
Alex
Reply all
Reply to author
Forward
0 new messages