Maple 2021 Questions and Posts

These are Posts and Questions associated with the product, Maple 2021

Should Maple hangs when one quits a debugger in the middle of debugging session, and there is a call to the same function with a DEBUG break point in it next?

For example

restart;
foo:=proc()
  local x;
  DEBUG();
  x:=x+1
end proc;

And now in the next same execution group, I had

> foo(); #quitting debugger here makes Maple hangs/freeze

  foo();

 

When evaluating the above, the debugger comes up as expected when first call to foo() is made.

When quitting the debugger either by hitting Quit or by hitting the close red X at top right corner, Maple now hangs. I was expecting the debugger to come up again for the second call to foo().  

It seems closing the debugger window like this for some reason is not handled correctly. Even if the user is not supposed to do this, Maple should not just freeze like this.

Nothing I do causes it to unfreeze. Clicking on the ! button does nothing. Only way is to either kill Maple from task manager or close all of Maple if possible and sometimes this does not even work, ending possibly losing work done on other open worksheets.

Maple should be more robust that this. Does this happen on other platforms?

This problem does not happen if the calls were each in a separate execution group in the worksheet. Like this

> foo();

> foo();

Using Maple 2021.2 on windows 10.

 

VertexConnectivity returns the vertex connectivity of a graph, that is the minimum number of vertices whose removal disconnects the graph.  When I was filtering some graphs with a certain  vertex connectivity, maple was much slower than mathematica. I'm going to store all graphs in file  named op21new.g6.  When mathematica selects all graphs with a connectivity of 6, it only takes 15 seconds to complete.

mma codes are the following 

L = Import[
  "C:/Users/asus/Desktop/op21new.g6"]; # Change this line
