I have two lists of linear equations:
list1 = {x - y == 0, x + 2y == 0, 3x - y == 0}
list2 = {-x + y == 0, -x - 2y == 0, 3x - y == 0, 3x - 2y == 0}
I want to check for intersections between these two lists of equations.
Clearly, x - y == 0
and -x + y == 0
represent the same equation, and x + 2y == 0
and -x - 2y == 0
also represent the same equation. However, if I compare them directly, they don't appear to be equal.
So, how can I find the intersecting equations?
The expected result would be something like this: {x - y == 0, x + 2y == 0, 3x - y == 0}
or their equivalent forms.
Simplify
to all of the equations you'll end up with each of them being in a canonical form. From there you could do direct comparisons. I'm not entirely sure if this is robust for all the cases you might need. $\endgroup$... == 0
, the problem would seem to be reducible to determining whether the polynomials on the LHSs are equivalent. For that, I think you can useCoefficientRules
. I'm not super familiar withCoefficientRules
, so there might be gotchas there as well. $\endgroup$SubtractSides /@ Intersection @@ Map[Simplify, {list1, list2}, 2]
$\endgroup$