nm

11353 Reputation

20 Badges

13 years, 12 days

MaplePrimes Activity


These are questions asked by nm

In Maple 2022

restart;

res := t^3 - 3*t^2*sqrt(t^2*(12*sqrt(2)*ln(t) + 9*ln(t)^2 + 8)^(1/3))*ln(t)/(12*sqrt(2)*ln(t) + 9*ln(t)^2 + 8)^(2/3) - 2*t^2*sqrt(t^2*(12*sqrt(2)*ln(t) + 9*ln(t)^2 + 8)^(1/3))*sqrt(2)/(12*sqrt(2)*ln(t) + 9*ln(t)^2 + 8)^(2/3);
plot(res,t=-5..1)

gives

The same exact code in Maple 2024 gives

Worksheet is below. 

Both on same PC. Windows 10.

Will report to Maplesoft, but thought to check also here is others have seen such problem before.

Btw, Maple 2022 plot is the correct one.


 

14900

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 1700. The version installed in this computer is 1693 created 2024, March 7, 17:27 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

restart;

14900

res := t^3 - 3*t^2*sqrt(t^2*(12*sqrt(2)*ln(t) + 9*ln(t)^2 + 8)^(1/3))*ln(t)/(12*sqrt(2)*ln(t) + 9*ln(t)^2 + 8)^(2/3) - 2*t^2*sqrt(t^2*(12*sqrt(2)*ln(t) + 9*ln(t)^2 + 8)^(1/3))*sqrt(2)/(12*sqrt(2)*ln(t) + 9*ln(t)^2 + 8)^(2/3);
plot(res,t=-5..1)

t^3-3*t^2*(t^2*(12*2^(1/2)*ln(t)+9*ln(t)^2+8)^(1/3))^(1/2)*ln(t)/(12*2^(1/2)*ln(t)+9*ln(t)^2+8)^(2/3)-2*t^2*(t^2*(12*2^(1/2)*ln(t)+9*ln(t)^2+8)^(1/3))^(1/2)*2^(1/2)/(12*2^(1/2)*ln(t)+9*ln(t)^2+8)^(2/3)

 


 

Download wrong_plot_V_2024_march_15_2024.mw

Maple's coulditbe  is useful. But unfortunately it does not return back to the user the conditions under which the proposition was found true. This could make it much more useful. It seems in way similar to Mathematica' Reduce but Reduce returns the conditions.

Is there a way to find the conditions which makes it true? 

I use coulditbe alot. I use it to verify that the result of odetest (I call it the residue) is zero or not. Maytimes, odetest does not return zero. And using simplify, or evalb or is to check if the residue is zero, all fail. But many times, coulditbe returns true, meaning the residue is zero. But I do not know under what conditions. In Mathematica's Reduce, it tells me the conditions. 

Here is one of hundreds of examples I have

restart;
ode:=(t^3+y(t)^2*sqrt(t^2+y(t)^2))-(t*y(t)*sqrt(t^2+y(t)^2))*diff(y(t),t)=0;
ic:=y(1)=1;
sol:=dsolve([ode,ic]);
the_residue:=odetest(sol,[ode,ic]);

You see, odetest says it could not verify the solution (the first entry above) but it did verify the solution against the initial conditions. 

Using simplify, evalb and is all also could not verify it

simplify(the_residue[1]);
evalb(the_residue[1]=0);
is(the_residue[1]=0);

Now coulditbe does:

_EnvTry:='hard':
coulditbe(the_residue[1]=0);

So the solution is correct, but I do not know under what conditions. Using Mathematica's Reduce I can find this:

So now back in Maple, I can do this

simplify(the_residue[1]) assuming t>exp(-2*sqrt(2)/3);

                      0

Actually in this example, just using assume t>0 also gives zero. But I am using Mathematica's result for illustration.

You might ask, why do I need to know for what values of the independent variable is the residue zero?

Because in some cases, the residue is zero only at single point! So it does not make sense to say the solution is verified to be correct only at one single point of the domain, right?

