Alec Mihailovs

Dr. Aleksandrs Mihailovs

4495 Reputation

21 Badges

20 years, 336 days
Mihailovs, Inc.
Owner, President, and CEO
Tyngsboro, Massachusetts, United States

Social Networks and Content at Maplesoft.com

Maple Application Center

I received my Ph.D. from the University of Pennsylvania in 1998 and I have been teaching since then at SUNY Oneonta for 1 year, at Shepherd University for 5 years, at Tennessee Tech for 2 years, at Lane College for 1 year, and this year I taught at the University of Massachusetts Lowell. My research interests include Representation Theory and Combinatorics.

MaplePrimes Activity


These are replies submitted by Alec Mihailovs

Historically, in earier Maple versions, subs was used for such calculations instead of eval. Using eval for that is relatively recent innovation. In many cases, eval=subs, just with changing the order of arguments. The eval help page doesn't contain corresponding examples though.
Also, showstat can be used for viewing the code,
showstat(`eval/diff`);
The result of substituting x=H and y=H can be predicted from the following,
diff(v(H,H),H,H);

       D[1, 1](v)(H, H) + 2 D[1, 2](v)(H, H) + D[2, 2](v)(H, H)
That's just the way Maple works. If you do eval without the quotes, Maple changes the variable from z to H, doing exactly what it was asked to do. It is nothing wrong with Maple here. Another way of dealing with that is changing order of assignments - i.e. assign "a" in my example after assigning "v",
v:=z->z^H:
a:=eval(diff(v(x),x),x=H);
                                     H
                               a := H
If using quotes is impossible, that just means that the algorithm should be revised making that possible. The problem is not in Maple - the problem is in using eval in incorrect way.
This is a result of so called "premature evaluation". It can be avoided by adding unevaluating quotes,
a:='eval(diff(v(x),x),x=H)';
                              /d      \|
                         a := |-- v(x)||
                              \dx     /|x = H
v:=z->z^H:
a;
                                   H
                                  H
Also, it is not the best way of doing that. It is better to use D,
restart;
a:=D(v)(H):
v:=z->z^H:
a;

                                   H
                                  H
Nice pictures. Both look like Physics in Art rather than Math though.
That also can be done as
isort:=L->ListTools:-Transpose(sort(ListTools:-Enumerate(L),(a,b)->a[2]<=b[2]))[]:

Indices,Values:=isort([4,5,3]);

               Indices, Values := [3, 1, 2], [3, 4, 5]
The following 2-line procedure is slightly faster,
Isort:=proc(L) local a;
a:=sort([$1..nops(L)],(i,j)->L[i]<=L[j]); [seq(L[i],i=a)],a end:

Values,Indices:=Isort([4,5,3]);

               Values, Indices := [3, 4, 5], [3, 1, 2]
Another problem,
icoeff3((a+b)*(c+d));
                                  4
Another problem,
icoeff3((a+b)*(c+d));
                                  4
I should use procname in it instead of icoeff4 :)
I should use procname in it instead of icoeff4 :)
That should work OK. Also, for efficiency reasons, subsindets[flat] can be used instead of subsindets.
That should work OK. Also, for efficiency reasons, subsindets[flat] can be used instead of subsindets.
That has several problems, too. In particular,
icoeff2(3);
                                  1
That has several problems, too. In particular,
icoeff2(3);
                                  1
First 165 166 167 168 169 170 171 Last Page 167 of 180