[英]How to write a function which returns the total number of digits and single spaces
[英]How to write a function to count number of possible binary relations of 5 elements which are asymmetric and transitive
我有 5 个值:
A={1,2,3,4,5}
我考虑它们的二元关系,所以我有一个矩阵
1 2 3 4 5
1 (1,1) (1,2) (1,3) (1,4) (1,5)
2 (2,1) (2,2) (2,3) (2,4) (2,5)
3 (3,1) (3,2) (3,3) (3,4) (3,5)
4 (4,1) (4,2) (4,3) (4,4) (4,5)
5 (5,1) (5,2) (5,3) (5,4) (5,5)
当这些值不对称时,我如何计算这些值的所有可能组合(如果有(1,2),则不应该有(2,1)并且没有重复的(1,1),(2,2),。 ..) 和传递(fe 如果有 (2,3) 和 (3,5) 也应该有 (2,5))。 如何编写一个函数来计算这些关系的所有可能变化?
len(A)!
将为您提供没有对称组合但有重复的所有可能性,然后您可以减去重复的数量len(A)
(len(A))!-len(A)
方程可以简化为:
(len(A)-1)!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.