nm

10436 Reputation

19 Badges

12 years, 194 days

MaplePrimes Activity


These are questions asked by nm

I have expression which can have many different functions  in it. Assume the expression is `+` type.

I do not know before what these function names are. 

Is there a way to make Maple collect on these functions automatically? Simplify does not do it. So if there is something like b*g(x)+g(x) in the expression, to simplify this to (1+b)*g(x) automatically?

I noticed if expression is   just b*g(x)+g(x) then simplify does give (1+b)*g(x) but once I add a new term, like 3+b*g(x)+g(x) then it no longer does it! which for me is very strange. I was expecting to get 3+(1+b)*g(x) 

Here is an example

restart;

T:=g(x)+b*g(x);
simplify(T);

g(x)+b*g(x)

g(x)*(b+1)

T:=3+g(x)+b*g(x);
simplify(T);

3+g(x)+b*g(x)

3+g(x)+b*g(x)

T:=3+g(x)+b*g(x)+f(x);
simplify(T);

3+g(x)+b*g(x)+f(x)

3+g(x)+b*g(x)+f(x)

 

 

Download simplification_oct_9_2024.mw

What do I need to do to get this output using another software

Ofcourse, I could go and add code to find the names of each function and then use collect. But it seems to me simplify should have done this automatically as the above shows. So I am wondering if there is an option I've overlooked which will do this more easily.

Maple 2024.1

This is probably asked before but can't find it. 

After making a plot, then RIGHT-CLICKing on it, option menu comes up that allows one to modify the plot (like adding gridlines, or change the line style).

How does one find the Maple command after doing such changes, so one can use the command in the code?

Here is an example. I modified a little acers plot in this answer and added the points to the plot

eq:=-0.0004*x^2 - 2.7680*10^(-28)*x^12 - 2.1685*10^(-43)*x^18 - 1.3245*10^(-37)*x^16 - 1.6917*10^(-32)*x^14 + 0.7650 + 6.6773*10^(-18)*x^8 - 2.5543*10^(-23)*x^10 - 8.0002*10^(-13)*x^6 + 3.6079*10^(-8)*x^4 = 0:
the_roots:=fsolve(eq):	
the_roots:=map(X->[X,0],[the_roots]):
p1:=plot(lhs(eq),x=-210..210,size=[500,200]):
p2:=plot(the_roots,style=point, color=red, symbol=solidcircle, symbolsize=20):
plots:-display(p1,p2)

 

I was lazy to look up the grid option syntax. So right clicked on the plot and found option to add gridline. So said, great. And the above is the result.

But now I'd like to see the command used so I know where the grid option goes and how its syntax is. There does not seem to be option in the interface to display the Maple command used.

How would one find it?

Maple 2024.1 on windows 10

 

What is the correct idiom in Maple to check that one number is greater than another or not?

For example if n=sqrt(3) and m=3 ?

Maple does not like to compare sqrt(3) with other number. It says 

   Error, cannot determine if this expression is true or false: 3 <= 3^(1/2)

I am doing this in code, so solution has to be such that it works for all cases of n and m, without the ability to look at screen and decide.

I found that using is works without the need to convert to float.  Should one then use is(n>=m) instead of evalb(n>=m) always?  

I can also always apply evalf() on each side before. But this seems like an overkill to me.

restart;

n:=sqrt(3);
m:=3;

3^(1/2)

3

if evalb(n>=m) then
   "yes";
else
   "no";
fi;

Error, cannot determine if this expression is true or false: 3 <= 3^(1/2)

if n>=m then
   "yes";
else
   "no";
fi;

Error, cannot determine if this expression is true or false: 3 <= 3^(1/2)

if evalb(evalf(n)>=m) then
   "yes";
else
   "no";
fi;

"no"

if is(n>=m) then
   "yes";
else
   "no";
fi;

"no"

 

 

Download checking_one_number_larger_than_another.mw

For reference, another software does compare these two numbers as is without the need to convert them to floating point;

But it looks the design of Maple in this aspect is different. Since the principal root of sqrt(3) is always the positive one, I did not think it will cause a problem.

Why Maple gives

           improper op or subscript selector

On this ode? I was not expecting to see steps for this, but was just trying to see what it will show.

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1810 and is the same as the version installed in this computer, created 2024, September 18, 18:16 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

ode:=sin(x)*diff(y(x),x$2)+cos(x)*diff(y(x),x)+(sin(x)-cos(x))*y(x)=0;

sin(x)*(diff(diff(y(x), x), x))+cos(x)*(diff(y(x), x))+(sin(x)-cos(x))*y(x) = 0

dsolve(ode);

