40 Reputation

4 Badges

3 years, 339 days

MaplePrimes Activity

These are questions asked by sikjw1305


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 


Given two lists I and J of the same size, how can we find all perfect mathings of two lists? 

In other way, how can we find all pairing of elements of I and J? 

For exapmle, given I = [1,2,3] and J = [4,5,6], i would like to get 

[[1,4],[2,5],[3,6]], [[1,4], [2,6],[3,5]], [[1,5],[2,4],[3,6]], [[1,5],[2,6],[3,4]], [[1,6],[2,4],[3,5]], [[1,6],[2,5],[3,4]]

I can see how I can use the permutation of one list and match component-wise in order will do it, but would there be more efficient way to complete  the task? 

Ultimately, I would like do this for a list of lists, that is, for example,

I = [[3,5],[6,7,9,12]] and J = [[8,10], [1,2,4,11]] then I would like to get 

[[3,8],[5,10],[6,1],[7,2],[9,4],[12,11]] and by the above example, get 24 of product of disjoint cycles like such.


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]?




So given a list [ [ [1,2], [2,1] ], [ [3,4], [4,3] ], [ [5] ] ],

I would like to produce a list 

[ [1,2,3,4,5], [1,2,4,3,5], [2,1,3,4,5], [2,1,4,3,5] ]


so it makes a combination of sublist of every lists in the given list

is there a way to do it ?



Hi I am not very used to Maple since I used mathematica previously.

So is there way to put an if statement within sequecne definition? that is,


id = 1;

seq(if(i>2, idx += 1), idx+i , i=1..10)


something like this where if statement runs and then idx+i is added to the sequence, as if I am running a loop.


1 2 Page 1 of 2