In [1]: ex = sqrt(x+1)+x+3

In [2]: ex.subs(x, solve(y-sqrt(x+1), x)[0])
Out[2]: 
        ____    
 2     ╱  2     
y  + ╲╱  y   + 2


If *y* is declared to be positive, you get the right expression.

On Wednesday, April 1, 2015 at 7:01:29 PM UTC+2, Paul Royik wrote:
>
> Is there a function that will convert sqrt(x+1)+x+3 into y^2+y+2 with 
> y=sqrt(x+1)?
> Subs is smart enough to make (x**4+x**2+2).subs(x**2, y) into y**2+y+2.
>
> But it doesn't work with initial example. Even sqrt(x+1)+x+1 is not 
> converted into y^2+y
>

-- 
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/f1136541-0c44-4c23-a206-dc637edaad70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to