Question: why typing something again, makes it integrate?

I am having hard time understanding why Maple does this.

I have an integral, which maple could not integrate. So it returns int(....,x). Which is all fine. Then I used subsindets to force all terms in form e^(ln()+ln()+...) to expand in order to simplify the integrand, just for display purposes. 

subsindets returns back the integral unevaluated (as expected) but with integrand a little simpler, again as expected.

All is well so far.  

Then I find to my surprise, if I type the result back one more type, now the the integral actually evaluates.

Why? 

I have 2 questions on this.

1) If the original integral did not evaluate, why simplifying e^(ln()+ln()+...) makes it now evaluate? Did not Maple know this allready?

2) Why result back from subsindets remained unevaluated integral, and I had to type it again to see it now evaluates?

I found this after long time debugging, since this was done in code, not looking at screen. 

What happened is this: I store the result  of subsindets in a variable, and when I look at it in the debugger, I see int() still there, as expected.

I call a function to return back this result. I now see int() is gone!   So the act of just returning the result back, caused it to evaluate. Even though the orginal variable still had int() in it as. So returning the expression back, was equivalent to typing it again on the screen in the example below, which caused it to evaluate. 


Please see worksheet below.

interface(version);

`Standard Worksheet Interface, Maple 2020.2, Windows 10, November 11 2020 Build ID 1502365`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 882. The version installed in this computer is 881 created 2020, November 21, 11:11 hours Pacific Time, found in the directory C:\Users\me\maple\toolbox\2020\Physics Updates\lib\`

restart;

expr:=int(-1/2*exp((ln(a+cos(1/2*x)^2)+(-2*a-2)*ln(cos(1/2*x)))/a)*(-1+cos(x))/sin(1/2*x)/cos(1/2*x)/(a+cos(1/2*x)^2),x);

int(-(1/2)*exp((ln(a+cos((1/2)*x)^2)+(-2*a-2)*ln(cos((1/2)*x)))/a)*(-1+cos(x))/(sin((1/2)*x)*cos((1/2)*x)*(a+cos((1/2)*x)^2)), x)

#try again
expr;

int(-(1/2)*exp((ln(a+cos((1/2)*x)^2)+(-2*a-2)*ln(cos((1/2)*x)))/a)*(-1+cos(x))/(sin((1/2)*x)*cos((1/2)*x)*(a+cos((1/2)*x)^2)), x)

expr:=subsindets(expr,'specfunc( anything, exp )',f->(`if`(has(op(1,f),'ln'),expand(f),f)));

int(-(1/2)*(a+cos((1/2)*x)^2)^(1/a)*(-1+cos(x))/(cos((1/2)*x)^3*(cos((1/2)*x)^(1/a))^2*sin((1/2)*x)*(a+cos((1/2)*x)^2)), x)

#notice, the above is still int. Why is typing expr again, now makes it evaluate??
expr

-((4*a*exp(I*x)+exp((2*I)*x)+2*exp(I*x)+1)^(1/a)*exp(-((1/2)*I)*(2*csgn(I*exp(I*x)+I)*Pi*csgn(I*cos((1/2)*x))^2-2*csgn(I*exp(I*x)+I)*Pi*csgn(I*cos((1/2)*x))*csgn(I*exp(-((1/2)*I)*x))-2*Pi*csgn(I*cos((1/2)*x))^3+2*Pi*csgn(I*cos((1/2)*x))^2*csgn(I*exp(-((1/2)*I)*x))-Pi*csgn(I*exp(I*x))^3+2*Pi*csgn(I*exp(I*x))^2*csgn(I*exp(((1/2)*I)*x))-Pi*csgn(I*exp(I*x))*csgn(I*exp(((1/2)*I)*x))^2-Pi*csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2+Pi*csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))*csgn(I*exp(-I*x))+Pi*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^3-Pi*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2*csgn(I*exp(-I*x))-4*x*a)/a)/((exp(I*x)+1)^(1/a))^2-2*(4*a*exp(I*x)+exp((2*I)*x)+2*exp(I*x)+1)^(1/a)*exp(-((1/2)*I)*(2*csgn(I*exp(I*x)+I)*Pi*csgn(I*cos((1/2)*x))^2-2*csgn(I*exp(I*x)+I)*Pi*csgn(I*cos((1/2)*x))*csgn(I*exp(-((1/2)*I)*x))-2*Pi*csgn(I*cos((1/2)*x))^3+2*Pi*csgn(I*cos((1/2)*x))^2*csgn(I*exp(-((1/2)*I)*x))-Pi*csgn(I*exp(I*x))^3+2*Pi*csgn(I*exp(I*x))^2*csgn(I*exp(((1/2)*I)*x))-Pi*csgn(I*exp(I*x))*csgn(I*exp(((1/2)*I)*x))^2-Pi*csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2+Pi*csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))*csgn(I*exp(-I*x))+Pi*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^3-Pi*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2*csgn(I*exp(-I*x))-2*x*a)/a)/((exp(I*x)+1)^(1/a))^2+(4*a*exp(I*x)+exp((2*I)*x)+2*exp(I*x)+1)^(1/a)*exp(-((1/2)*I)*Pi*(2*csgn(I*exp(I*x)+I)*csgn(I*cos((1/2)*x))^2-2*csgn(I*exp(I*x)+I)*csgn(I*cos((1/2)*x))*csgn(I*exp(-((1/2)*I)*x))-2*csgn(I*cos((1/2)*x))^3+2*csgn(I*cos((1/2)*x))^2*csgn(I*exp(-((1/2)*I)*x))-csgn(I*exp(I*x))^3+2*csgn(I*exp(I*x))^2*csgn(I*exp(((1/2)*I)*x))-csgn(I*exp(I*x))*csgn(I*exp(((1/2)*I)*x))^2+csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))*csgn(I*exp(-I*x))-csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2*csgn(I*exp(-I*x))-csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2+csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^3)/a)/((exp(I*x)+1)^(1/a))^2)/((a+1)*(exp(I*x)+1)^2)

 


 

Download why_it_now_evaluates.mw

Another simpler example, is just doing assignment to new variable. This causes evaluation.

restart;
expr:=int(-1/2*exp((ln(a+cos(1/2*x)^2)+(-2*a-2)*ln(cos(1/2*x)))/a)*(-1+cos(x))/sin(1/2*x)/cos(1/2*x)/(a+cos(1/2*x)^2),x);
expr:=subsindets(expr,'specfunc( anything, exp )',f->(`if`(has(op(1,f),'ln'),expand(f),f)));
#the above still has int() in it.

#this assignment, also causes evaluation
A:=expr;

 

Please Wait...