Bug in changevar. Should I submit the bug report?



On 3/22/12, Robert Marik  marik at mendelu.cz
<maxima%40math.utexas.edu?Subject=Re%3A%20%5BMaxima%5D%20Bug%20in%20changevar.%20Should%20I%20submit%20the%20bug%20report%3F&In-Reply-To=%3Cloom.20120322T152035-866%40post.gmane.org%3E>
wrote:



Dear all,

I think that the following computation is a bug in changevar. Trying
substitution cos(x)+sin(x)=t  in  integral of
(cos(x)+sin(x))^6*(-sin(x)+cos(x))
I get a mixture of function in t and x variable, see the output of (%o2).
The same is in version 5.24. Substutitution in
(cos(x)+sin(x))^(1/6)*(-sin(x)+cos(x))  gives t^(1/6), as expected.

I was not able to find related bugreport. Should I open new one?
Can you confirm
that this is a new bug? Thanks.

Robert Marik

-----------------------------------------------------------

Maxima 5.26.0 http://maxima.sourceforge.net
using Lisp SBCL 1.0.50.0.debian
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)


***********************************************************************************
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)

Please send comments.  Thank you in advance.

Aleksas D