Your aaproach fails when we want to substitute sqrt(xy+1) for u. What to solve here?
On Thursday, April 2, 2015 at 4:17:54 PM UTC+3, Paul Royik wrote: > > Another smart solution. Thanks a ton. > > Maybe you can tell me why the following code doesn't work: > https://github.com/sympy/sympy/issues/9233 > > On Thursday, April 2, 2015 at 12:15:02 PM UTC+3, Francesco Bonazzi wrote: >> >> 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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. 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/085dd1a9-516e-4f42-a203-578dd511d446%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.