MaplePrimes Questions

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(x)*x-((1/2)*I)*csgn(I*((1+I*x)^2/(x^2+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*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

 

How to correct this code ? Thank you.

restart;
with(plots);
with(geometry);
_EnvHorizontalName := 'x';
_EnvVerticalName := 'y';
x0 := 10;
y0 := 9;
a := 7;
b := 5;
c := sqrt(a^2 - b^2);
ellipse(el, x^2/a^2 + y^2/b^2 - 1);
point(F1, -c, 0);
point(F2, c, 0);
point(P, x0, y0);
eq := simplify((a^2 - x0^2)*(y - y0)^2 + (b^2 - y0^2)*(x - x0)^2 + 2*x0*y0*(x - x0)*(y - y0)) = 0;
sol := solve({eq}, {y});
line(tang1, op(sol[1]));
slope(tang1);
line(tang2, op(sol[2]));
slope(tang2);
sol2 := op(solve({op(sol[1]), x^2/a^2 + y^2/b^2 - 1 = 0}, {x, y}));
xM2 = rhs(sol2[1]);
yM2 = rhs(sol2[2]);
point(M2, xM2, yM2);
sol3 := op(solve({op(sol[2]), x^2/a^2 + y^2/b^2 - 1 = 0}, {x, y}));
xM3 = rhs(sol3[1]);
yM3 = rhs(sol3[2]);
point(M3, xM3, yM3);
assume(xM2 - xM3 <> 0);
line(Pol, [M2, M3]);
coordinates(M2);
display(textplot([[-c, 0, "F1"], [c, 0, "F2"], [coordinates(P)[], "P"]], align = {"above", 'right'}), draw([el(color = red), P(color = black, symbol = solidcircle, symbolsize = 16), tang1(color = green), tang2(color = green), Pol(color = red, thickness = 3), F1(color = blue, symbol = solidcircle, symbolsize = 16), F2(color = red, symbol = solidcircle, symbolsize = 16)]), axes = none);
Warning, data could not be converted to float Matrix

how to solve this using integration by parts?

restart:

with(IntegrationTools):

``

eq1:=int(1-(sum(p[i]*(1-exp(-((t-xi)/tau[i]))),i=1..n)),xi=0..t);

int(1-(sum(p[i]*(1-exp(-(t-xi)/tau[i])), i = 1 .. n)), xi = 0 .. t)

(1)


Download 1111.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

What should I do to simplify eq13 further using trig sum identities?
Thank you for your help in advance,

restart;

phi := (x,n,L) -> sqrt(2/L)*sin(n*Pi*x/L + 1/2*n*Pi);

proc (x, n, L) options operator, arrow; sqrt(2/L)*sin(n*Pi*x/L+(1/2)*n*Pi) end proc

(1)

 

eq1 := W[n,m](q,p) = simplify(1/Pi*Int(phi(q+y,n,L)*exp(-2*I*p*y)*phi(q-y,m,L),y=-L/2+abs(q)..L/2-abs(q)));

W[n, m](q, p) = 2*(Int(sin((1/2)*n*Pi*(2*q+2*y+L)/L)*exp(-(2*I)*p*y)*sin((1/2)*m*Pi*(2*q-2*y+L)/L), y = -(1/2)*L+abs(q) .. (1/2)*L-abs(q)))/(L*Pi)

(2)

eq2 := simplify(convert(eq1,int)) assuming(n,integer,m,integer);

W[n, m](q, p) = (-16*(I*((-(1/4)*m^2-(1/4)*n^2)*Pi^2+p^2*L^2)*L*p*sin(n*Pi*(abs(q)+q)/L)+(1/2)*cos(n*Pi*(abs(q)+q)/L)*(((1/4)*m^2-(1/4)*n^2)*Pi^2+p^2*L^2)*n*Pi)*exp(I*p*(L-2*abs(q)))*sin(m*Pi*(L-abs(q)+q)/L)+16*exp(-I*p*(L-2*abs(q)))*(I*L*p*((-(1/4)*m^2-(1/4)*n^2)*Pi^2+p^2*L^2)*sin(m*Pi*(abs(q)+q)/L)-(1/2)*cos(m*Pi*(abs(q)+q)/L)*m*((-(1/4)*m^2+(1/4)*n^2)*Pi^2+p^2*L^2)*Pi)*sin(n*Pi*(L-abs(q)+q)/L)+8*Pi*(-m*exp(I*p*(L-2*abs(q)))*((((1/4)*m^2-(1/4)*n^2)*Pi^2-p^2*L^2)*sin(n*Pi*(abs(q)+q)/L)+I*L*p*Pi*n*cos(n*Pi*(abs(q)+q)/L))*cos(m*Pi*(L-abs(q)+q)/L)+exp(-I*p*(L-2*abs(q)))*cos(n*Pi*(L-abs(q)+q)/L)*n*((((1/4)*m^2-(1/4)*n^2)*Pi^2+p^2*L^2)*sin(m*Pi*(abs(q)+q)/L)+I*L*p*Pi*m*cos(m*Pi*(abs(q)+q)/L))))/((m-n)^2*(m+n)^2*Pi^5-8*L^2*p^2*(m^2+n^2)*Pi^3+16*L^4*p^4*Pi)

(3)

Wigner function evaluated for q > 0 and q < 0, respectively

eq10 := simplify(eq2) assuming(q>0);
eq11 := simplify(eq2) assuming(q<0);
eq12 := simplify(eq10) assuming(m,integer,n,integer);
eq13 := simplify(eq11) assuming(m,integer,n,integer);

W[n, m](q, p) = (16*exp(-I*p*(L-2*q))*(I*p*L*((-(1/4)*m^2-(1/4)*n^2)*Pi^2+p^2*L^2)*sin(n*Pi)+(1/2)*cos(n*Pi)*Pi*n*(((1/4)*m^2-(1/4)*n^2)*Pi^2+p^2*L^2))*sin(2*m*Pi*q/L)-16*exp(I*p*(L-2*q))*(I*p*L*((-(1/4)*m^2-(1/4)*n^2)*Pi^2+p^2*L^2)*sin(m*Pi)-(1/2)*Pi*cos(m*Pi)*((-(1/4)*m^2+(1/4)*n^2)*Pi^2+p^2*L^2)*m)*sin(2*n*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(-I*p*(L+2*q))*((-(1/4)*m^2+(1/4)*n^2)*Pi^2+p^2*L^2)*sin(n*Pi*(L+2*q)/L)+I*Pi*n*p*L*(cos(n*Pi*(L+2*q)/L)*exp(-I*p*(L+2*q))-exp(I*p*(L+2*q))*cos(m*Pi*(L+2*q)/L))))/((m-n)^2*(m+n)^2*Pi^4-8*L^2*p^2*(m^2+n^2)*Pi^2+16*L^4*p^4)

(4)
 

 

Download test5.mw

How to get the animation graphs for eta =0..10

NULL

restart; with(plots)

``

ga := .2; Gc := .2; n := 2; Sc := .5; Kp := .2; Q := 0.5e-1; Gr := .2

A := .1Pr := 6.2; Nt := .2; alpha := .1; Rd := 1.5; M := .5; E1 := .3; Ec := .3; Thetap := .2; Nb := .2

NULL

a1 := 1.301348831
NULL

a2 := 1.298194584
a3 := .9728927630; a4 := .9161173998

a5 := 1.316893419

a6 := 1.333333333

 

 

OdeSys := a1*((diff(f(eta), eta, eta, eta))*(2*eta*ga+1)+2*(diff(f(eta), eta, eta))*ga)/a2+A^2-(diff(f(eta), eta))^2+f(eta)*(diff(f(eta), eta, eta))-a1*Kp*(diff(f(eta), eta))/a2-a6*M*(diff(f(eta), eta))/a2+a4*(Theta(eta)*Gr+Phi(eta)*Gc)/a2, f(eta)*(diff(Theta(eta), eta))+a5*(1+4*Rd*(1/3))*((diff(Theta(eta), eta, eta))*(2*eta*ga+1)+2*(diff(Theta(eta), eta))*ga)/(a3*Pr)+(diff(f(eta), eta, eta))^2*(2*eta*ga+1)*Ec*a1/a3+Theta(eta)*Q/a3, f(eta)*(diff(Phi(eta), eta))+((diff(Phi(eta), eta, eta))*(2*eta*ga+1)+2*(diff(Phi(eta), eta))*ga)/Sc+Nt*((diff(Theta(eta), eta, eta))*(2*eta*ga+1)+2*(diff(Theta(eta), eta))*ga)/(Nb*Sc)-Kr*(1+Theta(eta)*(Thetap-1))^n*exp(-E1/(1+Theta(eta)*(Thetap-1))); Cond := f(0) = 0, (D(f))(0) = 1, a5*(D(Theta))(0) = -alpha*(Theta(0)-1), Phi(0) = 1, (D(f))(10) = A, Theta(10) = 0, Phi(10) = 0

KrVals := [0.1e-1, .1, .2, .3]

for j to numelems(KrVals) do Ans[j] := dsolve(eval([OdeSys, Cond], Kr = KrVals[j]), numeric, output = listprocedure) end do

``

``

with(plots):
  cols := [red, blue,green, black]:

 plotA:= display
  ( [ seq
      ( odeplot
        ( Ans[k],[eta,D(f)(eta)],
          eta=0..10,
          color=cols[k]
        ),
        k=1..numelems(KrVals)
      )
    ],
    'axes'= 'boxed',labels=[eta,'f(eta)']
  );

 

with(plots):
  cols := [red, blue, green,black]:

plotC:= display( [ seq( odeplot
        ( Ans[k],[eta,Theta(eta)],
          eta=0..10,
          color=cols[k]
        ),
        k=1..numelems(KrVals)
      )
    ],
    'axes'= 'boxed',labels=[eta,'Theta(eta)']
  );

 

 

``

plotA1 := display(seq(plot3d(r*(eval(f(:-eta), Ans[k]))(eta), eta = 0 .. 10, r = -5 .. 5, color = cols[k]), k = 1 .. nops(KrVals)), linestyle = "solid", style = contour, thickness = 1)

 
 

 

Download ode_plots_animation_graphs.mw

i need like this demo plot  

Hello all.

I am using a k-means cluster routine to partition a set of points into a fixed number of clusters.

The solution assigns points belong to clusters, and this is given in matrix-form. The attached file gives an example of a simple problem that is concerns two clusters (matrices). The entries of each cluster / matrix represent the coordinates of the points in the plane.

I am looking to ..

1. Isolate and label each cluster solution (there may be up to 10), and 

2. For each matrix / cluster, arrange the entries into separate ordered pairs. 

For example, in this instance, I wish to obtain the following form ..

A: = [[-6.08, 52.99], [-7.26, 55.29], [-6.24, 53.29]]

B: = [[-9.72, 51.46], ... , [-9.81, 53.76]]

I have made several attempts to solve for this, but I simply cannot get the solution to output this form.

Any advise / help you can give will be gratefully received. 

Thanks for reading!

Download MaplePrimes_May_31.mw

When I try to solve an equation, or enter any equations using log, the answer is always incorrect. for example: log(0.5/1.65)=-1.194, when the correct answer is -0.519? 

I put together the attached worksheet to help me determine the cheapest way to buy "refreshments" for a party by comparing price and volume of different bottle size options.  The spreadsheet works fine as is.  However, when I right click on the output of line (14) and format pct_difference as percent with 2 decimal places and execute the worksheet, Maple hangs on that line and progresses no further.  This doesn't happen in Maple 2018 but the problem does show up in Maple 2024.  Suggestions please?

cost_comparison_-_liquid_(v01MP).mw

how to determine lambda, m0, and n0? a_i, and c_i are constants and c^2 = c[1]^2 + c[2]^2. solA.mw

This question is as much an observation of somthing I accidently stumbled across. I was using eval[recurse] to evaluate expressions reduced with LargeExpressions. I found eval['recurse'](eval['recurse']([Expr1 , Expr2] , [Q=.. Q1=.....])[]) to be better than simplify(eval['recurse']([Expr1 , Expr2] , [Q=.. Q1=.....])[]).

I only realised what was happening  when I put the below together. Then I could see the wood from the trees. 

It would be interesting to know why.

restart

 

Pt:=[[(sqrt(2*sqrt(Q[2]) + 2*Q[10])*sqrt(Q[6])*(t^2 + 1)/(sqrt(sqrt(Q[2])/(4*a*c - b^2)^2)*sqrt((2*sqrt(Q[2])*a*c^2*e^2 + 2*sqrt(Q[2])*b^2*c^2*f - 8*sqrt(Q[2])*a^3*c*f + 2*sqrt(Q[2])*a^2*b^2*f + 16*sqrt(Q[2])*a^2*c^2*f + 2*sqrt(Q[2])*a^2*c*d^2 - 4*sqrt(Q[2])*a^2*c*e^2 - 8*sqrt(Q[2])*a*c^3*f - 4*sqrt(Q[2])*a*c^2*d^2 + 2*sqrt(Q[2])*a^3*e^2 + 2*sqrt(Q[2])*c^3*d^2 - 2*sqrt(Q[2])*b*c^2*d*e + 4*sqrt(Q[2])*a*b*c*d*e - 2*sqrt(Q[2])*a^2*b*d*e - 4*sqrt(Q[2])*a*b^2*c*f + sqrt(Q[2])*sqrt(2*sqrt(Q[2]) + 2*Q[10])*sqrt(2*sqrt(Q[2]) - 2*Q[10])*Q[7] - 2*Q[11])*signum((sqrt(Q[2])*sqrt(2*sqrt(Q[2]) + 2*Q[10])*sqrt(2*sqrt(Q[2]) - 2*Q[10])*Q[7] - 8*((a - c)^2*sqrt(Q[2])/4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Q[4])*(t^2 - 1)) - 2*a*e + b*d)/(4*a*c - b^2)],

[Q[2] = (a^2 - 2*a*c + b^2 + c^2)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)^2, Q[4] = 1/((a^2 - 2*a*c + b^2 + c^2)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)^2), Q[5] = (a^2 - 2*a*c + b^2 + c^2)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)*(a + c), Q[6] = signum((4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)/(4*a*c - b^2))*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)/(4*a*c - b^2), Q[7] = csgn((4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)*(b*I + a - c)*I)*b, Q[8] = 4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2, Q[9] = csgn((4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)*(b*I + a - c)*I), Q[10] = (a - c)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2), Q[11] = (a + c)*(a^2 - 2*a*c + b^2 + c^2)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)^2]]:

length(Pt);  # was >27,000

5002

(1)

valsh:=[a = -9, b = -9, c = 16, d = -10, e = 7, f = -36]

[a = -9, b = -9, c = 16, d = -10, e = 7, f = -36]

(2)

S1:=eval['recurse'](Pt,valsh)[];

length(%)

 

[-(1/657)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*Q[6]^(1/2)*(t^2+1)*431649^(1/2)/(Q[2]^(1/4)*((-28903750*Q[2]^(1/2)+Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]-2*Q[11])*signum((Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]-8*((625/4)*Q[2]^(1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73], [Q[2] = 377479229074, Q[4] = 1/377479229074, Q[5] = 114273866, Q[6] = 23123/657, Q[7] = -9, Q[8] = 23123, Q[9] = 1, Q[10] = -578075, Q[11] = 2642354603518]

 

2074

(3)

simplify(S1);# this is  simplify with side retations
length(%)

[-(257/248003853501618)*377479229074^(3/4)*((377479229074^(1/4)*(t^2-1)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)+(1/168849)*657^(1/2)*23123^(1/2)*431649^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(t^2+1))*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)+(2/168849)*23123^(1/2)*657^(1/2)*431649^(1/2)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)*t)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(t-1)*(t+1)), -(12/13777991861201)*377479229074^(3/4)*((377479229074^(1/4)*(t^2-1)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)-(1/141912)*657^(1/2)*23123^(1/2)*431649^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)*(t^2+1))*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)+(1/70956)*(2*377479229074^(1/2)-1156150)^(1/2)*t*23123^(1/2)*657^(1/2)*431649^(1/2)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2))/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(t-1)*(t+1))]

 