it needs to be some finite range at least. Here is an example of an ode whose solution is correct only at x=0

ode:=diff(y(x),x)=3*x*(y(x)-1)^(1/3);
ic:=y(3)=-7;
sol:=dsolve([ode,ic]);
the_residue:=odetest(sol,[ode,ic]);

And simplify, evalb, is all fail to verifiy this, but coulditbe says true

simplify(the_residue[1]);
evalb(the_residue[1]=0);
is(the_residue[1]=0);
_EnvTry:='hard':
coulditbe(the_residue[1]=0);

So now, we ask, is this solution then correct or not? It turns out to be zero but only at origin x=0

plot(abs(the_residue[1]),x=-1..1)

If I knew that residue is zero only at single point, then I would say this solution is not correct, right?

And that is why I need to know under what conditions coulditbe retruned true.

I tried infolevel[coulditbe]:=5 but nothing more was displayed on the screen.

Mathematica's Reduce confirms that when x=0 the residue is zero.

So my question is simply this: Can one obtain the conditions used by coulditbe to determine when result is true?

It will be useful if Maple could in future version return the value/range which makes it true.

 

Maple does not have full_simplify() command like with Mathematica.

So I figured why not make one? 

Here is a basic implementation. All what it does is blindly tries different simplifications methods I know about and learned from this forum then at the end sorts the result by leaf count and returns to the user the one with smallest leaf count.

I tried it on few inputs.

Advantage of full_simplify() is that user does not have to keep trying themselves. One disadvantage is that this can take longer time. timelimit can be added to this to make it not hang.

Can you see and make more improvement to this function?

May be we all together can make a better full_simplify() in Maple to use. Feel free to edit and change.

#version 1.0  
#increment version number each time when making changes.

full_simplify:=proc(e::anything)
   local result::list;
   local f:=proc(a,b)
      RETURN(MmaTranslator:-Mma:-LeafCount(a)<MmaTranslator:-Mma:-LeafCount(b))
   end proc;

   #add more methods as needed

   result:=[simplify(e),
            simplify(e,size),
            simplify(combine(e)),
            simplify(combine(e),size),
            radnormal(evala( combine(e) )),
            simplify(evala( combine(e) )),
            evala(radnormal( combine(e) )),
            simplify(radnormal( combine(e) )),
            evala(factor(e)),
            simplify(e,ln),
            simplify(e,power),
            simplify(e,RootOf),
            simplify(e,sqrt),
            simplify(e,trig),
            simplify(convert(e,trig)),
            simplify(convert(e,exp)),
            combine(e)
   ];   
   RETURN( sort(result,f)[1]);   

end proc:

worksheet below

 


 

204648

#version 1.0  
#increment version number each time when making changes.

full_simplify:=proc(e::anything)
   local result::list;
   local f:=proc(a,b)
      RETURN(MmaTranslator:-Mma:-LeafCount(a)<MmaTranslator:-Mma:-LeafCount(b))
   end proc;

   #add more methods as needed

   result:=[simplify(e),
            simplify(e,size),
            simplify(combine(e)),
            simplify(combine(e),size),
            radnormal(evala( combine(e) )),
            simplify(evala( combine(e) )),
            evala(radnormal( combine(e) )),
            simplify(radnormal( combine(e) )),
            evala(factor(e)),
            simplify(e,ln),
            simplify(e,power),
            simplify(e,RootOf),
            simplify(e,sqrt),
            simplify(e,trig),
            simplify(convert(e,trig)),
            simplify(convert(e,exp)),
            combine(e)
   ];   
   RETURN( sort(result,f)[1]);   

end proc:

