ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 20 Sep 2022 06:47:18 +0200Forming Combinations with conditionshttps://ask.sagemath.org/question/64104/forming-combinations-with-conditions/Suppose B is a finite collection of distinct square matrices of nth order.
And , A a subcollection of B.
I want unique combinations of four distinct elements -three from A and one from B.
I tried this
X=Combinations(A,3)
Y=Combinations(B,1)
for i in range(len(X)):
for j in range(3):
for k in range(len(Y)):
if ((X[i])[j])!=(Y[k]):
show(X[i]+Y[k])
I know problem is with my "if" command.
My question is how to change the “if” command so that none of the matrices in X[i] equals Y[k], so that we get distinct matrices in a combination.
Further, how to get unique combinations.
Thanks.
sgmthTue, 20 Sep 2022 06:47:18 +0200https://ask.sagemath.org/question/64104/