nm

10229 Reputation

19 Badges

12 years, 149 days

MaplePrimes Activity


These are questions asked by nm

Maple int gives one result, called the "default" result unless one uses method=_RETURNVERBOSE to look for other results.

First, how does Maple decide what is "default" i.e. given all the methods listed, what method then used for "default".

Here is an example where default result makes it hard to solve for a differential equation. The integrand is 

1/(y+sqrt(y))

Maple int default gives anti as ln(y - 1) + 2*arctanh(sqrt(y))  which is complex valued for all y. The arctanh is only defined for argument between -1 and 1 also. Having sqrt there makes it now valid for 0 to 1. But ln(y-1) is negative in this region also. Hence complex. 

Using method=_RETURNVERBOSE we see much better anti derivatives hidding there and given by "derivativedivides" and "meijerg" as 2*ln(1 + sqrt(y)) which is complex valued only for negative y and real for all positive y. Same for "trager"  ln(2*sqrt(y) + 1 + y)

So it would have been much better if Maple picks the best anti-derivative automatically and use that for default instead and give this to the user.

Why is this important? Try to solve   the ode y'/(y+sqrt(y))=2 with IC y(0)=1 and you see we can't solve for the constant of integration using  ln(y - 1) + 2*arctanh(sqrt(y))=2x+c since at y=1 we get division by zero. If Maple had returned 2*ln(1 + sqrt(y)) instead then solving for constant of integration is trivial now since anti is real and defined at y=1

This is just one example of many.

My question is, How does Maple integrate decide what is "default" and why it does not try harder to pick better one (using number of known metrices for this sort of thing) from the other solvers it already has access to?  

What is the point of having all these other nice integrate methods, if the default used is not the "best" one?

Should user then always use method=_RETURNVERBOSE and then try to pick the "best" one themselves? This will be too much work for user to do.

I think Maple should do this automatically. Btw, I tried few other CAS integrators and the all give the better result given above by "meijerg" automatically.

Maple 2024

 

Update

Here is a quick function, called it smart_int() which returns the anti-derivative with the smallest leaf size from Maple.

Ofcourse smallest leaf size does not mean the anti-derivative is necessarily the "best" using other measures. But this function already allowed me to solve some ode's I could not solve before using Maple's defaullt int result because it made solving for constant of integration easier now.

Feel free to improve and change. If you find any bugs please let me know

The test here shows the result of smart_int compared to int on few integrals. You see on many of them smart_int gives smaller result. Additional criteria for selection can ofcourse be added and I will probably do that.

For example, do not pick ones with complex numbers if there is one without even though leaf size is smaller. This check has been added also.

Check the last integral in this test. The difference is so large. 


 

restart:

8456

#smart_int picks the anti-derivative with smallest leaf count
#version June 1, 2024. Maple 2024
#change: added check not to pick one with complex even is smaller
#change: added percentage reduction

smart_int:=proc(integrand,x::symbol)
local anti,result_of_int,a,b;

    local F:=proc(a,b)::truefalse;       
       if (has(a,I) and has(b,I)) or ( not has(a,I)  and not has(b,I)) then
           evalb(MmaTranslator:-Mma:-LeafCount(a)<MmaTranslator:-Mma:-LeafCount(b));
       elif has(a,I) then
           false;
       else
           true;
       fi;
    end proc;

    try
        anti := timelimit(60,int(integrand,x,'method'=':-_RETURNVERBOSE'));
        if evalb(op(0,anti)='int') then
           RETURN(anti);
        fi;   
    catch:
        RETURN(Int(integrand,x));
    end try;
    
    result_of_int := select(type,anti,string=algebraic);
    if nops(result_of_int)=0 then
        RETURN(Int(integrand,x));
    fi;

    result_of_int := map(X->rhs(X),result_of_int);
    result_of_int := sort(result_of_int,(a,b)->F(a,b));

    #return the one with smallest leaf size
    RETURN(result_of_int[1]);
    
end proc:

#TESTS

tests:=[1/(x+sqrt(x)),1/(sin(x)),1/(cos(x)),sin(x)/(sin(x)+1),1/((1+x)^(2/3)-(1+x)^(1/2)),1/x^3/(1+x)^(3/2),1/(1-x)^(7/2)/x^5,x*((-a+x)/(b-x))^(1/2),x/(-x^2+5)/(-x^2+3)^(1/2),exp(arcsin(x))*x^3/(-x^2+1)^(1/2),x*arctan(x)^2*ln(x^2+1),(x^2+1)/(-x^2+1)/(x^4+1)^(1/2),(a+b*f*x+b*sin(f*x+e))/(a+a*cos(f*x+e)),x*ln(1/x+1),1/x/(x^5+1)];
result:=map(X->[Int(X,x),int(X,x),smart_int(X,x)],tests):
for item in result do
    print("###################################\nintegral",item[1]);
    print("maple default result ",item[2]);
    print("smart int result ",item[3]);
    PERCENTAGE:=MmaTranslator:-Mma:-LeafCount(item[3])*100/MmaTranslator:-Mma:-LeafCount(item[2]):
    print("smart int percentage size relative to default ",sprintf("%.2f",PERCENTAGE));
od:
 

[1/(x+x^(1/2)), 1/sin(x), 1/cos(x), sin(x)/(sin(x)+1), 1/((1+x)^(2/3)-(1+x)^(1/2)), 1/(x^3*(1+x)^(3/2)), 1/((1-x)^(7/2)*x^5), x*((-a+x)/(b-x))^(1/2), x/((-x^2+5)*(-x^2+3)^(1/2)), exp(arcsin(x))*x^3/(-x^2+1)^(1/2), x*arctan(x)^2*ln(x^2+1), (x^2+1)/((-x^2+1)*(x^4+1)^(1/2)), (a+b*f*x+b*sin(f*x+e))/(a+a*cos(f*x+e)), x*ln(1/x+1), 1/(x*(x^5+1))]

"###################################
integral", Int(1/(x+x^(1/2)), x)

"maple default result ", ln(x-1)+2*arctanh(x^(1/2))

"smart int result ", 2*ln(x^(1/2)+1)

"smart int percentage size relative to default ", "72.73"

"###################################
integral", Int(1/sin(x), x)

"maple default result ", ln(csc(x)-cot(x))

"smart int result ", ln(tan((1/2)*x))

"smart int percentage size relative to default ", "62.50"

"###################################
integral", Int(1/cos(x), x)

"maple default result ", ln(sec(x)+tan(x))

"smart int result ", ln(sec(x)+tan(x))

"smart int percentage size relative to default ", "100.00"

"###################################
integral", Int(sin(x)/(sin(x)+1), x)

"maple default result ", 2/(tan((1/2)*x)+1)+x

"smart int result ", (x*tan((1/2)*x)+2+x)/(tan((1/2)*x)+1)

"smart int percentage size relative to default ", "150.00"

"###################################
integral", Int(1/((1+x)^(2/3)-(1+x)^(1/2)), x)

"maple default result ", 6*(1+x)^(1/6)+3*(1+x)^(1/3)+ln(x)+2*ln((1+x)^(1/6)-1)-ln((1+x)^(1/3)+(1+x)^(1/6)+1)-2*ln((1+x)^(1/6)+1)+ln((1+x)^(1/3)-(1+x)^(1/6)+1)-ln((1+x)^(1/2)+1)+ln((1+x)^(1/2)-1)+2*ln((1+x)^(1/3)-1)-ln((1+x)^(2/3)+(1+x)^(1/3)+1)

"smart int result ", 3*(1+x)^(1/3)+6*(1+x)^(1/6)+6*ln((1+x)^(1/6)-1)

"smart int percentage size relative to default ", "22.73"

"###################################
integral", Int(1/(x^3*(1+x)^(3/2)), x)