t = AbsoluteTiming[L1 = Select[L, VertexConnectivity[#] == 6 &];]

{15.6484, Null}

But my maple has been running for half an hour and it is not over yet.

with(GraphTheory):
L:=ImportGraph("C:/Users/asus/Desktop/op21new.g6", graph6, output=list): # Change this line
L2:=CodeTools:-Usage(select(g->VertexConnectivity(g)=6,L)):

Because Mapleprimes does not support graph6 format file uploading, I changed it to TXT format. If you want to use it, you only need to change the suffix name.

op21new.txt

I am trying to anime a pump but itn't working. I need help. Thank you. restart; with(plots); with(plottools); unprotect(D); alpha := arctan(-58/62.5); solve({k*Pi/100 = alpha}, {k}); beta := arctan(19/84); solve({k*Pi/100 = beta}, {k}); ang1 := arctan(-68/84); evalf(solve({k = ang1}, {k})); ang2 := arctan(55/84); evalf(solve({k = ang2}, {k})); #angular head travel Head := proc(k) local r, poly, k1, tC, tD, tE, DikC, DikD, DikE; global C, D, E; r := 84; C := [-55, 17]; D := [0, 0]; E := [84, 0]; poly := [[-60, 24], [63, -17], [60, -55.5], seq([r*cos(1/100*k*Pi), r*sin(1/100*k*Pi)], k1 = -24 .. 7), [82, 18], [78, 20], [64, -3], [-46.5, 35]]; tC := textplot([C[], "C"], align = {above, right}, font = [Times, bold, 18]); tD := textplot([D[], "D"], align = {above, left}, font = [Times, bold, 18]); tE := textplot([E[], "E"], align = {above, left}, font = [Times, bold, 18]); DikC := disk(C, 1, color = black); DikD := disk(D, 1, color = black); DikE := disk(E, 1, color = black); if 0

I am looking for a robust way to factor an expression (if applicable) to become    x^n*(rest)  as we do it by hand.

edit The input will only be of type `+` and I am looking for a way extract a common factor to convert the input to term^n*(rest) where term is the common factor to pull out.

For example, given  x^2*Y+x and the symbol is given as x  the result will be x*(x*Y+1) and if the input is Y^2*x^3-x^3 then the output is x^3*(Y^2-1) and if there is no common factor x to pull out from all the terms, the output will be the same as the input.

I tried many commands and options, but can't find one method that works all the time for all cases.

For example for   x^2*Y+x  the command factor(x^2*Y+x) gives (Y - 1)*(Y + 1)*x^3 which is not what I want. There is no option to factor to give the name to factor on. And I did not know how to use the last argument of function to do that.

But here simplify(x^2*Y+x) happened to work on this and gives (Y^2 - 1)*x^3 but simplify does not work on first example. simplify(x^2*Y+x) returns the same expression back. So simplify is not reliable to use.

I tried collect, with options factor and simplify. Again, they work on one examples but not others. 

collect(x^2*Y+x,x); does not do it. But collect(Y^2*x^3-x^3,x); works and returns (Y^2 - 1)*x^3 which is what I want.

The problem is that I do not know what the expression looks like. I just know the name and want to find if there is a common to any power that can be pulled out to rewite the expression as x^n*(rest) where is an integer or rational number depending.

This seems like a simple problem. But can't find a Maple command for.   I could ofcourse program it by brute force. Go over each term in the expression, check if each term has a free to any power in it multiplied by something else, then collect all these x^n term in a list. At end find the which is raised to lowest power, and then divide the whole expression by it. 

Here is another way I can also try:  Use factor and also collect and also simplify. One at a time. Each time I check if the result is of type `*` but not a division! (check that denom is 1). If so, Then check if result has two operands only. If so, check if op(1,result) is for form x^anything. If so, then one of these cases worked.  Need to try this now to see if it will work on all cases I have. 

Is there a better way to do this in Maple? It has to work on all expresions f(x) without knowing what the expression looks like.

update

I've updated the test cases and included all algorithms given to compare. It is hard in Maple to make a nice table to present results and keep math formatting below.

restart;
makegrid := proc(M::Matrix)#https://www.mapleprimes.com/questions/202902-How-To-Create-Table-Like-Output-For
  uses DocumentTools:-Layout;
  local i,j,m,n,wks;
  m,n := op(1,M);
  wks := Worksheet(Table(alignment=center,width=20,
                         seq(Column(),j=1..n),
                         seq(Row(seq(Cell(Textfield(sprintf("%a",M[i,j]))),
                                     j=1..n)),i=1..m)));
  DocumentTools:-InsertContent(wks);
end proc:

acer_V1_common_factor := proc(x::algebraic, ee::algebraic)
  local p, d := gcd(ee, x^frontend(degree,[ee,x]),'p');
  d * p;
end proc:

acer_V2_common_factor := proc(x, ee) local d, t;
  if ee::`+` then
    t := max(map(proc(u) local r:=frontend(degree,[u,x]);
                         `if`(r::numeric,r,0); end proc,[op(ee)]));
    d := gcd(numer(ee),x^t);
    d*map(u->u/d,ee);
  else ee; end if;
end proc:

dharr_common_factor:=proc(x,z)
  local xn:=x^ldegree(collect(z,x),x);
  if rem(z,xn,x)=0 then xn*quo(z,xn,x) else z end if;
end proc:

me_common_factor:=proc(term,expr)
local tmp;
local T1;

local update_T1:=proc()
T1:= hastype(op(1,tmp),identical(term)^anything) or hastype(op(1,tmp),identical(term));
if not T1 then
   T1:= hastype(op(2,tmp),identical(term)^anything) or hastype(op(2,tmp),identical(term));
fi;
end proc;

if type(expr,`*`) or not has(expr,term) then 
   return expr;
fi;

tmp := collect(expr,term);       
if type(tmp,`*`) and evalb(denom(tmp)=1) and evalb(nops(tmp)=2) then
   update_T1();
   if T1 then
       return tmp;
   fi;
fi;

tmp :=factor(expr);
if type(tmp,`*`) and evalb(denom(tmp)=1) and evalb(nops(tmp)=2) then
    update_T1();
    if T1 then
      return tmp;
    fi;
fi;

tmp := simplify(expr);
if type(tmp,`*`) and evalb(denom(tmp)=1) and evalb(nops(tmp)=2) then
    update_T1();
    if T1 then              
      return tmp;
    fi;
fi;

return expr;
end proc:
############################

test_data:=[[x,x^2*Y+x],
[x,Y^2*x^3-x^3],
[x,x],
[x,x+2*x^2],
[x,x^4*diff(y(x),x)+x^7],
[x,x^4*diff(y(x),x)+x^7-sin(x)],
[y(x),y(x)^4*diff(y(x),x$2)^2*diff(y(x),x)+y(x)^2*diff(y(x),x)+y(x)],
[y(x),y(x)^4*diff(y(x),x$2)^2+y(x)^2*diff(y(x),x)+y(x)^9],
[x,x^4*y^2+x^2*y^2],
[y(x),y(x)^4*diff(y(x),x)^2+y(x)^2*diff(y(x),x)^2],
[diff(y(x),x),y(x)^4*diff(y(x),x)^2+y(x)^2*diff(y(x),x)^2],
[diff(y(x),x),y(x)*diff(y(x),x$2)^2*diff(y(x),x)*sin(x)+diff(y(x),x)^3],
[y(x),diff(y(x),x)-(1+x^(1/2))/(1+y(x)^(1/2))],
[y(x),diff(y(x),x) -(x-1)*y(x)^5/x^2/(-y(x)+2*y(x)^3)],
[y(x),3*y(x)+diff(y(x),x) - 2*x/exp(3*x)],
[x,3*x^2*y^3+7*x/y],
[y,A-(1+x)/(1+y^(1/2))]
]:
RESULT:=Matrix(nops(test_data),6);
for N,item in test_data do
    term:=item[1];
    expr:=item[2];
    RESULT[N,1]:=term; RESULT[N,2]:=expr;
    try
        result:=acer_V1_common_factor(term,expr);
        if type(result,`*`) and denom(result)<>1 then
           RESULT[N,3]:=expr;#bypass, not correct output
        else
           RESULT[N,3]:=result;#accept
        fi;  
    catch:
        RESULT[N,3]:=expr;#reject
    end try;      

    try
        result:=acer_V2_common_factor(term,expr);
        if type(result,`*`) and denom(result)<>1 then
           RESULT[N,4]:=expr;#bypass, not correct output
        else
           RESULT[N,4]:=result;#accept
        fi;  
    catch:
        RESULT[N,4]:=expr;#reject
    end try;      

    try
        result:=dharr_common_factor(term,expr);
        if type(result,`*`) and denom(result)<>1 then
           RESULT[N,5]:=expr;#bypass, not correct output
        else
           RESULT[N,5]:=result;#accept
        fi;  
    catch:
        RESULT[N,5]:=expr;#reject
    end try;      


    try
        result:=me_common_factor(term,expr);
        if type(result,`*`) and denom(result)<>1 then
           RESULT[N,6]:=expr;#bypass, not correct output
        else
           RESULT[N,6]:=result;#accept
        fi;  
    catch:
        RESULT[N,6]:=expr;#reject
    end try;      

od:

RESULT

how_to_do_special_factor.mw

Mapleprime will not let let insert content for some reason. Here is the output as screen shot but it is hard to read. But it is in the above worksheet.

Hello everyone,

I purchased Maple 2021 student version. I am using a Linux Ubuntu 20.04 machine. The machine is my personal computer, so there is no user access privilege restriction. I installed Maple using the GUI, and at the activation step, I get an error that says "Missing host ID for license server". I remember an option for servers or personal PC during download. I am confident that I chose the personal PC option.

Kind regards, and I look forward to hearing from you.

Hey guys,

How can I create a bar chart or a column chart, with specific x values under the bars.

Would be great If someone could help me.

Thank you;) 

help under object it says  (in Maple 2021)

The above has not been true for almost a year. Since in Maple 2021 one can do o:-m() 

person_class :=module()
  option object;
  export m:=proc(_self,$)
      print("you called me");
  end proc;
end module;

o:=Object(person_class);
o:-m()

            person_class := Object<<1758956556512>>
                  o := Object<<1758955674784>>
                        "you called me"

I hope this gets updated in Version 2022,  with examples also. The notation o:-method() is hidden in help and could not even find it, but it is meantioned in some pdf file which I lost track of at this moment. 

On another help page titled Overview of Object Methods it briefly mentions alternative call but the link that is supposed to explain it does not work. (clicking on it, produces nothing. Stays on same page). I guess no one tried this link before shipping Maple. 

Is this link somewhere to access directly in the help page?

How can factorise a polynomial with complex roots, without showing their numerical values of the roots, but only their symbolical value.

For example I have:

factor(x^4 - x^2 + x - 1)

and it shows me the following factorisation: (x-1)(x^3+x^2+1) but I want to also factorise x^3+x^2+1 but the roots should be displayed symbolically without numerical values of these roots. Then how to implement this task?

In the book I am reading it's stated to use factor(x^4-x^2+x-1, I), but it doesn't seem to be working.

How do I write this in Maple?

Find points P and Q on the parabola y = 1 − x^2 so that the triangle ABC formed by the x-axis and the tangent lines at P and Q is an equilateral triangle.

Thank you!

How do I write this in maple?

Find the maximum value of l f"(x)l on the indicated interval. f(x)= sqrt1+x^2  [0,2]

Thank you!

How do I write this in maple?

The figure shows a circle with radius 1 inscribed in the parabola y = x^2 . Find the center of the circle.

Thank you!

Hello Dear Community

I was by pure coinsidence integrating a simple expression, f(x) = x (x^2 - 1)^5
The correct answer is F(x) = 1/12 (-1 + x^2)^6+ an arbitary Constant and if you expand F(x), you will get

F(x) = x^12/12 - x^10/2 + (5 x^8)/4 - (5 x^6)/3 + (5 x^4)/4 - x^2/2 + 1/12+ an arbitary Constant 

When I do the integration command in Maple2021 for f(x) = x (x^2 - 1)^5 , Maple2021 gives me the output in expanded form
F(x) = x^12/12 - x^10/2 + (5 x^8)/4 - (5 x^6)/3 + (5 x^4)/4 + x^2/2

Maple2021's output is missing the 1/12

I have uploaded my Maple-document regarding this issue to this link something_wrong.mw

Please do check this out and come back with a feedback since I find it disturbing that Maple2021 is giving an incomplete output for an integrating expression that is easy to solve in hand.

~~ Best regards

On my maple page i got also all the time typesetting info ?
Looked at the help page :NumberTheory,PrimeCounting

How to produce the graph of the prime counting function with the two approximations?

How do I write this out in maple?

Sketch the graph of y =x^2+7x+3/x^2 , locate all maximum and minimum values, intervals of increase and decrease, and inflection points.

Thank you!

How do I write this in maple?

Find the point on the parabola x + y 2 = 0 that is closest to the point (0, -3).

Thank you!

First 11 12 13 14 15 16 17 Last Page 13 of 28