Preben Alsholm

13653 Reputation

22 Badges

19 years, 311 days

MaplePrimes Activity


These are questions asked by Preben Alsholm

Consider the following simple procedure:
 

restart;
p:=proc(x::{realcons,{set,list}(realcons)} ) x end proc;
p(8);
p({8,9});
p([7,8]);

I would like to be able to do something like this instead:

q:=proc(x::{ID,set,list}(realcons) ) x end proc;
## ID(realcons) should just be realcons.
q(8); ## Obviously we get an error.
q({8,9}); #OK
q([7,8]); #OK

In Q below ID is simply s->s, but that won't work in q.
Q works because the type check evaluates its arguments first.
 

Q:=proc(x) 
    if type(x,{s->s,list,set}(realcons)) then 
      x 
    else 
      error "%1 expects its first argument to be of type %2", procname,{s->s,list,set}(realcons)
    end if
end proc;
Q(8);
Q({8,9});
Q([7,8]);

I believe that Carl Love had a solution on MaplePrimes some years ago, but I can't find it.

In Maple 2023 I haven't been able to sign in to the Maple Cloud.
In Maple 2022 there was no problem. In fact in my Maple 2022.2 I'm actually signed in right now.

I need this to get updates to the Physics updates. 
The toolbar in 2023.2 has a grayed out icon saying "Sign in". Nothing happens if I click on it.

PS. I'm also signed in right now to Maple 2021.2. So the problem couldn't be that I cannot be logged in to more than one Maple release.

In a do loop with a try... catch statement I had placed an assignment to a vector element after catch: but before the line printing the lastexception. That the loop didn't perform as expected, but resulted in an error about ListTools:-FormatMessage wanting its first argument to be a string surprised me. Putting the assigment to the vector after the exception printing worked fine.
It seems that rtables are the exception (no pun intended) to the order being irrelevant.
 

restart;
V:=Vector():
for j from 1 to 5 do
  try
   V(j):=j/(j-1)
  catch:
   V(j):=17; # clears lastexception apparently
   printf(cat(StringTools:-FormatMessage(lastexception[ 2 .. -1 ] ),"\n"));
  end try
end do:
#####
restart;
V:=Vector():
for j from 1 to 5 do
  try
   V(j):=j/(j-1)
  catch:
   printf(cat(StringTools:-FormatMessage(lastexception[ 2 .. -1 ] ),"\n"));
   V(j):=17;
  end try
end do:

These simple lines confirm my observation:

restart;
lastexception;
5/0;
lastexception;
5/5;
lastexception;
x:=47;
lastexception;
table();
lastexception;
[1,2,3];
lastexception;
rtable();
lastexception; # Now cleared!


 

I'm getting the message

Secure Connection Failed

when trying to get into this forum using the latest version of Firefox.
For writing this I used Internet Explorer.

The message continues with:

An error occurred during a connection to mapleprimes.com. You have received an invalid certificate. Please contact the server administrator or email correspondent and give them the following information: Your certificate contains the same serial number as another certificate issued by the certificate authority. Please get a new certificate containing a unique serial number. Error code: SEC_ERROR_REUSED_ISSUER_AND_SERIAL
    The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
    Please contact the website owners to inform them of this problem
.

 

Has anybody else experienced the same?
What to do? 

In the unrelated discussion https://mapleprimes.com/questions/222768-Interrupting-An-Evaluation-Leaves-Mserver-Running
I asked Carl Love if he had an estimate of the number of builtin procedures in Maple.
Carl answered with the code you will find in the link.
His code came up with 316 and 320 in Maple 2016.2 and 2017.2, respectively.
He mentioned that the last one alphabetically was zip.
I happened to look up the help page for type/builtin and found the statement:

"It may be used with anames to list all builtin procedures. For example anames(builtin)."

So I tried:

AB:={anames(builtin)};
nops(AB); # 234 in Maple 2017.2
member(zip,AB); #false
op(3,eval(zip)); # builtin = 589 in Maple 2017.2
showstat(zip); # Works despite being builtin.

In Maple 2016.2 the corresponding numbers were 232 and 585.
So I'm left somewhat confused.
Apparently some procedures are less builtin than others? Does this just mean that the most difficult zipping is builtin, while simple stuff like the following is done by line 16 in the available code for zip?

showstat(zip,16..17);
zip(`=`,[a,b,c], [1,2,3]);


 

1 2 3 4 5 Page 1 of 5