"maple default result ", (1/8)/((1+x)^(1/2)+1)^2+(7/8)/((1+x)^(1/2)+1)-(15/8)*ln((1+x)^(1/2)+1)-(1/8)/((1+x)^(1/2)-1)^2+(7/8)/((1+x)^(1/2)-1)+(15/8)*ln((1+x)^(1/2)-1)+2/(1+x)^(1/2)

"smart int result ", (1/4)*(15*x^2+5*x-2)/((1+x)^(1/2)*x^2)-(15/4)*arctanh((1+x)^(1/2))

"smart int percentage size relative to default ", "40.28"

"###################################
integral", Int(1/((1-x)^(7/2)*x^5), x)

"maple default result ", (1/64)/((1-x)^(1/2)+1)^4+(17/96)/((1-x)^(1/2)+1)^3+(159/128)/((1-x)^(1/2)+1)^2+(1083/128)/((1-x)^(1/2)+1)-(3003/128)*ln((1-x)^(1/2)+1)-(1/64)/((1-x)^(1/2)-1)^4+(17/96)/((1-x)^(1/2)-1)^3-(159/128)/((1-x)^(1/2)-1)^2+(1083/128)/((1-x)^(1/2)-1)+(3003/128)*ln((1-x)^(1/2)-1)+(2/5)/(1-x)^(5/2)+(10/3)/(1-x)^(3/2)+30/(1-x)^(1/2)

"smart int result ", (1/960)*(45045*x^6-105105*x^5+69069*x^4-6435*x^3-1430*x^2-520*x-240)/((x-1)^2*(1-x)^(1/2)*x^4)-(3003/64)*arctanh((1-x)^(1/2))

"smart int percentage size relative to default ", "37.18"

"###################################
integral", Int(x*((-a+x)/(b-x))^(1/2), x)

"maple default result ", (1/8)*(arctan((1/2)*(-b+2*x-a)/(-a*b+a*x+b*x-x^2)^(1/2))*a^2+2*b*arctan((1/2)*(-b+2*x-a)/(-a*b+a*x+b*x-x^2)^(1/2))*a-3*arctan((1/2)*(-b+2*x-a)/(-a*b+a*x+b*x-x^2)^(1/2))*b^2+4*(-a*b+a*x+b*x-x^2)^(1/2)*x-2*(-a*b+a*x+b*x-x^2)^(1/2)*a+6*(-a*b+a*x+b*x-x^2)^(1/2)*b)*(-(-a+x)/(-b+x))^(1/2)*(-b+x)/(-(-a+x)*(-b+x))^(1/2)

"smart int result ", (1/4)*(a-3*b-2*x)*(b-x)*(-(a-x)/(b-x))^(1/2)*(-(a-x)*(b-x))^(1/2)/(-(-a+x)*(-b+x))^(1/2)+((1/4)*b*a+(1/8)*a^2-(3/8)*b^2)*arctan((x-(1/2)*a-(1/2)*b)/(-x^2+(a+b)*x-b*a)^(1/2))*(-(a-x)/(b-x))^(1/2)*(-(a-x)*(b-x))^(1/2)/(a-x)

"smart int percentage size relative to default ", "67.63"

"###################################
integral", Int(x/((-x^2+5)*(-x^2+3)^(1/2)), x)

"maple default result ", -(1/4)*2^(1/2)*arctan((1/4)*(-4-2*5^(1/2)*(x-5^(1/2)))*2^(1/2)/(-(x-5^(1/2))^2-2*5^(1/2)*(x-5^(1/2))-2)^(1/2))-(1/4)*2^(1/2)*arctan((1/4)*(-4+2*5^(1/2)*(x+5^(1/2)))*2^(1/2)/(-(x+5^(1/2))^2+2*5^(1/2)*(x+5^(1/2))-2)^(1/2))

"smart int result ", -(1/2)*2^(1/2)*arctan((1/2)*(-x^2+3)^(1/2)*2^(1/2))

"smart int percentage size relative to default ", "20.20"

