Is there any way subs can substitute 3x+3y into 3t without factoring first?
I enter 3*(x+y) but sympy automatically converts it into 3x+3y and subs doesn't work. 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/84a4ee0a-7dd2-42c4-9471-e1a0b9ef7b41%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.