#test cases
T:=[(-192*cos(t)^6 + 288*cos(t)^4 - 912*cos(t)^3 - 108*cos(t)^2 + 684*cos(t) - 54)/(4608*cos(t)^9 - 10368*cos(t)^7 + 6208*cos(t)^6 + 7776*cos(t)^5 - 9312*cos(t)^4 - 2440*cos(t)^3 + 3492*cos(t)^2 + 372*cos(t) - 1169),
(10*(5+sqrt(41)))/(sqrt(70+10*sqrt(41))*sqrt(130+10*sqrt(41))),
((6-4*sqrt(2))*ln(3-2*sqrt(2))+(3-2*sqrt(2))*ln(17-12*sqrt(2))+32-24*sqrt(2))/(48*sqrt(2)-72)*(ln(sqrt(2)+1)+sqrt(2))/3,
(1/2)*exp((1/2)*x)*(cosh((1/2)*x)-cosh((3/2)*x)+sinh((1/2)*x)+sinh((3/2)*x))
];

[(-192*cos(t)^6+288*cos(t)^4-912*cos(t)^3-108*cos(t)^2+684*cos(t)-54)/(4608*cos(t)^9-10368*cos(t)^7+6208*cos(t)^6+7776*cos(t)^5-9312*cos(t)^4-2440*cos(t)^3+3492*cos(t)^2+372*cos(t)-1169), 10*(5+41^(1/2))/((70+10*41^(1/2))^(1/2)*(130+10*41^(1/2))^(1/2)), (1/3)*((6-4*2^(1/2))*ln(3-2*2^(1/2))+(3-2*2^(1/2))*ln(17-12*2^(1/2))+32-24*2^(1/2))*(ln(1+2^(1/2))+2^(1/2))/(48*2^(1/2)-72), (1/2)*exp((1/2)*x)*(cosh((1/2)*x)-cosh((3/2)*x)+sinh((1/2)*x)+sinh((3/2)*x))]

full_simplify~(T)

[-6*(10+cos(6*t)+38*cos(3*t))/(-975+18*cos(9*t)-70*cos(3*t)+194*cos(6*t)), (1/2)*2^(1/2), (1/9)*(ln(1+2^(1/2))+2^(1/2))^2, (1/2)*exp(x)-(1/2)*exp(-x)]

 


 

Download full_simplify.mw

I have been trying Maple 2024 and found this strange result. 

