Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: There must be a better way.
Replies: 3   Last Post: Aug 22, 2010 8:14 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steve Gray

Posts: 103
Registered: 7/6/07
There must be a better way.
Posted: Aug 19, 2010 7:19 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

pts = 5;
angx = Flatten[
Table[Join[{j},
Subsets[Cases[Range[pts],Except[j]],{2}][[i]]],{j,
pts},{i,(pts-1)(pts-2)/2}],1]

which if pts=4 gives

{{1, 2, 3}, {1, 2, 4}, {1, 3, 4},
{2, 1, 3}, {2, 1, 4}, {2, 3, 4},
{3, 1, 2}, {3, 1, 4}, {3, 2, 4},
{4, 1, 2}, {4, 1, 3}, {4, 2, 3}}

and for pts=5 prints:

{{1, 2, 3}, {1, 2, 4}, {1, 2, 5}, {1, 3, 4}, {1, 3, 5}, {1, 4, 5},
{2, 1, 3}, {2, 1, 4}, {2, 1, 5}, {2, 3, 4}, {2, 3, 5}, {2, 4, 5},
{3, 1, 2}, {3, 1, 4}, {3, 1, 5}, {3, 2, 4}, {3, 2, 5}, {3, 4, 5},
{4, 1, 2}, {4, 1, 3}, {4, 1, 5}, {4, 2, 3}, {4, 2, 5}, {4, 3, 5},
{5, 1, 2}, {5, 1, 3}, {5, 1, 4}, {5, 2, 3}, {5, 2, 4}, {5, 3, 4}}

and for pts=6 gives

{{1,2,3},{1,2,4},{1,2,5},{1,2,6},{1,3,4},{1,3,5},{1,3,6},{1,4,5},{1,4,6},{1,
5, 6},
{2,1,3},{2,1,4},{2,1,5},{2,1,6},{2,3,4},{2,3,5},{2,3,6},{2,4,5},
{2,4,6},{2,5,6},
{3,1,2},{3,1,4},{3,1,5},{3,1,6},{3,2,4},{3,2,5},{3,2,6},{3,4,5},
{3,4,6},{3,5,6},
{4,1,2},{4,1,3},{4,1,5},{4,1,6},{4,2,3},{4,2,5},{4,2,6},{4,3,5},
{4,3,6},{4,5,6},
{5,1,2},{5,1,3},{5,1,4},{5,1,6},{5,2,3},{5,2,4},{5,2,6},{5,3,4},
{5,3,6},{5,4,6},
{6,1,2},{6,1,3},{6,1,4},{6,1,5},{6,2,3},{6,2,4},{6,2,5},{6,3,4},
{6,3,5},{6,4,5}}

pts will be in the range of 4-20 or so. Speed of this operation is not
really critical.

The first entry in each list item ranges from 1 to pts. For any given
value of it, the other two entries are the subsets of Range excluding
the first entry. Seems simple but my solution is not.

Thank you for any tips.

Steve Gray






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.