Christian Wolinski

MaplePrimes Activity


These are questions asked by Christian Wolinski

In Maple V, Release 4 (1996):

 

T:=table():
i:=1:N:=5000;

for i from i to N  
do
   T[i]:=T[i+1]:
   T[i+1]:=1;
   eval(T[1]);
od:
print(i);

for i from i to N  
do
   T[i]:=T[i+1]:
   T[i+1]:=1;
   eval(T[1]);
od:
print(i);

I receive this output:

N := 5000
Error, too many levels of recursion
3607
5001

Can You explain this occurence, as well as the following one:

In Maple V, Release 4 (1996):

 

T:=table():
i:=1:N:=5000;

for i from i to N  
do
  T[i]:=T[i+1]:
  eval(T[1]);
od:
print(i);
 
for i from i to N  
do
  T[i]:=T[i+1]:
  eval(T[1]);
od:
print(i);;

gives:

N := 5000
Error, too many levels of recursion
3607
Error, too many levels of recursion
3607

How does one control allowance for recursion depth?

In Maple V, Release 4 (1996):

 

_EnvX:=0; b:=0; proc() global b; print(_EnvX, b); assign('_EnvX=1, b=1'); print(_EnvX, b); end();
_EnvX:=0: b:=0: proc() global b; print(_EnvX, b); _EnvX:=1; b:=1; print(_EnvX, b); end();;

gives:
                                 0, 0
                                 0, 1

In newer Maple:

 

_EnvX:=0; b:=0; proc() global b; print(_EnvX, b); assign('_EnvX=1, b=1'); print(_EnvX, b); end proc();
_EnvX:=0: b:=0: proc() global b; print(_EnvX, b); _EnvX:=1; b:=1; print(_EnvX, b); end proc();

?

Code & result:

> map((a::uneval,b)->'args',[a,b,c,d],1..4,x);       
['a, 1 .. 4, x', 'b, 1 .. 4, x', 'c, 1 .. 4, x', 'd, 1 .. 4, x']

> map((a,b::uneval)->'args',[a,b,c,d],1..4,x);           
[a, 1 .. 4, x, b, 1 .. 4, x, c, 1 .. 4, x, d, 1 .. 4, x]

Why is the output not:
['a', 1 .. 4, x, 'b', 1 .. 4, x, 'c', 1 .. 4, x, 'd', 1 .. 4, x]
and
[a, '1 .. 4', x, b, '1 .. 4', x, c, '1 .. 4', x, d, '1 .. 4', x]
?

Does `evala/toprof` still exist in newer Maple versions, or is there an equivalent?

I am curious, can simplify/siderels be executed in mod p by some equivalent Maple function call?

4 5 6 7 Page 6 of 7