2316

(4)

simplify(%%);
length(%)

[-(1/71716466988)*(-2471*706^(1/2)+249218)^(1/2)*(2471*706^(1/2)+249218)^(1/2)*((73^(1/2)*(t^2+1)*(46246*706^(1/2)-1156150)^(1/2)+(257/3)*706^(1/4)*(14+2*706^(1/2))^(1/2)*t^2)*(-14+2*706^(1/2))^(1/2)+2*73^(1/2)*(t*(46246*706^(1/2)+1156150)^(1/2)*(14+2*706^(1/2))^(1/2)-257*706^(1/4)))*706^(1/4)/(t^2-1), (1/71716466988)*(-2471*706^(1/2)+249218)^(1/2)*((73^(1/2)*(t^2+1)*(46246*706^(1/2)+1156150)^(1/2)-72*706^(1/4)*(14+2*706^(1/2))^(1/2)*t^2)*(-14+2*706^(1/2))^(1/2)-2*73^(1/2)*((14+2*706^(1/2))^(1/2)*(46246*706^(1/2)-1156150)^(1/2)*t-216*706^(1/4)))*(2471*706^(1/2)+249218)^(1/2)*706^(1/4)/(t^2-1)]

 

744

(5)

 

S2:=eval['recurse'](eval['recurse'](Pt,valsh)[]);# I find this interesting
length(%)