y(x) = c__1*(tan((1/2)*x)+I)^(1/2+(1/2)*(5-4*I)^(1/2))*(tan((1/2)*x)-I)^((1/2)*(5+4*I+(5+4*I)^(1/2))/(5+4*I)^(1/2))*HeunG(2, 2*(((3/4)*(5-4*I)^(1/2)+7/4-I)*(5+4*I)^(1/2)+5/4+I+(5/4+I)*(5-4*I)^(1/2))/(5+4*I)^(1/2), 1+(1/2)*(10+2*41^(1/2))^(1/2), (1/2)*((5+4*I)^(1/2)*(5-4*I)^(1/2)+5+4*I+2*(5+4*I)^(1/2))/(5+4*I)^(1/2), 1+(5-4*I)^(1/2), 1, 1-I*tan((1/2)*x))+c__2*(tan((1/2)*x)+I)^(1/2-(1/2)*(5-4*I)^(1/2))*(tan((1/2)*x)-I)^((1/2)*(5+4*I+(5+4*I)^(1/2))/(5+4*I)^(1/2))*HeunG(2, -2*(((3/4)*(5-4*I)^(1/2)+(-7/4+I))*(5+4*I)^(1/2)+(-5/4-I)+(5/4+I)*(5-4*I)^(1/2))/(5+4*I)^(1/2), -(1/2)*(5-4*I)^(1/2)+1+(1/2)*(5+4*I)^(1/2), (1/2)*(-(5+4*I)^(1/2)*(5-4*I)^(1/2)+5+4*I+2*(5+4*I)^(1/2))/(5+4*I)^(1/2), 1-(5-4*I)^(1/2), 1, 1-I*tan((1/2)*x))

Student:-ODEs:-ODESteps(ode)

Error, (in Student:-ODEs:-OdeSolveOrder2) improper op or subscript selector

 


 

Download internal_error_ODEsteps_sept_26_2024.mw

I thought I had post with collection showing timelimit still hangs in Maple. But can't find it searching. I wanted to add this to it.

If someone finds such post, please let me know and I will append this to that post and delete this.

I just found another example where int() hangs all of Maple, using timelimit. I put timelimit of 30 seconds. After 2 hrs it is still running.

Maple 2024.1 on windows 10. This shows clearly that timelimit in Maple still does not work when It was supposed to have been fixed in Maple 2021?

For me, if there is anything that will make me stop using Maple for good, it is this timelimit issue.

Because with timelimit not working all the time, my program keeps hanging. It is not possible to do antything then. Having to keep checking if the program is still running or have hanged and restarting it is not a way to develop software.

Software that have been in development for almost 45 years now like Maple, should have figured by now how to implement timelimit that works. 

Note that, with smaller timelimit it is possible it will  not hang, because longer time limit makes it end in the code path which causes the hang. When I tried 5 seconds for example instead of 30 second, it did not hang With 30 it does. so if you try it and it does not hang, please increase the timelimit a little and it will surely hang. Just make sure to do restart each time, since Maple remembers last result.

maple's server.exe was running at full cpu also.

 

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1810 and is the same as the version installed in this computer, created 2024, September 18, 18:16 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

M:=-6*(3^(1/2)*(27*R^2-4)^(1/2)-9*R)^(1/3)/(-6*(3^(1/2)*(27*R^2-4)^(1/2)-9*R)^(1/3)*R+(-6*I*3^(1/6)-2*3^(2/3))*2^(1/3)+2^(2/3)*(I*3^(5/6)-3^(1/3))*(3^(1/2)*(27*R^2-4)^(1/2)-9*R)^(2/3));
try #this hangs
    timelimit(40,int(M,R));
    print("finished with no timeout");
catch:
    print("waiting for timeout");
end try;

-6*(3^(1/2)*(27*R^2-4)^(1/2)-9*R)^(1/3)/(-6*(3^(1/2)*(27*R^2-4)^(1/2)-9*R)^(1/3)*R+(-(6*I)*3^(1/6)-2*3^(2/3))*2^(1/3)+2^(2/3)*(I*3^(5/6)-3^(1/3))*(3^(1/2)*(27*R^2-4)^(1/2)-9*R)^(2/3))

 

 

Download int_hangs_with_timelimit.mw

 

Update OCT 10, 2024

This is another example showing hang in Maple 2024.1 using timelimit. So adding it to this collection. I had large collection of such problems but not able to find it now.

I was trying to verify this solution (which could very well be wrong) on ode with IC. timelimit hangs when I added assumptions as shown. Used 10,20,30 seconds, and so on. all hang. Waited and waited. 

Does it hang on other systems? I am using Windows 10 and Maple 2024.1 with 128 GB RAM on fast CPU.


 

sol:=y(x) = -8/9*x-11/9+1/9*arcsin(1/103*2509^(1/2)*tan(1/5*(x+5/2509*2509^(1/2)*arctan(1/2509*2509^(1/2)*(103*tan(37)+90*sec(37)))-1)*2509^(1/2))*(90*2509^(1/2)*tan(1/5*(x+5/2509*2509^(1/2)*arctan(1/2509*2509^(1/2)*(103*tan(37)+90*sec(37)))-1)*2509^(1/2))-103*(2509*tan(1/5*(x+5/2509*2509^(1/2)*arctan(1/2509*2509^(1/2)*(103*tan(37)+90*sec(37)))-1)*2509^(1/2))^2+2509)^(1/2))/(2509*tan(1/5*(x+5/2509*2509^(1/2)*arctan(1/2509*2509^(1/2)*(103*tan(37)+90*sec(37)))-1)*2509^(1/2))^2+10609)-90/103):
ode:=5*diff(y(x),x) = 7+10*sin(8*x+9*y(x)+11):
IC:=y(1) = 2:
func:=y(x);

y(x)

try
    timelimit(30,`assuming`([odetest(sol,[ode, op(IC)],func)],[positive, func::positive]));
catch:
    print("timed out OK");
end try;
print("After try/catch");

 

Download time_limit_hang_example_oct_10_2024.mw

I would like to officially offer $1,000 prize for any one who can solve the timelimit hanging problem in Maple. Will send you personal check of this amount if you find why it hangs and provide fix to use that I can verify works.

First 6 7 8 9 10 11 12 Last Page 8 of 190