Reputation: 392
I have 60 equations with 70 variables. all of them are in one list:
(x0,x1,...,x239) are sympy symbols
list_a = [Xor(Not(x40), Not(x86)), Xor(x41, Not(x87)), ...]
and my question is, if it is possible somehow transform this equations to matrix or solved them. I think, that it can have more than one solution.
Upvotes: 2
Views: 1387
Reputation: 91610
A solution to a system of logic expressions is the same as checking SAT for the conjunction (And) of the expressions.
In [3]: list_a = [Xor(Not(x40), Not(x86)), Xor(x41, Not(x87))]
In [4]: list_a
Out[4]: [¬x₄₀ ⊻ ¬x₈₆, x₄₁ ⊻ ¬x₈₇]
In [5]: satisfiable(And(*list_a))
Out[5]: {x87: False, x40: True, x86: False, x41: False}
If you want all solutions you can pass all_models=True
, although note that in the general case there are exponentially many solutions.
Upvotes: 2