[-(1/162938531750563026)*(2*377479229074^(1/2)-1156150)^(1/2)*23123^(1/2)*657^(1/2)*(t^2+1)*431649^(1/2)*377479229074^(3/4)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(t^2-1))-(1/81469265875281513)*(2*377479229074^(1/2)+1156150)^(1/2)*t*23123^(1/2)*657^(1/2)*431649^(1/2)*377479229074^(3/4)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)*(t^2-1))-257/657, (1/162938531750563026)*(2*377479229074^(1/2)+1156150)^(1/2)*23123^(1/2)*657^(1/2)*(t^2+1)*431649^(1/2)*377479229074^(3/4)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(t^2-1))-(1/81469265875281513)*(2*377479229074^(1/2)-1156150)^(1/2)*t*23123^(1/2)*657^(1/2)*431649^(1/2)*377479229074^(3/4)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)*(t^2-1))-24/73]

 

1283

(6)

simplify(S2); #
length(%)

 

[-(1/406325592)*(14+2*706^(1/2))^(1/2)*(((181442/3)*(14+2*706^(1/2))^(1/2)*t^2+706^(3/4)*73^(1/2)*(46246*706^(1/2)-1156150)^(1/2)*(t^2+1))*(-14+2*706^(1/2))^(1/2)+2*(46246*706^(1/2)+1156150)^(1/2)*73^(1/2)*706^(3/4)*(14+2*706^(1/2))^(1/2)*t-362884*73^(1/2))*(-14+2*706^(1/2))^(1/2)/(t^2-1), (14+2*706^(1/2))^(1/2)*((-2*706^(3/4)*73^(1/2)*(46246*706^(1/2)-1156150)^(1/2)*t-50832*(-14+2*706^(1/2))^(1/2)*t^2)*(14+2*706^(1/2))^(1/2)+(304992+(t^2+1)*(46246*706^(1/2)+1156150)^(1/2)*706^(3/4)*(-14+2*706^(1/2))^(1/2))*73^(1/2))*(-14+2*706^(1/2))^(1/2)/(406325592*t^2-406325592)]

 

