Alec Mihailovs

Dr. Aleksandrs Mihailovs

4495 Reputation

21 Badges

20 years, 341 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

He is a high school teacher, so it is not something that he is using in his research. Probably, -1/2 didn't work in his formula, so he changed it to 1/2 instead of changing the formula. Another unexplainable thing in his book is that he put zeros of zeta-function on the line Im(z)=1/2 instead of Re(z)=1/2, see Dan Segal's review. __________ Alec Mihailovs http://mihailovs.com/Alec/
You don't need sorting for that. It can be done as
aplot:=(a,k,A,K)->plots[display](
  seq(plottools[line]([A[i],0],[A[i],K[i]]),i=1..nops(a)),   
  tickmarks=[[seq(A[i]=StringTools:-SubstituteAll(
    sprintf("%a",a[i]),"*",""),i=1..nops(a))],
  [seq(K[i]=StringTools:-SubstituteAll(
    sprintf("%a",k[i]),"*"," "),i=1..nops(a))]]):

a:=[w1+w2-w3,
   -w1+2*w2,
   2*w1-w2-2*w3,
   -w1+w2-w3,
   -w1+w2+w3]:

k:=[20/7*K,2*K,10*K,K,8/3*K]:

aplot([op(a),op(-a)],[op(k),op(k)],
  eval([op(a),op(-a)],[w1=50, w2=60,w3=65]),
  eval([op(k),op(k)],K=1));
The problem with that is that the tickmarks overlap. It looks slightly better if you plot only positive peaks,
pos,neg:=selectremove(i->eval(a[i],[w1=50, w2=60,w3=65])>0,[$1..5]);

                    pos, neg := [1, 2, 5], [3, 4]

aplot([seq(a[i],i=pos),seq(-a[i],i=neg)],
  [seq(k[i],i=pos),seq(k[i],i=neg)],
  eval([seq(a[i],i=pos),seq(-a[i],i=neg)],[w1=50, w2=60,w3=65]),
  eval([seq(k[i],i=pos),seq(k[i],i=neg)],K=1));
You can make that into a procedure to try other values of w1,w2, and w3,
f:=proc(W1,W2,W3) 
local pos,neg,i;
global aplot,K,k,a,w1,w2,w3; 
pos,neg:=selectremove(i->eval(a[i],[w1=W1, w2=W2,w3=W3])>0,[$1..5]);
aplot([seq(a[i],i=pos),seq(-a[i],i=neg)],
  [seq(k[i],i=pos),seq(k[i],i=neg)],
  eval([seq(a[i],i=pos),seq(-a[i],i=neg)],[w1=W1, w2=W2,w3=W3]),
  eval([seq(k[i],i=pos),seq(k[i],i=neg)],K=1))
end:
The previous plot can be obtained then as f(50,60,65). __________ Alec Mihailovs http://mihailovs.com/Alec/
You don't need sorting for that. It can be done as
aplot:=(a,k,A,K)->plots[display](
  seq(plottools[line]([A[i],0],[A[i],K[i]]),i=1..nops(a)),   
  tickmarks=[[seq(A[i]=StringTools:-SubstituteAll(
    sprintf("%a",a[i]),"*",""),i=1..nops(a))],
  [seq(K[i]=StringTools:-SubstituteAll(
    sprintf("%a",k[i]),"*"," "),i=1..nops(a))]]):

a:=[w1+w2-w3,
   -w1+2*w2,
   2*w1-w2-2*w3,
   -w1+w2-w3,
   -w1+w2+w3]:

k:=[20/7*K,2*K,10*K,K,8/3*K]:

aplot([op(a),op(-a)],[op(k),op(k)],
  eval([op(a),op(-a)],[w1=50, w2=60,w3=65]),
  eval([op(k),op(k)],K=1));
The problem with that is that the tickmarks overlap. It looks slightly better if you plot only positive peaks,
pos,neg:=selectremove(i->eval(a[i],[w1=50, w2=60,w3=65])>0,[$1..5]);

                    pos, neg := [1, 2, 5], [3, 4]

aplot([seq(a[i],i=pos),seq(-a[i],i=neg)],
  [seq(k[i],i=pos),seq(k[i],i=neg)],
  eval([seq(a[i],i=pos),seq(-a[i],i=neg)],[w1=50, w2=60,w3=65]),
  eval([seq(k[i],i=pos),seq(k[i],i=neg)],K=1));
You can make that into a procedure to try other values of w1,w2, and w3,
f:=proc(W1,W2,W3) 
local pos,neg,i;
global aplot,K,k,a,w1,w2,w3; 
pos,neg:=selectremove(i->eval(a[i],[w1=W1, w2=W2,w3=W3])>0,[$1..5]);
aplot([seq(a[i],i=pos),seq(-a[i],i=neg)],
  [seq(k[i],i=pos),seq(k[i],i=neg)],
  eval([seq(a[i],i=pos),seq(-a[i],i=neg)],[w1=W1, w2=W2,w3=W3]),
  eval([seq(k[i],i=pos),seq(k[i],i=neg)],K=1))
end:
The previous plot can be obtained then as f(50,60,65). __________ Alec Mihailovs http://mihailovs.com/Alec/
It is possible to find an index of an expression, but that requires searching. It is easier just to sort indices,
sort([$1..5],(i,j)->(is(a[i]<a[j]) assuming b));

                           [3, 4, 1, 2, 5]
