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

Division by zero error is a typical error message in Maple. It doesn't usually mean that actual division by 0 occurs. For example,
L:=[1, 0, 1, 2, 8, 32, 145, 702, 3598, 19280, 107160, 614000, 3609760]: 

gfun[guessgf](L,x); 

Error, (in series/int) numeric exception: division by zero
In general, error messages are often misleading. Another example,
convert(0.5,base,3); 

Error, (in convert/base) convert/base uses a 3rd argument, beta, which is missing
What is a definition of a mathematician? That can be used as a test - if somebody thinks that 0^0 is not 1, then he or she is not a mathematician. 0.^0. can be something different, maybe, but not 0^0 - it is even more basic thing than 2*2=4 (and not 3.99, in particular).
More or less standard "classical" (i.e. before toposes) approach to the foundations of mathematics is based on the category of sets. In this approach, non-negative integers are defined as cardinal numbers of finite sets and arithmetical operations +, *, and ^ are deducted from the operations on sets. In particular, for non-negative integers m and n, number m^n is defined as the number of maps (or functions) from a set with n elements to a set with m elements. For m=n=0 that gives 1. I don't think that a mathematician might think that the number of elements of Hom(∅,∅) can be anything different than 1.
What it has to do with Maxima? It is a different CAS and different CASes use different conventions. I wouldn't call Maxima Maple's mommy, by the way. You have a strange way of expressing you thoughts. For example, what does that mean, "It's not as universal as convention as you might think"? I remember well what I wrote, but I reread it again and didn't find word "universal" in my previous comment. In any case, there is no an "universal convention" for such things as 0^(1+I) and 0^I. Maxima uses one convention - Maple uses another one. Also, things are different in Maple with replacing 0 with 0. and I with 1.*I.
Tom, Thank you. My old (Shepherd University) Maple page is here. Among other material, it contains a series of photos of Maple experts. I don't work at Tennessee Tech anymore. Currently, I am looking for a job.
0^0=1 without any doubt (and I hope that it won't be changed to 1/2 in the next Maple release.) Mathematicians do not argue about that - only non-mathematicians argue. Other powers of 0 you mentioned are conventional and can be redefined if one doesn't like them the way they are.
Randprime, Nextprime, and Primitive commands can be useful. For example,
Randprime(32,x) mod 2;
   32    31    29    28    27    25    24    22    19    18    17
  x   + x   + x   + x   + x   + x   + x   + x   + x   + x   + x

            15    14    13    11    10    8    7    4    3
         + x   + x   + x   + x   + x   + x  + x  + x  + x  + 1

Primitive(%) mod 2;
                                 true

alias(alpha=RootOf(%%)):

p:=Randprime(2,x,alpha) mod 2;

        2         31        25        24        23        22
  p := x  + (alpha   + alpha   + alpha   + alpha   + alpha

                19        17        13        12        11        7
         + alpha   + alpha   + alpha   + alpha   + alpha   + alpha

                5        2           29        27        26        25
         + alpha  + alpha ) x + alpha   + alpha   + alpha   + alpha

                21        20        17        14        12        11
         + alpha   + alpha   + alpha   + alpha   + alpha   + alpha

                10        9        7        5        3
         + alpha   + alpha  + alpha  + alpha  + alpha  + alpha + 1

Nextprime(p,x,alpha) mod 2;

   2         31        25        24        23        22        19
  x  + (alpha   + alpha   + alpha   + alpha   + alpha   + alpha

                17        13        12        11        7        5
         + alpha   + alpha   + alpha   + alpha   + alpha  + alpha

                2           29        27        26        25
         + alpha ) x + alpha   + alpha   + alpha   + alpha

                21        20        17        14        12        11
         + alpha   + alpha   + alpha   + alpha   + alpha   + alpha

                10        9        7        5        3        2
         + alpha   + alpha  + alpha  + alpha  + alpha  + alpha
Randprime, Nextprime, and Primitive commands can be useful. For example,
Randprime(32,x) mod 2;
   32    31    29    28    27    25    24    22    19    18    17
  x   + x   + x   + x   + x   + x   + x   + x   + x   + x   + x

            15    14    13    11    10    8    7    4    3
         + x   + x   + x   + x   + x   + x  + x  + x  + x  + 1

Primitive(%) mod 2;
                                 true

alias(alpha=RootOf(%%)):

p:=Randprime(2,x,alpha) mod 2;

        2         31        25        24        23        22
  p := x  + (alpha   + alpha   + alpha   + alpha   + alpha

                19        17        13        12        11        7
         + alpha   + alpha   + alpha   + alpha   + alpha   + alpha

                5        2           29        27        26        25
         + alpha  + alpha ) x + alpha   + alpha   + alpha   + alpha

                21        20        17        14        12        11
         + alpha   + alpha   + alpha   + alpha   + alpha   + alpha

                10        9        7        5        3
         + alpha   + alpha  + alpha  + alpha  + alpha  + alpha + 1

Nextprime(p,x,alpha) mod 2;

   2         31        25        24        23        22        19
  x  + (alpha   + alpha   + alpha   + alpha   + alpha   + alpha

                17        13        12        11        7        5
         + alpha   + alpha   + alpha   + alpha   + alpha  + alpha

                2           29        27        26        25
         + alpha ) x + alpha   + alpha   + alpha   + alpha

                21        20        17        14        12        11
         + alpha   + alpha   + alpha   + alpha   + alpha   + alpha

                10        9        7        5        3        2
         + alpha   + alpha  + alpha  + alpha  + alpha  + alpha
The iterators of many combinatorial structures are in the combstruct package. For example, combinations can be iterated as follows,
with(combstruct):
a:=iterstructs(Combination(5),size=3):
nextstruct(a);

                              {1, 2, 3}

nextstruct(a);

                              {1, 2, 4}
etc. It is a simple programming exercise to write a procedure finding next combination,
nextcomb := proc(n, c)
local i, j;
    for i from nops(c) by -1 to 1 do
        if c[i] < n - nops(c) + i then return {
            seq(c[j], j = 1 .. i - 1),
            seq(c[i] + j, j = 1 .. nops(c) - i + 1)}
        end if
    end do;
    {`$`(1 .. nops(c))}
end proc:
For example,
nextcomb(5,{1,2,3});

                              {1, 2, 4}
Which one, f or cc? I don't see a flaw.
f(3,[x]);
                                  {}
cc(0,[x]);
                                  0
Certainly, if one wants 0 instead of NULL in f, it can be done using additional if, either at the end, or in the "if member..." line (something like if nops([d])>1 then ...)
An alternative is
f:=proc()
local c,d,n;
c:=coeffs(args,d);
if member(1,[d],n) then {subsop(n=NULL,[c])[]} else {c} fi 
end:
For example,
map(f,[p1,p2],[x,y]);

                        [{1, a, b}, {1, a, b}]

f(1/x+c,x);

                                 {1}
The analogous procedure for the constant term is
cc:=proc()
local c,d,n;
c:=coeffs(args,d);
if member(1,[d],n) then op(n,[c]) else 0 fi
end:
For example,
map(cc,[p1,p2],[x,y]);

                                [0, c]

cc(1/x+c,x);

                                  c
Yes, I also thought that substitution of zeros is a good way - and I added it originally in the comment. But then I read your original post to the end, noticed that you have it at the end, and deleted it from my comment.
For polynomials, there is coeftayl,
map(coeftayl, [p1,p2], [x,y]=[0,0], [0,0]);

                                [0, c]
However, it doesn't work for polynomials with negative degrees.
map(sin,[2,Pi,Pi/3]);

                         [sin(2),0,sqrt(3)/2]
First 162 163 164 165 166 167 168 Last Page 164 of 180