705

(7)
 

 

Download 2024-05-31_Eval_Recurse_vs_Simplify_Side_Rels.mw

counts_and_bins_data_output_from_histogram().mw

The Historgram( ) function is the combination of a binning computation and a visualization of the result of the binning computation. In order to generate any histogram you need to know the set of bin boundaries and the number of counts in each bin.

 

These bin boundaries look like: bin_bounds := [[`x__1,min`, `x__1,max`], [`x__2,min`, `x__2,max`], () .. (), [`x__N,min`, `x__N,max`]]where there are N bins in total.

The counts data looks like: counts := [H__1, H__2, () .. (), H__N]where there are N bins in total.

 

The Histogram( ) command passed this data around internally. Can I have Histogram( ) output this data? In other words, can I get the x-y data from the histogram, the bins-counts data?


Download counts_and_bins_data_output_from_histogram().mw

Can anyone helps me with my optimization Problem.  Following are the issues :-

  • I have to minimize the function TRC, i am unable to do. 
  • I am unable to add a constraint with if statement. 
  • Check whether i have represented I1 and I2 with respect to alpha and beta right or wrong

Attaching the sheet below, the background marked in yellow is the problem area. Thankyou

Basic_model.mw

How do I solve equation (1) for omega, rho, lambda1, and lambda2? verif.mw

Why this code does not work. Thank you.
restart;
with(plots);
with(geometry);
_EnvHorizontalName := 'x';
_EnvVerticalName := 'y';
x0 := 10;
y0 := 9;
a := 7;
b := 5;
c := sqrt(a^2 - b^2);
ellipse(el, x^2/a^2 + y^2/b^2 - 1);
point(F1, -c, 0);
point(F2, c, 0);
point(P, x0, y0);
eq := simplify((a^2 - x0^2)*(y - y0)^2 + (b^2 - y0^2)*(x - x0)^2 + 2*x0*y0*(x - x0)*(y - y0)) = 0;
eq := (a^2 - x0^2)*m^2 + 2*x0*y0*m + b^2 - y0^2 = 0;
sol := solve(%, m);
m1 := sol[1];
m2 := sol[2];
(y - y0 - m1) + (-x + x0);
(y - y0 - m2) + (-x + x0);
line(tang1, (y - y0 - m1) + (-x + x0));
line(tang2, (y - y0 - m2) + (-x + x0));
display*[textplot*([[-c, 0, "F1"], [c, 0, "F2"], [coordinates(P)[], "P"]], align = {"above", 'right'}), draw*([el(color = red), P(color = black, symbol = solidcircle, symbolsize = 16), tang1(color = green), tang2(color = green), F1(color = blue, symbol = solidcircle, symbolsize = 16), F2(color = red, symbol = solidcircle, symbolsize = 16)], axes = none)];
 

First 95 96 97 98 99 100 101 Last Page 97 of 2421