"###################################
integral", Int(exp(arcsin(x))*x^3/(-x^2+1)^(1/2), x)

"maple default result ", int(exp(arcsin(x))*x^3/(-x^2+1)^(1/2), x)

"smart int result ", Int(exp(arcsin(x))*x^3/(-x^2+1)^(1/2), x)

"smart int percentage size relative to default ", "100.00"

"###################################
integral", Int(x*arctan(x)^2*ln(x^2+1), x)

"maple default result ", (2*I)*ln(2)*arctan(x)-ln((1+I*x)^2/(x^2+1)+1)*arctan(x)^2*x^2+(1/2)*csgn(I*(1+I*x)^2/(x^2+1))^3*Pi*arctan(x)+(1/2)*csgn(I*(1+I*x)^2/((x^2+1)*((1+I*x)^2/(x^2+1)+1)^2))^3*Pi*arctan(x)-I*csgn(I*(1+I*x)/(x^2+1)^(1/2))*csgn(I*(1+I*x)^2/(x^2+1))^2*Pi*arctan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i+(1/2)*csgn(I*(1+I*x)^2/((x^2+1)*((1+I*x)^2/(x^2+1)+1)^2))*csgn(I/((1+I*x)^2/(x^2+1)+1)^2)*csgn(I*(1+I*x)^2/(x^2+1))*Pi*arctan(x)+I*ln((1+I*x)^2/(x^2+1)+1)*Pi*csgn(I*((1+I*x)^2/(x^2+1)+1))*csgn(I*((1+I*x)^2/(x^2+1)+1)^2)^2-(1/2)*arctan(x)^2

"smart int result ", (1/2)*ln(x^2+1)*arctan(x)^2*x^2-(1/2)*arctan(x)^2*x^2-ln(x^2+1)*arctan(x)*x+(1/2)*ln(x^2+1)*arctan(x)^2+3*arctan(x)*x-(3/2)*arctan(x)^2+(1/4)*ln(x^2+1)^2-(3/2)*ln(x^2+1)

"smart int percentage size relative to default ", "2.45"

"###################################
integral", Int((x^2+1)/((-x^2+1)*(x^4+1)^(1/2)), x)

"maple default result ", (1/4)*(arctanh((x^2-x+1)*2^(1/2)/(x^4+1)^(1/2))-arctanh((x^2+x+1)*2^(1/2)/(x^4+1)^(1/2)))*2^(1/2)

"smart int result ", (1/2)*arctanh((1/2)*(x^4+1)^(1/2)*2^(1/2)/x)*2^(1/2)

"smart int percentage size relative to default ", "45.65"

"###################################
integral", Int((a+b*f*x+b*sin(f*x+e))/(a+a*cos(f*x+e)), x)

"maple default result ", tan((1/2)*f*x+(1/2)*e)/f+b*x*tan((1/2)*f*x+(1/2)*e)/a-b*ln(1+tan((1/2)*f*x+(1/2)*e)^2)/(a*f)-b*ln(cos(f*x+e)+1)/(a*f)

"smart int result ", tan((1/2)*f*x+(1/2)*e)*(b*f*x+a)/(a*f)

"smart int percentage size relative to default ", "31.43"

"###################################
integral", Int(x*ln(1/x+1), x)

"maple default result ", (1/2)*ln(1/x)+(1/2)*x-(1/2)*ln(1/x+1)*(1/x+1)*(1/x-1)*x^2

"smart int result ", (1/2)*x^2*ln(1/x+1)+(1/2)*x-(1/2)*ln(1+x)

"smart int percentage size relative to default ", "67.74"

"###################################
integral", Int(1/(x*(x^5+1)), x)

"maple default result ", -(1/5)*ln(1+x)+ln(x)-(1/5)*ln(x^4-x^3+x^2-x+1)

"smart int result ", ln(x)-(1/5)*ln(x^5+1)

"smart int percentage size relative to default ", "39.29"

 


 

Download smart_int.mw

 