And yes, for plot you have to substitute some numerical values (or at least values that can be evaluated to numeric), plot is a numerical procedure. Also, first 2 values, a[3] and a[4] are negative, and the 3rd value, a[1] can be either positive or negative. If you do fourier transform of cosines, they will also give positive peaks, and if you display only positive part, then the order of them will be different than in sorting just a[i]. __________ Alec Mihailovs http://mihailovs.com/Alec/
It is possible to find an index of an expression, but that requires searching. It is easier just to sort indices,
sort([$1..5],(i,j)->(is(a[i]<a[j]) assuming b));

                           [3, 4, 1, 2, 5]
And yes, for plot you have to substitute some numerical values (or at least values that can be evaluated to numeric), plot is a numerical procedure. Also, first 2 values, a[3] and a[4] are negative, and the 3rd value, a[1] can be either positive or negative. If you do fourier transform of cosines, they will also give positive peaks, and if you display only positive part, then the order of them will be different than in sorting just a[i]. __________ Alec Mihailovs http://mihailovs.com/Alec/
It can be done compact and efficient by using a mix of procedural and functional programming,
VerifyTools:-AddVerification('nested'=proc(x,y,ver:=NULL) local t,f;
f:=t->verify(x,y,'t'('nested'(ver)));
for t in [Vector,Matrix,Array,array,set,list,relation,range,record]
do if x::t then break fi od;
if y::t then f(t) else verify(x,y,ver) fi
end);
I usually write a working procedure first, and optimize it after. __________ Alec Mihailovs http://mihailovs.com/Alec/
You ask good questions, in the correct form, and with good examples, so you get a lot of replies (unlike some other people on this site.) __________ Alec Mihailovs http://mihailovs.com/Alec/
You ask good questions, in the correct form, and with good examples, so you get a lot of replies (unlike some other people on this site.) __________ Alec Mihailovs http://mihailovs.com/Alec/
There are many different data structures in Maple (in contrast with Mathematica and Matlab). What you are doing, doesn't create an array, it creates a table,
type(a,array);
                                false
type(a,table);
                                 true
max and min operate on sequences, not tables or arrays, so to use them, one should extract a sequence first,
max(op(convert(a,list))) assuming b;

                            -w1 + w2 + w3
The answer is different because you changed a[2]. If you would like to work with Arrays, then the difference is that the size of the Array should be specified before assigning. Something like
a:=Array(1..5):
Then, after assigning values, max and min can be found either as above, or as
max(seq(i,i=a)) assuming b;

                            -w1 + w2 + w3
Sorting in this case can be done as
sort(a,is@`<`) assuming b;

  [2 w1 - w2 - 2 w3, -w1 + w2 - w3, w1 + w2 - w3, -w1 + 2 w2,

        -w1 + w2 + w3]

type(%,Array);

                                 true
That seems to be undocumented. _________ Alec Mihailovs http://mihailovs.com/Alec/
There are many different data structures in Maple (in contrast with Mathematica and Matlab). What you are doing, doesn't create an array, it creates a table,
type(a,array);
                                false
type(a,table);
                                 true
max and min operate on sequences, not tables or arrays, so to use them, one should extract a sequence first,
max(op(convert(a,list))) assuming b;

                            -w1 + w2 + w3
The answer is different because you changed a[2]. If you would like to work with Arrays, then the difference is that the size of the Array should be specified before assigning. Something like
a:=Array(1..5):
Then, after assigning values, max and min can be found either as above, or as
max(seq(i,i=a)) assuming b;

                            -w1 + w2 + w3
Sorting in this case can be done as
sort(a,is@`<`) assuming b;

  [2 w1 - w2 - 2 w3, -w1 + w2 - w3, w1 + w2 - w3, -w1 + 2 w2,

        -w1 + w2 + w3]

type(%,Array);

                                 true
That seems to be undocumented. _________ Alec Mihailovs http://mihailovs.com/Alec/
For sorting you have to provide a sorting procedure. For example,
sort(convert(a,list),is@`<`) assuming b;

  [2 w1 - w2 - 2 w3, -w1 + w2 - w3, w1 + w2 - w3, -w1 + 2 w2,

        -w1 + w2 + w3]
__________ Alec Mihailovs http://mihailovs.com/Alec/
For sorting you have to provide a sorting procedure. For example,
sort(convert(a,list),is@`<`) assuming b;

  [2 w1 - w2 - 2 w3, -w1 + w2 - w3, w1 + w2 - w3, -w1 + 2 w2,

        -w1 + w2 + w3]
__________ Alec Mihailovs http://mihailovs.com/Alec/
Sure,
dsolve(diff(r^2*diff(f(r),r),r));

                                        _C2
                           f(r) = _C1 + ---
                                         r
__________ Alec Mihailovs http://mihailovs.com/Alec/
a:=w1+w2-w3,-w1+2*w2+w3,2*w1-w2-2*w3,-w1+w2-w3,-w1+w2+w3:

b:=w3>w2,w2>w1,w1>0,w2-w1>w3-w2:

max(a) assuming b;

                           -w1 + 2 w2 + w3

min(a) assuming b;

                           2 w1 - w2 - 2 w3
_________ Alec Mihailovs http://mihailovs.com/Alec/
a:=w1+w2-w3,-w1+2*w2+w3,2*w1-w2-2*w3,-w1+w2-w3,-w1+w2+w3:

b:=w3>w2,w2>w1,w1>0,w2-w1>w3-w2:

max(a) assuming b;

                           -w1 + 2 w2 + w3

min(a) assuming b;

                           2 w1 - w2 - 2 w3
_________ Alec Mihailovs http://mihailovs.com/Alec/
First 145 146 147 148 149 150 151 Last Page 147 of 180