Calling solve(identity...  on same input in Maple 2024 gives very large and complex output compare with Maple 2023.2.1.

This was causing problem, until I found that simplifying the solution now gives same output as Maple 2023.2.1

But why is this now needed in Maple 2024? i.e. why is calling simplify needed when in Maple 2023 the simpler solution was returned automatically?

I changed my code to call simplify now on result of solve(identity...  but I am just curious what happened to cause this?

Below are two worksheets, one from Maple 2024 and one from Maple 2023.2 and you see the huge difference in result.


 

56056

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Windows 10, November 24 2023 Build ID 1762575`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1693. The version installed in this computer is 1672 created 2024, February 7, 18:34 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2023\Physics Updates\lib\`

restart;

238012

trial_solution_constants:=[A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[8]];
eq:=-2*A[1]*sin(x)+2*A[2]*cos(x)-4*A[2]*x*sin(x)+2*A[3]*sin(x)+4*A[3]*x*cos(x)+2*A[4]*cos(x)-6*A[5]*sin(3*x)-8*A[5]*x*cos(3*x)+6*A[6]*cos(3*x)-8*A[6]*x*sin(3*x)-8*A[7]*cos(3*x)-8*A[8]*sin(3*x) = x*cos(x)^3;
solve(identity(eq,x),trial_solution_constants)

[A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[8]]

-2*A[1]*sin(x)+2*A[2]*cos(x)-4*A[2]*x*sin(x)+2*A[3]*sin(x)+4*A[3]*x*cos(x)+2*A[4]*cos(x)-6*A[5]*sin(3*x)-8*A[5]*x*cos(3*x)+6*A[6]*cos(3*x)-8*A[6]*x*sin(3*x)-8*A[7]*cos(3*x)-8*A[8]*sin(3*x) = x*cos(x)^3

[[A[1] = 3/16, A[2] = 0, A[3] = 3/16, A[4] = 0, A[5] = -1/32, A[6] = 0, A[7] = 0, A[8] = 3/128]]

 


 

Download solve_identity_march_11_2024_maple_2023.mw

 


 

56056

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 1693 and is the same as the version installed in this computer, created 2024, March 7, 17:27 hours Pacific Time.`

restart;

56944

trial_solution_constants:=[A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[8]];
eq:=-2*A[1]*sin(x)+2*A[2]*cos(x)-4*A[2]*x*sin(x)+2*A[3]*sin(x)+4*A[3]*x*cos(x)+2*A[4]*cos(x)-6*A[5]*sin(3*x)-8*A[5]*x*cos(3*x)+6*A[6]*cos(3*x)-8*A[6]*x*sin(3*x)-8*A[7]*cos(3*x)-8*A[8]*sin(3*x) = x*cos(x)^3;
solve(identity(eq,x),trial_solution_constants)

[A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[8]]

-2*A[1]*sin(x)+2*A[2]*cos(x)-4*A[2]*x*sin(x)+2*A[3]*sin(x)+4*A[3]*x*cos(x)+2*A[4]*cos(x)-6*A[5]*sin(3*x)-8*A[5]*x*cos(3*x)+6*A[6]*cos(3*x)-8*A[6]*x*sin(3*x)-8*A[7]*cos(3*x)-8*A[8]*sin(3*x) = x*cos(x)^3

[[A[1] = -(3/16)*(648*cos(3)*sin(1)^3+972*cos(3)*sin(1)^2*cos(1)+432*sin(3)*sin(1)^3+648*sin(3)*sin(1)^2*cos(1)+2268*sin(1)^4+1296*sin(1)^3*cos(1)+324*sin(3)*cos(3)-108*sin(1)*cos(3)-585*cos(3)*cos(1)-133*sin(3)^2-153*sin(3)*sin(1)-48*sin(3)*cos(1)-2025*sin(1)^2+225)/(108*sin(1)*cos(3)+99*cos(3)*cos(1)-2*sin(3)^2+153*sin(3)*sin(1)-276*sin(3)*cos(1)-162*sin(1)^2+261), A[2] = (9/32)*(-48*cos(3)*sin(1)^3-72*cos(3)*sin(1)^2*cos(1)+88*sin(3)*sin(1)^3+132*sin(3)*sin(1)^2*cos(1)+864*sin(1)^4-108*sin(1)^3*cos(1)+21*sin(3)*cos(3)+117*sin(1)*cos(3)-144*cos(3)*cos(1)+40*sin(3)^2-12*sin(3)*sin(1)-141*sin(3)*cos(1)-972*sin(1)^2+243*cos(1)*sin(1)+144)/(108*sin(1)*cos(3)+99*cos(3)*cos(1)-2*sin(3)^2+153*sin(3)*sin(1)-276*sin(3)*cos(1)-162*sin(1)^2+261), A[3] = -(3/32)*(648*cos(3)*sin(1)^3+972*cos(3)*sin(1)^2*cos(1)+432*sin(3)*sin(1)^3+648*sin(3)*sin(1)^2*cos(1)+2268*sin(1)^4+1296*sin(1)^3*cos(1)+324*sin(3)*cos(3)-216*sin(1)*cos(3)-684*cos(3)*cos(1)-131*sin(3)^2-306*sin(3)*sin(1)+228*sin(3)*cos(1)-1863*sin(1)^2-36)/(108*sin(1)*cos(3)+99*cos(3)*cos(1)-2*sin(3)^2+153*sin(3)*sin(1)-276*sin(3)*cos(1)-162*sin(1)^2+261), A[4] = 0, A[5] = (1/64)*(216*cos(3)*sin(1)^3+324*cos(3)*sin(1)^2*cos(1)+144*sin(3)*sin(1)^3+216*sin(3)*sin(1)^2*cos(1)+756*sin(1)^4+432*sin(1)^3*cos(1)+41*cos(3)^2+108*sin(3)*cos(3)-216*sin(1)*cos(3)-360*cos(3)*cos(1)-306*sin(3)*sin(1)+444*sin(3)*cos(1)-405*sin(1)^2-401)/(2*cos(3)^2+108*sin(1)*cos(3)+99*cos(3)*cos(1)+153*sin(3)*sin(1)-276*sin(3)*cos(1)-162*sin(1)^2+259), A[6] = -(3/64)*(48*cos(3)*sin(1)^3+72*cos(3)*sin(1)^2*cos(1)-88*sin(3)*sin(1)^3-132*sin(3)*sin(1)^2*cos(1)-864*sin(1)^4+108*sin(1)^3*cos(1)+40*cos(3)^2-21*sin(3)*cos(3)-117*sin(1)*cos(3)+144*cos(3)*cos(1)+12*sin(3)*sin(1)+141*sin(3)*cos(1)+972*sin(1)^2-243*cos(1)*sin(1)-184)/(2*cos(3)^2+108*sin(1)*cos(3)+99*cos(3)*cos(1)+153*sin(3)*sin(1)-276*sin(3)*cos(1)-162*sin(1)^2+259), A[7] = (27/256)*(-48*cos(3)*sin(1)^3-72*cos(3)*sin(1)^2*cos(1)+88*sin(3)*sin(1)^3+132*sin(3)*sin(1)^2*cos(1)+864*sin(1)^4-108*sin(1)^3*cos(1)+21*sin(3)*cos(3)+117*sin(1)*cos(3)-144*cos(3)*cos(1)+40*sin(3)^2-12*sin(3)*sin(1)-141*sin(3)*cos(1)-972*sin(1)^2+243*cos(1)*sin(1)+144)/(108*sin(1)*cos(3)+99*cos(3)*cos(1)-2*sin(3)^2+153*sin(3)*sin(1)-276*sin(3)*cos(1)-162*sin(1)^2+261), A[8] = -(3/256)*(744*cos(3)*sin(1)^3+1116*cos(3)*sin(1)^2*cos(1)+496*sin(3)*sin(1)^3+744*sin(3)*sin(1)^2*cos(1)+2604*sin(1)^4+1488*sin(1)^3*cos(1)+372*sin(3)*cos(3)-216*sin(1)*cos(3)-756*cos(3)*cos(1)-151*sin(3)^2-306*sin(3)*sin(1)+180*sin(3)*cos(1)-2187*sin(1)^2+36)/(108*sin(1)*cos(3)+99*cos(3)*cos(1)-2*sin(3)^2+153*sin(3)*sin(1)-276*sin(3)*cos(1)-162*sin(1)^2+261)]]

simplify(%);

[[A[1] = 3/16, A[2] = 0, A[3] = 3/16, A[4] = 0, A[5] = -1/32, A[6] = 0, A[7] = 0, A[8] = 3/128]]

 


 

Download solve_identity_march_11_2024.mw

 

This code used to work OK in Maple 2023.2.1 on windows 10. Now it gives this new internal Maple error 

Error, (in property/ConvertRelation) numeric exception: division by zero

I think this is new problem in Maple 2024 as I have not seen it before. Will report it to Maplesoft. Mean while if someone has any workaround other than not using the `is` command will try it.

The following are two worksheets. One using 2023 shows it works OK (no error) and one in Maple 2024 with the new error

203072

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Windows 10, November 24 2023 Build ID 1762575`

restart;

203072

r:=1/4*a*(a*x^2+6);
tmp:=-1/x^2+1/2*a+(1/x+1/2*a*x)^2;
is(tmp = r)

(1/4)*a*(a*x^2+6)

-1/x^2+(1/2)*a+(1/x+(1/2)*a*x)^2

true

 

 

Download no_numeric_exception_march_7_2024_version_2023.mw
 

interface(version);

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

restart;

r:=1/4*a*(a*x^2+6);
tmp:=-1/x^2+1/2*a+(1/x+1/2*a*x)^2;
is(tmp = r)
 

(1/4)*a*(a*x^2+6)

-1/x^2+(1/2)*a+(1/x+(1/2)*a*x)^2

Error, (in property/ConvertRelation) numeric exception: division by zero

 

 

Download numeric_exception_march_7_2024_version_2024.mw

First 36 37 38 39 40 41 42 Last Page 38 of 199