Any workaround or why ODESteps gives this internal Maple error?  Is this known limitation of ODESteps?

ps. reported also to Maplesoft just in case.

17128

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1750 and is the same as the version installed in this computer, created 2024, May 31, 10:47 hours Pacific Time.`

restart;

20456

ode:=diff(y(x), x) - 2*y(x) = 2*sqrt(y(x));
DEtools:-odeadvisor(ode);
 

diff(y(x), x)-2*y(x) = 2*y(x)^(1/2)

[_quadrature]

ic:=y(0) = 1;
Student:-ODEs:-ODESteps([ode,ic]);

y(0) = 1

Error, (in ln) numeric exception: division by zero

restart;

20456

ode:=diff(y(x), x) - 2*y(x) = 2*sqrt(y(x));
ic:=y(0) = 1;
dsolve([ode,ic]);

diff(y(x), x)-2*y(x) = 2*y(x)^(1/2)

y(0) = 1

y(x) = 4*exp(2*x)-4*exp(x)+1

 

 

Download bug_in_odesteps_divide_by_zero_may_31_2024.mw

Given the ode   y''(x)*y'(x)=0, clearly it has solutions for y''=0 and y'=0.

These are y=c1+x*c2 and y=c1. But Maple gives 3 solutions

12592

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

ode:=diff(y(x),x$2)*diff(y(x),x)=0;

(diff(diff(y(x), x), x))*(diff(y(x), x)) = 0

dsolve(ode)

y(x) = c__1, y(x) = -c__1*x+c__2, y(x) = c__1*x+c__2

dsolve(diff(y(x),x$2)=0)

y(x) = c__1*x+c__2

dsolve(diff(y(x),x)=0)

y(x) = c__1

 

 

Download why_3_solutions_may_24_2024.mw

Where did the third solution come from? The 3 solutions are correct ofcourse, but why 3? There should only be two. 

FYI, I am using 

Physics:-Version()

The "Physics Updates" version in the MapleCloud is 1746. The 

   version installed in this computer is 1745 created 2024, May 

I have to check earlier Maple versions to see if same thing happens there.

This ode can be solved by just looking at it

ode:=(x+y(x))*diff(y(x),x)=0;

We see the solution is y=-x and y=c__1 because either (x+y)=0 or y'=0

But for some reason ODESteps(ode) says it cannot compute integral.

Any idea why?


 

26348

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

ode:=(x+y(x))*diff(y(x),x)=0;
Student:-ODEs:-ODESteps(ode);

ode := (x+y(x))*(diff(y(x), x)) = 0

"[[,,"Let's solve"],[,,(x+y(x)) ((&DifferentialD;)/(&DifferentialD;x) y(x))=0],["&bullet;",,"Highest derivative means the order of the ODE is" 1],[,,(&DifferentialD;)/(&DifferentialD;x) y(x)],["&bullet;",,"Integrate both sides with respect to" x],[,,&int;(x+y(x)) ((&DifferentialD;)/(&DifferentialD;x) y(x)) &DifferentialD;x=&int;0 &DifferentialD;x+`c__1`],["&bullet;",,"Cannot compute integral"],[,,&int;(x+y(x)) ((&DifferentialD;)/(&DifferentialD;x) y(x)) &DifferentialD;x=`c__1`]]"

 


 

Download odestep_quadrature_unable_to_solve_maple_2024.mw

update:

Here is another simpler example that also confused it
 

26348

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

ode:=x*diff(y(x),x)=0;
Student:-ODEs:-ODESteps(ode);

ode := x*(diff(y(x), x)) = 0

"[[,,"Let's solve"],[,,x ((&DifferentialD;)/(&DifferentialD;x) y(x))=0],["&bullet;",,"Highest derivative means the order of the ODE is" 1],[,,(&DifferentialD;)/(&DifferentialD;x) y(x)],["&bullet;",,"Integrate both sides with respect to" x],[,,&int;x ((&DifferentialD;)/(&DifferentialD;x) y(x)) &DifferentialD;x=&int;0 &DifferentialD;x+`c__1`],["&bullet;",,"Cannot compute integral"],[,,&int;x ((&DifferentialD;)/(&DifferentialD;x) y(x)) &DifferentialD;x=`c__1`]]"

 

 


 

Download odestep_quadrature_unable_to_solve_v2_maple_2024.mw

update

Here is another one which it gets wrong. 
 

26348

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

ode:=y(x)*diff(y(x),x)=0;
Student:-ODEs:-ODESteps(ode);

ode := y(x)*(diff(y(x), x)) = 0

"[[,,"Let's solve"],[,,y(x) ((&DifferentialD;)/(&DifferentialD;x) y(x))=0],["&bullet;",,"Highest derivative means the order of the ODE is" 1],[,,(&DifferentialD;)/(&DifferentialD;x) y(x)],["&bullet;",,"Integrate both sides with respect to" x],[,,&int;y(x) ((&DifferentialD;)/(&DifferentialD;x) y(x)) &DifferentialD;x=&int;0 &DifferentialD;x+`c__1`],["&bullet;",,"Evaluate integral"],[,,((y(x))^2)/2=`c__1`],["&bullet;",,"Solve for" y(x)],[,,{y(x)=sqrt(2) sqrt(`c__1`),y(x)=-sqrt(2) sqrt(`c__1`)}]]"

dsolve(ode);

y(x) = 0, y(x) = -c__1

 


The correct solution is given by dsolve, which is y=0 and y=constant (I do not know why dsolve put minus sign in front of the constant, but it is still correct).

Download odestep_quadrature_unable_to_solve_v3_maple_2024.mw

 

 

I can't understand this behavior. Any idea why it happens?

Solve is able to solve equation   f(y)=x+A for y, but can't solve   f(y)=x for y.

This is unexpected for me. I do not see why it can solve it when RHS is x+A but not when RHS is just x.


 

21040

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1745. The version installed in this computer is 1744 created 2024, April 17, 19:33 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

restart;

21040

sol:=int(1/sqrt(sin(y)),y);
solve(sol=x,y)

(sin(y)+1)^(1/2)*(-2*sin(y)+2)^(1/2)*(-sin(y))^(1/2)*EllipticF((sin(y)+1)^(1/2), (1/2)*2^(1/2))/(cos(y)*sin(y)^(1/2))

Warning, solutions may have been lost

sol:=int(1/sqrt(sin(y)),y);
solve(sol=x+b,y):
{%}; #to eliminate duplicates

(sin(y)+1)^(1/2)*(-2*sin(y)+2)^(1/2)*(-sin(y))^(1/2)*EllipticF((sin(y)+1)^(1/2), (1/2)*2^(1/2))/(cos(y)*sin(y)^(1/2))

{arctan(JacobiSN(((1/2)*I)*2^(1/2)*(x+b), (1/2)*2^(1/2))^2-1, -(1/2)*JacobiSN(((1/2)*I)*2^(1/2)*(x+b), (1/2)*2^(1/2))*(4-2*JacobiSN(((1/2)*I)*2^(1/2)*(x+b), (1/2)*2^(1/2))^2)^(1/2)*2^(1/2)), arctan(JacobiSN(((1/2)*I)*2^(1/2)*(x+b), (1/2)*2^(1/2))^2-1, (1/2)*JacobiSN(((1/2)*I)*2^(1/2)*(x+b), (1/2)*2^(1/2))*(4-2*JacobiSN(((1/2)*I)*2^(1/2)*(x+b), (1/2)*2^(1/2))^2)^(1/2)*2^(1/2))}

 


I can trick it to solve  f(y)=x for y  by asking it to solve f(y)=x+A for y and then set A=0 in the solution. But one should not have to do this. Is this a bug or Am I missing something?

Download why_solve_when_adding_term_only_may_22_2024.mw

First 17 18 19 20 21 22 23 Last Page 19 of 186