Hi Paul,

On Thu, Feb 26, 2015 at 8:32 AM, Paul Royik <[email protected]> wrote:
> What is the best way to convert sqrt(x)*sqrt(x-4) to sqrt(x^2-4x) or
> (x^2+5x+4)/sqrt(x)/sqrt(x-4) to (x^2+5x+4)/sqrt(x^2-4x)
>
> I tried replace, but it doesn't work in second case.

How did you use replace?

Note that this conversion is only valid for some "x", not all complex
"x", for example if you use imaginary unit for "x":

In [14]: x = I

In [15]: sqrt(x)*sqrt(x - 4)
Out[15]: (-1)**(1/4)*sqrt(-4 + I)

In [16]: (sqrt(x)*sqrt(x - 4)).n()
Out[16]: -1.24962106768765 + 1.60048518044024*I

In [17]: sqrt(x**2 - 4*x)
Out[17]: sqrt(-1 - 4*I)

In [18]: sqrt(x**2 - 4*x).n()
Out[18]: 1.24962106768765 - 1.60048518044024*I

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

Reply via email to