Alec Mihailovs

Dr. Aleksandrs Mihailovs

4495 Reputation

21 Badges

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

I have a simple Maplet example displaying a message inside it in case if the imput is incorrect, in my blog.

Alec

I have a simple Maplet example displaying a message inside it in case if the imput is incorrect, in my blog.

Alec

Robert Israel's suggestion works in Classic Maple and in Standard Maple with Extended Typesetting enabled. To do that, one can either click Tools, then Options, then Display, and change the 3rd line, Typesetting level, to Extended, or execute

interface(typesetting=extended);

I use Standard Maple quite rarely and get to know that from another Robert Israel's post.

Alec

Robert Israel's suggestion works in Classic Maple and in Standard Maple with Extended Typesetting enabled. To do that, one can either click Tools, then Options, then Display, and change the 3rd line, Typesetting level, to Extended, or execute

interface(typesetting=extended);

I use Standard Maple quite rarely and get to know that from another Robert Israel's post.

Alec

ListTools:-Rotate does that quite simple using Maple commands. StringTools:-Rotate is, probably, faster, because it uses external calling. The Bits package doesn't seem to have the Rotate command!

Alec

ListTools:-Rotate does that quite simple using Maple commands. StringTools:-Rotate is, probably, faster, because it uses external calling. The Bits package doesn't seem to have the Rotate command!

Alec

You could try Maplets:-Examples:-GetInput as well.

Ales

You could try Maplets:-Examples:-GetInput as well.

Ales

You may try to increase the number of points by adding something like numpoints=1000, or numpoints=10000 to the plot command.

Alec

You may try to increase the number of points by adding something like numpoints=1000, or numpoints=10000 to the plot command.

Alec

So why it doesn't work? Do something like

if c=2 then 
    if Maplets:-Examples:-Alert("c=2. Quit?") #show the alert
        then return c=2 # for example, which stops 
# the program and returns c=2 if "OK" is pressed, and 
# continue calculations if "Cancel" is pressed.
    fi
fi;

Alec

So why it doesn't work? Do something like

if c=2 then 
    if Maplets:-Examples:-Alert("c=2. Quit?") #show the alert
        then return c=2 # for example, which stops 
# the program and returns c=2 if "OK" is pressed, and 
# continue calculations if "Cancel" is pressed.
    fi
fi;

Alec

The distribution is not uniform. For example, in case (0,10, 6, 2) there is only one solution [0,2,4,6,8,10]. In the (0,10, 6, 3) case  the set of all solutions can be found as

S:=map(y->ListTools:-PartialSums([0,op(y)]),
    select(x->max(x)<=3,combinat:-composition(10,5)));

  S := {[0, 1, 2, 4, 7, 10], [0, 1, 2, 5, 7, 10], [0, 1, 2, 5, 8, 10],

        [0, 1, 3, 4, 7, 10], [0, 1, 3, 5, 7, 10], [0, 1, 3, 5, 8, 10],

        [0, 1, 3, 6, 7, 10], [0, 1, 3, 6, 8, 10], [0, 1, 3, 6, 9, 10],

        [0, 1, 4, 5, 7, 10], [0, 1, 4, 5, 8, 10], [0, 1, 4, 6, 7, 10],

        [0, 1, 4, 6, 8, 10], [0, 1, 4, 6, 9, 10], [0, 1, 4, 7, 8, 10],

        [0, 1, 4, 7, 9, 10], [0, 2, 3, 4, 7, 10], [0, 2, 3, 5, 7, 10],

        [0, 2, 3, 5, 8, 10], [0, 2, 3, 6, 7, 10], [0, 2, 3, 6, 8, 10],

        [0, 2, 3, 6, 9, 10], [0, 2, 4, 5, 7, 10], [0, 2, 4, 5, 8, 10],

        [0, 2, 4, 6, 7, 10], [0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 9, 10],

        [0, 2, 4, 7, 8, 10], [0, 2, 4, 7, 9, 10], [0, 2, 5, 6, 7, 10],

        [0, 2, 5, 6, 8, 10], [0, 2, 5, 6, 9, 10], [0, 2, 5, 7, 8, 10],

        [0, 2, 5, 7, 9, 10], [0, 2, 5, 8, 9, 10], [0, 3, 4, 5, 7, 10],

        [0, 3, 4, 5, 8, 10], [0, 3, 4, 6, 7, 10], [0, 3, 4, 6, 8, 10],

        [0, 3, 4, 6, 9, 10], [0, 3, 4, 7, 8, 10], [0, 3, 4, 7, 9, 10],

        [0, 3, 5, 6, 7, 10], [0, 3, 5, 6, 8, 10], [0, 3, 5, 6, 9, 10],

        [0, 3, 5, 7, 8, 10], [0, 3, 5, 7, 9, 10], [0, 3, 5, 8, 9, 10],

        [0, 3, 6, 7, 8, 10], [0, 3, 6, 7, 9, 10], [0, 3, 6, 8, 9, 10]

        }

