Bug in changevar. Should I submit the bug report?



Robert Marik
   marik at mendelu.cz     writes:

Helo, thanks for the suggestion.

changevar can be used to substitute 2*  x=t in
1/2*'integrate(exp(2*x),x)
but changevar1 fails with the following error

(%i4) changevar(('integrate(exp(2*x),x))/2,2*x = t,t,x)
(%o4) ('integrate(%e^t,t))/4
(%i5) changevar1(('integrate(exp(2*x),x))/2,2*x = t,t,x)
expt: undefined: 0 to a negative exponent.
#0: changevar1(s=('integrate(%e^(2*x),x))/2,tr=2*x = t,t=t,x=x)(a.mac line
1)
 -- an error. To debug this try: debugmode(true);


Robert Marik


**************************************************************************

In changevar1 the second argument must be transformation in form t=phi(x)

Updated version of changevar1 with error message:

(%i1)
changevar1(S,tr,t,x):=block(
if is(first(tr)#t or op(tr)#"=")
then error("the second argument must be transformation in form t=phi(x)"),
factor(first(S)/diff(rhs(tr),x)),
ratsubst (t,rhs(tr),%%),
if member(x,listofvars(%%))
then changevar(S,tr,t,x) else
'integrate(%%,t))$

old version of changevar1 see in
http://www.math.utexas.edu/pipermail/maxima/2012/028202.html


Help for changevar1

changevar1 perform a change of variables in an indefinite integral

Calling Sequence: changevar1(S,tr,t,x)

Arguments: S - indefinite integral

           tr -  transformation in form t=phi(x)

            t - new variable

            x - old variable


 Examples:

(%i2) changevar1(('integrate(exp(2*x),x))/2, t=2*x,t,x);
(%o2) integrate(%e^t,t)/4

(%i3) changevar1(('integrate(exp(2*x),x))/2, u=2*x,u,x);
(%o3) integrate(%e^u,u)/4

(%i4) changevar1(('integrate(exp(2*x),x))/2, 2*x=t,t,x);
the second argument must be transformation in form t=phi(x)
#0: changevar1(s=('integrate(%e^(2*x),x))/2,tr=2*x = t,t=t,x=x)
 -- an error. To debug this try: debugmode(true);

(%i5) changevar1('integrate((2+sin(x+log(x)))*(1+1/x),x),t=x+log(x),t,x);
(%o5) integrate(sin(t)+2,t)

(%i6)
changevar1('integrate((x*cos(x)+sin(x))/(x*sin(x))^2,x),y=x*sin(x),y,x);
(%o6) integrate(1/y^2,y)

(%i7)
changevar1('integrate((log(x)+1)*sqrt(1+(x*log(x))^2),x),u=x*log(x),u,x);
(%o7) integrate(sqrt(u^2+1),u)

(%i8) changevar1('integrate((x+1)/(x+exp(-x)),x),t=x*exp(x)+1,t,x);
(%o8) integrate(1/t,t)

Aleksas D