## Sorting one list according to another list...

Hi

First question is, given a list of some positive integers, how can I normalize this list? Normalize here is in the sense that, for example, if

L := [1,3,4,4,5,7,7,7,8]

then there really are only 6 different integers appear, so I would like to assign each part an integer from 1 to 6 in ascending order. So 1 becomes 1, 3 becomes 2, 4 becomes 3, 5 becomes 4, 7 becomes 5 and so on. Normalized list will be

NormalizedL := [1,2,3,3,4,5,5,5,6]

Second question is given a list, let's say [1,3,1,3,2,2,4,4], how can I normalize it in a similar way but now we assign each integer upon occurrence of a part. So [1,3,1,3,2,2,4,4] will be [1,2,1,2,3,3,4,4]. This is necessary for me because lists have repeating parts.

Another example will be [2,4,4,1,2,2,3,3] will be [1,2,2,3,1,1,4,4].

Thank you

## Sorting one list based on another...

If L is a list [a,c,b,d,f,e]

S is a list [b,c,f,e]

I want to use the permutation opf S to rearrange L [b,c,f,e,a,d]

In my case a,b,c,d,e,f are equations.

## Is it possible to create a mapping ...

from permutation group to permutation group and inverse this mapping?

how to do?

## How to find these products?...

assume not starting from resolvent of quartic,

how to find [[1,2],[3,4]] and [[1,3],[2,4]] and [[1,4],[2,3]] ?

a1*a2 + a3*a4 if [[1,3,2,4],[1,2]]

a1*a3 + a2*a4 if [2,3][[1,3,2,4],[1,2]]

a1*a4 + a2*a3 if [2,4],[[1,3,2,4],[1,2]]

moreover, i use multiplication of permutation group can not multiply below

though i know how to operate multiplication by hand, i follow the syntax to do multiplication, seems not the way

with(group):
mulperms([[2,3]], [[1,3,2,4],[1,2]]);
mulperms([[1,3,2,4],[1,2]], [[2,3]]);

mulperms([2,3], [[1,3,2,4],[1,2]]);
mulperms([[1,3,2,4],[1,2]], [2,3]);

## Apply permutation to a list...

How would you apply a permutation to a list?

So, with permutation [[1,3],[2,4]], given in disjoint cycles,

how would you apply it to [1,2,3,4] to obtain [3,4,1,2]?

Thanks

## Generating all permutation of an array...

Hi,

Excuse me, I have the following code

###########################

with(combinat);
with(LinearAlgebra);
f:=([1,2,3]);
permute(f);

n:=3;
g:=array(1..n);

for i from 1 to n do
g[i]:=i;
end do;

permute(g);

###########################

The output ends up with

Error, (in combinat:-permute) 1st argument must be a list, set or a non-negative integer

It seems that maple will not generate permutation of g... How to generate the permutation of array g? i.e. by assigning all variables automatically.

Thank you very much!

## Problem with Shuffle/Randomize...

Hi there, this is my first post in this forum. I hope you can help me with my problem :)

I've created a little program to solve a problem for my class. This is the first time, I wrote a program with Maple, so please don't laugh.

I've posted the Maple code below:

restart; randomize():
with(plots): with(plottools): with(LinearAlgebra): with(Statistics): with(MTM):

s:={1=2, 3=2}:

Realisierung:=proc(np,volfrac)

h:=1;
for m from 1 to np do
if(omega[m]=0) then
h:=h+1;
end if
od;

randomize():

for m from 1 to volfrac*np do
od:

for m from 1 to np -(volfrac*np+nops(s)) do
od:

omega;

end:

RealMatrix:=proc(np,nr,volfrac)

local m, alle:

alle:=Matrix(nr,np); for m from 1 to nr do

randomize();

alle[m]:=Realisierung(np,volfrac); od;

alle;

end:

RealMatrix(5,5,0.4);

I used the Shuffle function from Statistics-package to randomly permutate the components in the Vector adresses. Which works fine. By setting Randomize(); I get randomly results vor this permutation, when I execute the whole worksheet.

But when the "Realisierung" procedure is called in the for loop of the "RealMatrix" procedure, always the same Permutation is calculated.

This leads to the fact, that every row in my matrix looks the same.
Like in the example

2 1 2 2 1
2 1 2 2 1
2 1 2 2 1
2 1 2 2 1
2 1 2 2 1

but the lines should be randmly like

2 1 2 2 1
2 2 2 1 1
2 1 2 1 2
2 1 2 2 1
.....

Obvioulsy the problem is in the randomize()-command. I tried to place it directly after "restart" and directly before the Shuffling is executed.

Maybe one of you can help me?
Would be great!
Thanks

## Algorithm for checking permutations ...

