lettie079

35 Reputation

7 Badges

11 years, 350 days

MaplePrimes Activity


These are questions asked by lettie079

Hi,

 

I have a list of sets eg. L:=[{a},{b,c},{d,a,f},{b,d}] and I'm having problems doing operations on it. 

I want to be able to take the first element (a here), look for the next occurrence of it and return what is in the set with it (here d and f).

However I can't seem to use Search or Occurrences as they consider the sets themselves to be the elements. For instance Search(a, L) returns 0. 

 

What can I do?

Hi,

I'm trying to generate all the possible combinations of each M[i] according to the possible values for c,d and e. The code I have here generates some of them but not all - it misses out the combinations when the two or three elements in the square brackets are different ie. 

it generates
[{1}, [{1}, {1}], [{1}, {1}, {1}]]               
[{1}, [{2}, {2}], [{2}, {2}, {2}]]             

What's wrong with my loop? It works fine if no_legs is set to 3, but when it is set to 2 or 4 it doesn't work (as in the picture). The code is to list combinations, as in http://www.mapleprimes.com/questions/149475-How-Do-I-Create-Combinations-According. I'm really stuck. Thank you for any help!

I'm very new to Maple and can't figure out how to do this:

I have these possibilities:

for 1 - [1],[2],[3]

for 2 - [1,2],[2,1],[1,3],[3,1],[2,3],[3,2]

for 3 - [1,2,3],[2,3,1],[3,1,2],[3,2,1],[2,1,3],[1,3,2]

and I want to find all the possible combinations when they are in, say, the order of [3,2,1]

eg.

[[1,2,3],[1,2],[1]],

[[1,2,3],[1,2],[2]],

[[1,2,3],[1,2],[3]], 

[[1,2,3],[2,1],[1]]

1 2 Page 2 of 2