Now,

sort(Statistics:-Tally([S[]]));

  [0 = 51, 1 = 16, 2 = 22, 3 = 28, 4 = 24, 5 = 24, 6 = 24, 7 = 28,

        8 = 22, 9 = 16, 10 = 51]

map(x->lhs(x)=rhs(x)*1000/51.,%);

  [0 = 1000.000000, 1 = 313.7254902, 2 = 431.3725490, 3 = 549.0196078,

        4 = 470.5882353, 5 = 470.5882353, 6 = 470.5882353,

        7 = 549.0196078, 8 = 431.3725490, 9 = 313.7254902,

        10 = 1000.000000]

That looks quite similar to the results obtained by a simulation.

Alec

The distribution is not uniform. For example, in case (0,10, 6, 2) there is only one solution [0,2,4,6,8,10]. In the (0,10, 6, 3) case  the set of all solutions can be found as

S:=map(y->ListTools:-PartialSums([0,op(y)]),
    select(x->max(x)<=3,combinat:-composition(10,5)));

  S := {[0, 1, 2, 4, 7, 10], [0, 1, 2, 5, 7, 10], [0, 1, 2, 5, 8, 10],

        [0, 1, 3, 4, 7, 10], [0, 1, 3, 5, 7, 10], [0, 1, 3, 5, 8, 10],

        [0, 1, 3, 6, 7, 10], [0, 1, 3, 6, 8, 10], [0, 1, 3, 6, 9, 10],

        [0, 1, 4, 5, 7, 10], [0, 1, 4, 5, 8, 10], [0, 1, 4, 6, 7, 10],

        [0, 1, 4, 6, 8, 10], [0, 1, 4, 6, 9, 10], [0, 1, 4, 7, 8, 10],

        [0, 1, 4, 7, 9, 10], [0, 2, 3, 4, 7, 10], [0, 2, 3, 5, 7, 10],

        [0, 2, 3, 5, 8, 10], [0, 2, 3, 6, 7, 10], [0, 2, 3, 6, 8, 10],

        [0, 2, 3, 6, 9, 10], [0, 2, 4, 5, 7, 10], [0, 2, 4, 5, 8, 10],

        [0, 2, 4, 6, 7, 10], [0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 9, 10],

        [0, 2, 4, 7, 8, 10], [0, 2, 4, 7, 9, 10], [0, 2, 5, 6, 7, 10],

        [0, 2, 5, 6, 8, 10], [0, 2, 5, 6, 9, 10], [0, 2, 5, 7, 8, 10],

        [0, 2, 5, 7, 9, 10], [0, 2, 5, 8, 9, 10], [0, 3, 4, 5, 7, 10],

        [0, 3, 4, 5, 8, 10], [0, 3, 4, 6, 7, 10], [0, 3, 4, 6, 8, 10],

        [0, 3, 4, 6, 9, 10], [0, 3, 4, 7, 8, 10], [0, 3, 4, 7, 9, 10],

        [0, 3, 5, 6, 7, 10], [0, 3, 5, 6, 8, 10], [0, 3, 5, 6, 9, 10],

        [0, 3, 5, 7, 8, 10], [0, 3, 5, 7, 9, 10], [0, 3, 5, 8, 9, 10],

        [0, 3, 6, 7, 8, 10], [0, 3, 6, 7, 9, 10], [0, 3, 6, 8, 9, 10]

        }

Now,

sort(Statistics:-Tally([S[]]));

  [0 = 51, 1 = 16, 2 = 22, 3 = 28, 4 = 24, 5 = 24, 6 = 24, 7 = 28,

        8 = 22, 9 = 16, 10 = 51]

map(x->lhs(x)=rhs(x)*1000/51.,%);

  [0 = 1000.000000, 1 = 313.7254902, 2 = 431.3725490, 3 = 549.0196078,

        4 = 470.5882353, 5 = 470.5882353, 6 = 470.5882353,

        7 = 549.0196078, 8 = 431.3725490, 9 = 313.7254902,

        10 = 1000.000000]

That looks quite similar to the results obtained by a simulation.

Alec

That's a great idea!

For larger n, k, and m, a direct formula for f may be faster. For example,

F:=(n,k,m)->add(binomial(k+1,i)*binomial(-k-1,n-k-m*i)*(-1)^(n-k-(m-1)*i),i=0..(n-k)/m):

time(f(500,200,40));
                                4.071

time(F(500,200,40));

                                  0.
f(500,200,40)-F(500,200,40);

                                  0

Alec

First 51 52 53 54 55 56 57 Last Page 53 of 180