Hi all

Can anybody suggest an algorithm allowing to detect, that two matrices of the same size can be obtained each from other by permutations of rows and columns? Maybe, such an algorithm there exists in LinearAlgebra package?

## The Burnside legacy

by:

Greetings to all.

It is a new year (for some time now) and I am writing to indicate that the mathematical adventures with cycle index computations and Maple continue!

Here are the previous installments:

My purpose this time is to alert readers who might be interested to a new cycle index computation that is neither an application of the classical form of the Polya Enumeration Theorem (PET) nor of Power Group Enumeration. The former counts objects being distributed into slots with a group acting on the slots and the latter objects going into slots with a second group which permutes the objects in addition to the slots being permuted. What I am about to present treats a third possible case: when the slot permutation group and the object permutation group are one and the same and act simultaneously (not exactly the same but induced by the action of a single group).

This requires quite radical proceedings in the etymological sense of the word, which is to go back to the roots of a problem. It seems that after working with the PET sooner or later one is confronted with enumeration problems that demand the original unmitigated power of Burnside's lemma, sometimes called the lemma that is not Burnside's. This is the case with the following problem. Suppose you have an N-by-N matrix whose entries are values from 1 to N, with all assignments allowed and the symmetric group on N elements acts on the row and column indices permuting rows and columns as well as the entries simultaneously. We ask how many such matrices there are taking these double symmetries into account. This also counts the number of closed binary operations on a set of N elemnents and there is a discussion as well as the Maple code (quite simple in my opinion and no more than a few lines) that solves this problem at the following Math Stackexchange link, which uses Lovasz Formula for the cycle index of the symmetric group which some readers may remember.

In continuing the saga of Polya and Burnside exploration I have often reflected on how best to encapsulate these techniques in a Maple package. With this latest installment it would appear that a command to do Burnside enumeration probably ought to be part of such a package.

Best regards,

Marko Riedel

## Power Group Enumeration with Maple.

by:

Greetings to all.

This past year I have on occasion shared mathematical adventures with cycle index computations and Maple, e.g. at these links:

Befitting the season I am sending another post to continue this series of cycle index computations. I present two Maple implementations of Power Group Enumeration as described by Harary and Palmer in their book "Graphical Enumeration" and by Fripertinger in his paper "Enumeration in Musical Theory." It was a real joy working with Maple to implement the computational aspects of their work, i.e. the Power Group Enumeration Theorem. Moreover the resulting software is easy to read, simple and powerful and has a straightforward interface, taking advantage of many different capabilities present in Maple.

The problem I am treating is readily described. Consider a cube in 3 space and its symmetries under rotation, i.e. rigid motions. We ask in how many different ways we may color the edges of the cube with at most N colors where all colors are completely interchangable, i.e. have the symmetric group acting on them in addition to the edge permutation group of the cube. At the following Math Stackexchange Link  I have posted the Maple code to implement the algorithms / formulas of Harary / Palmer / Fripertinger to solve this problem. The reader is invited to study and test these algorithms. It seems to me an excellent instance of computational combinatorics fun.

To conclude I would like to point out that these algorithms might be candidates for a Polya Enumeration Theorem (PET) package that I have been suggesting for a future Maple release at the above posts, the algorithms being of remarkable simplicity while at the same time providing surprisingly sophisticated combinatorics and enumeration methods.

Season's greetings!

Marko Riedel

## Error, (in combinat:-permute) 1st argument must be...

with(combinat):
list1 := permute([a, b, a, b, a, b], 3);
list1a := subs(b=1,subs(a=0, list1));
list1a := permute([seq(seq(k,k=0..1),k2=1..3)], 3);
list2 := permute([a, b, c, d, e, f, g, h, a, b, c, d, e, f, g, h, a, b, c, d, e, f, g, h], 3);
list3 := subs(h=18,subs(g=17,subs(f=16,subs(e=15,subs(d=14,subs(c=13,subs(b=12,subs(a=11,list2))))))));
list3 := permute([seq(seq(k,k=11..18),k2=1..3)], 3);
list5 := Matrix(nops(list1a)*nops(list3), 1);
count := 1;
for n from 1 to nops(list3) do
temp1 := subs(1=list1a[1],list3[n]);
for k from 11 to nops(list1a)+10 do
temp1 := subs(k=list1a[k-10],temp1);
od;
list5[count] := temp1;
count := count + 1;
od;
list6 := permute(list5, 2);

Error, (in combinat:-permute) 1st argument must be a list, set or a non-negative integer

## binomial combination factorial but permutation fac...

Just a simple question.

If you have 10 objects and you choose 6 and order doesn't matter,

binomial(10,6)

210

binomial(n,r);

/  n    \
...