|
NEXT EQUIVALENCE RELATIONName:
For example, if n = 3, then there are 5 possible partitions:
{1,2} {3} {1, 3} {2} {2, 3} {1} {1} {2} {3} The output of this command is an array of size n where the ith element identifies the class which i belongs to. For example, the following array (for n = 5)
identifies the partition
A partition of a set is identical with an equivalence relation on the set with the Ti as the equivalence classes.
where <n> is a number or parameter that specifies the size of the original set; <yp> is a variable that contains the number of elements in the ith classs of the output partition; and <y> is a variable where the equivalence relation is saved. This syntax is used to return the first equivalence relation in the sequence of equivalence relation. The <yp> values are not of primary interest. They are returned because the current values of this array are needed in computing the next equivalence relation in the sequence.
where <n> is a number or parameter that specifies the size of the original set; <yprev> is a variable that contains the most recently generated values for the given value of <n>; <ypold> is a variable that contains the most recently generated values for the <yp> variable; <yp> is a variable that contains the number of elements in the ith classs of the output partition; and <y> is a variable where the equivalence relation is saved. This syntax is used to return the all equivalence relations in the sequence of equivalence relations after the first equivalence relation has been generated. The <yp> values are not of primary interest. They are returned because the current values of this array are needed in computing the next equivalence relation in the sequence.
LET Y = NEXT EQUIVALENCE RELATION
LET N = 5 SET WRITE REWIND OFF WRITE EQUIVALENCE.OUT "EQUIVALENCE RELATIONS FOR N = 5" LET Y YP = NEXT EQUIVALENCE RELATION N LET YPREV = Y LET YPOLD = YP WRITE EQUIVALENCE.OUT "EQUIVALENCE RELATION 1:" WRITE EQUIVALENCE.OUT Y WRITE EQUIVALENCE.OUT " " WRITE EQUIVALENCE.OUT " " LET NUMEQUIV = 1 LOOP FOR K = 2 1 100 LET NUMEQUIV = NUMEQUIV + 1 . LET Y YP = NEXT EQUIVALENCE RELATION N YPREV YPOLD LET Y YP = NEXT EQUIVALENCE RELATION N YPREV YPOLD WRITE EQUIVALENCE.OUT "EQUIVALENCE RELATION ^K:" WRITE EQUIVALENCE.OUT Y WRITE EQUIVALENCE.OUT " " WRITE EQUIVALENCE.OUT " " DELETE YPREV YPOLD LET YPREV = Y LET YPOLD = YP DELETE Y YP IF LASTSEQU = 1 BREAK LOOP END OF IF END OF LOOP WRITE EQUIVALENCE.OUT "NUMBER OF EQUIVALENCE RELATIONS: ^NUMEQUIV"The file EQUIVALENCE.OUT contains
Date created: 1/21/2009 |