Ich habe ein Gleichungssystem wie folgt aus:Symbolische Lösung von Gleichungssystem Sympy Verwendung mit trivialen Lösungen abhängig von Symbolen
Für diesen spezifischen System, weiß ich, dass eine nicht-triviale Lösung (en) nur existiert wenn p1 == p2, das ist
Wie kann ich dies jedoch im allgemeinen Fall mit Sympy feststellen?
Für dieses Beispiel meine Implementierung wie folgt:
from sympy import Matrix, symbols, pprint, lcm, latex
from sympy.solvers import solve_linear_system
top_matrix = Matrix.zeros(8,7)
p1 = symbols("p1")
p2 = symbols("p2")
top_matrix[0,0] = 1
top_matrix[0,1] = -1
top_matrix[1,1] = (1-p1)
top_matrix[1,2] = -1
top_matrix[2,2] = 1
top_matrix[2,4] = p2-1
top_matrix[3,1] = p1
top_matrix[3,3] = -1
top_matrix[4,3] = 1
top_matrix[4,4] = -p2
top_matrix[5,4] = 1
top_matrix[5,5] = -1
top_matrix[6,1] = -1
top_matrix[6,6] = 1
top_matrix[7,4] = -1
top_matrix[7,6] = 1
pprint(top_matrix)
vars = symbols("a1, a2, a3, a4, a5, a6, a7, a8")
print solve_linear_system(top_matrix, *vars)
Das Ergebnis
None
ist Wenn ich
p2 = p1
das Ergebnis gesetzt ist
{a1: -1, a5: -1, a2: -1, a6: -1, a3: p1 - 1, a4: -p1}
Gibt es eine Möglichkeit, diese Anforderung automatisch zu entdecken?