Christian Wolinski

MaplePrimes Activity


These are replies submitted by Christian Wolinski

@Carl Love but builtin:

 

H := proc ()
   if type('procname, indexed') and type([op]('procname'), 'list(posint)') then op(map(op, map((n, m) -> `if`(n <= m, n, NULL), [op]('procname'), 'nargs'), ['args'])) else 'procname(args)' fi
end;

 

@Preben Alsholm I was contemplating whether args[1] is a reference to parameter a or procname a reference to procedure F in this made up example (in any of the Maple versions):
 

 

F := proc(a, b)
   f := () -> args[1];
   g := () -> procname;
end;


Also, is there a kernel substitute for f in this example?

@vv The task is trivial if you have both versions. Let someone like that post here instead please.

@vv Perhaps instead of using solve/ eliminate one should use gaussjord or linsolve?

@vv who wrote "The code looks to me as unnecessarily complicated, almost obfuscated. "
   So in short: Maple is not your programming language, nor is English your spoken language. But you should have read the original post. The query is about the following code, which uses only the most basic kernel functions, yet reportedly it fails on newer versions, say 2016.

 

F := proc(S, T)
   local A, n, m, x, y, v, w, V, W, i, f, g;
   n := `$`(1 .. nops(S));
   m := `$`(1 .. nops(T));
   f := () -> args[1];
   g := `@`(assign, op, map);
   g(V @ f = op, [n], 'S');
   g(W @ f = op, [m], 'T');
   g(v = simplify @ V, [n]);
   g(w = simplify @ W, [m]);
   A := frontend([eliminate], [map(x = v, {n}) union map(y = w, {m}), indets(map(w, {m}), function) union map(y, {m})], [{Non(function)}, {}]);
   A := map(x = V, [n]), subs(A[1][1], map(y, [m]));
   map(W, [m]), subs(A)
end;

F('{log[12](27)}, {log[36](24)}');
F('{log[2](3), log[3](5), log[7](2)}, {log[140](63)}');

 

   I would like someone to present how two different platforms execute this code differently. Also @vv if you have an opinion about this code please post in the original thread, (link).
 

@hitstudent Have you actually produced the object asked? The method you produced is simply incomplete.

@taro I think that should be:

numer_expand := expand@numer/denom;

@Carl Love type(f[1](x),indexed); returns false, at least in Maple 5.4. Is this different in Maple 16?

@Preben Alsholm I have not observed this before:

 

restart;
rng := ''i = 1 .. 3'';
u := setattribute((x) -> 'x' ^ op(1, 'procname'), remember);
['u[i]' $ rng](x-y);
op(4, eval(u));

So an index on a function name always invokes the same procedure. I always expected an indexed function to require a table.

So how do we typecheck an expression for function f, specifically with or specifically without the index?

@Carl Love type('u[1](x)', specfunc(anything, u))=false; #Maple 5.4

That is to say specfunc judges the face of the expression with identity. What about newer Maple?

Say u:=proc(x) x+1 end; v:=table([]); type('u[1](x)', specfunc(anything, u)), type('v[1](x)', specfunc(anything, v));

@Carl Love I did not anticipate specfunc(`~`[`=`]) as a possibility. Does this mean newer maple would identifiy u[1](x) as specfunc(u)? How does one identify indexed function by its base name?

@Carl Love Would this be a cartesian product,: {{1,3}, {1}} union~ {{5},{6}}? Is that even valid form?

My original question was this: type('a =~ b', specfunc(anything, `~`)) or type('a =~ b', specfunc(anything, `=~`)) or some other type?

@Carl Love There is one in the previous post.

Output list from op Command

Also, can you tell me how the new ~ is interpreted typewise, ex: a ~= b?

 

 

 

 

restart;
N:=20000;

T:=table():
i:=1:
for i from i to N
do
   T[i]:=T[i+1]:
   if irem(i,100)=0 then
      T[i+1]:=1;
      evaln(T[1]);
   fi;   
od:
i,eval(T[1],i-1),eval(T[1],i);

U:=table():
i:=1:
for i from i to N
do
   U[i]:=U[i+1]:
   if irem(i,100)=0 then
      U[i+1]:=1;
      eval(U[1],N+1);
   fi;   
od:
i,eval(U[1],N),eval(U[1],N+1);;


gives:
N := 20000
20001   T[20001]   1
20001   U[20001]   1


evaln(expression) and eval(expression, length) make no obstacles. This is what I was anticipating.
eval(expression) is different indeed.

@roman_pearce Thank You. I do not understand what you mean when you say it is a "C function". I always believed Maple is database based, so to overcome common limits of linear storage, so why these limits? Is there a limit on recursion in the newer kernels?

Also see below. Why are all the limits observed distinct?

 

 

restart;

f:=unapply('cat(a,i),i');
g:=unapply('assign(f(i),f(i+1)),i');
 
i:=1:N:=5000;
for i from i to N  
do
   g(i);
   eval(a1);
od:
print(i);

for i from i to N  
do
   g(i);
   eval(a1);
od:
print(i);

gives:

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

5 6 7 8 9 10 11 Page 7 of 11