The following (%o2) is a bug in changevar. In constrast, (%o3) is O.K.
The problem is that the answer contains both original and new variables.
Has been reported also in the maxima mailing list: http://thread.gmane.org/gmane.comp.mathematics.maxima.general/37587
The problem is also in Maxima 5.26.
Maxima 5.24.0 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (a.k.a. GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) display2d:false;
(%o1) false
(%i2) changevar('integrate(((cos(x)+sin(x)))^(6)*(-sin(x)+cos(x)),x),t=cos(x)+sin(x),t,x);
(%o2) 'integrate(sin(x)^6+(6*cos(x)-12*t)*sin(x)^5
+(15*cos(x)^2-60*t*cos(x)+60*t^2)*sin(x)^4
+(20*cos(x)^3-120*t*cos(x)^2+240*t^2*cos(x)-160*t^3)
*sin(x)^3
+(15*cos(x)^4-120*t*cos(x)^3+360*t^2*cos(x)^2
-480*t^3*cos(x)+240*t^4)
*sin(x)^2
+(6*cos(x)^5-60*t*cos(x)^4+240*t^2*cos(x)^3
-480*t^3*cos(x)^2+480*t^4*cos(x)-192*t^5)
*sin(x)+cos(x)^6-12*t*cos(x)^5+60*t^2*cos(x)^4
-160*t^3*cos(x)^3+240*t^4*cos(x)^2-192*t^5*cos(x)
+64*t^6,t)
(%i3) changevar('integrate(((cos(x)+sin(x)))^(1/6)*(-sin(x)+cos(x)),x),t=cos(x)+sin(x),t,x);
(%o3) 'integrate((cos(x)-sin(x))*(sin(x)+cos(x))^(1/6),x)
(%i4) bug_report();
The Maxima bug database is available at
http://sourceforge.net/tracker/?atid=104933&group_id=4933&func=browse
Submit bug reports by following the 'Add new' link on that page.
Please include the following information with your bug report:
-------------------------------------------------------------
Maxima version: 5.24.0
Maxima build date: 10:27 5/17/2011
Host type: i686-pc-linux-gnu
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.7
-------------------------------------------------------------
The above information is also reported by the function 'build_info'.
(%o4) ""
(%i5)
One solution of this bug is
(%i1)
changevar1(S,tr,t,x):=block(
factor(first(S)/diff(rhs(tr),x)),
ratsubst (t,rhs(tr),%%),
if member(x,listofvars(%%))
then changevar(S,tr,t,x) else
'integrate(%%,t))$
Test examples:
(%i2)
changevar1('integrate(sqrt(x+sin(x))*(1+cos(x)),x),t=x+sin(x),t,x);
changevar1('integrate(sqrt(x+sin(x))*(1+cos(x)),x),t=x+sin(x),t,x);
changevar1('integrate(sqrt(sin(x))*(cos(x)),x),t=sin(x),t,x);
changevar1('integrate((2+sin(x+log(x)))*(1+1/x),x),t=x+log(x),t,x);
changevar1('integrate((2+exp(x+log(x)))*(1+1/x),x),t=2+exp(x+log(x)),t,x);
changevar1('integrate((2+exp(x+sin(x)))*(1+cos(x)),x),t=x+sin(x),t,x);
changevar1('integrate(sqrt((cos(x)+sin(x)))*(sin(x)-cos(x)),x),t=cos(x)+sin(x),t,x);
changevar1('integrate(((cos(x)+sin(x)))^(1/6)*(-sin(x)+cos(x)),x),t=cos(x)+sin(x),t,x);
changevar1('integrate((log(x)+1)*sqrt(1+(x*log(x))^2),x),u=x*log(x),u,x);
changevar1('integrate((x*cos(x)+sin(x))/(x*sin(x))^2,x),y=x*sin(x),y,x);
changevar1('integrate((x^2+1)/(x^4+1),x),y=x-1/x,y,x);
changevar1('integrate(exp(sqrt(x))/sqrt(x),x),t=sqrt(x),t,x);
changevar1('integrate(sqrt(1+sqrt(x+1)),x),t=1+sqrt(x+1),t,x);
changevar1('integrate((x+1)/(x+exp(-x)),x),t=x*exp(x)+1,t,x);
(%o2) integrate(sqrt(t),t)
(%o3) integrate(sqrt(t),t)
(%o4) integrate(sqrt(t),t)
(%o5) integrate(sin(t)+2,t)
(%o6) integrate(t/(t-2),t)
(%o7) integrate(%e^t+2,t)
(%o8) -integrate(sqrt(t),t)
(%o9) integrate(t^(1/6),t)
(%o10) integrate(sqrt(u^2+1),u)
(%o11) integrate(1/y^2,y)
(%o12) integrate(1/(y^2+2),y)
(%o13) 2*integrate(%e^t,t)
(%o14) integrate(2*t^(3/2)-2*sqrt(t),t)
(%o15) integrate(1/t,t)
Aleksas D