How can I eliminate equivalent equations from a list?
One possible way is to filter your list afterwards and delete duplicates of answers. Two answers are equal when their coefficients {a,b,c,d}
are linear dependent. So when you have two vectors which are linear dependent, their normalized versions v1
and v2
are either equal or they are ones negative: v1==-v2
.
You can use DeleteDuplicates
with the above rule:
SetSystemOptions[
"ReduceOptions" -> "ExhaustiveSearchMaxPoints" -> {10000, 100000}];
Clear[n, M];
n = {a, b, c};
M = {1, 2, 3};
sol = Solve[{Abs[n . M + d]/Norm[n] == 2,
1 <= a <= 10, -5 <= b <= 10, -5 <= c <= 10, a > b > c}, {a, b, c,d }, Integers]
TraditionalForm[Simplify[a x + b y + c z + d == 0]] /.
DeleteDuplicates[sol,
With[{v1 = Normalize[{a, b, c, d} /. #1],
v2 = Normalize[{a, b, c, d} /. #2]},
v1 == v2 || v1 == -v2] &]
This gives only 32 of your 38 original solutions and the two equations you mentioned are reduced to the second one.
I would recommend Reduce
and EuclideanDistance
function.
r = Reduce[ a x + b y + c z + d == 0 && EuclideanDistance[{1, 2, 3}, {x, y, z}] == 2,
{a, b, c, d}, Integers]
(a | b | c | d) ∈ Integers && ( (z == 1 && y == 2 && x == 1 && d == -a - 2 b - c) || (z == 3 && ((y == 0 && x == 1 && d == -a - 3 c) || (y == 2 && ((x == -1 && d == a - 2 b - 3 c) || (x == 3 && d == -3 a - 2 b - 3 c))) || (y == 4 && x == 1 && d == -a - 4 b - 3 c))) || (z == 5 && y == 2 && x == 1 && d == -a - 2 b - 5 c))
Then e.g. having set an appropriate SetSystemOptions
Normal @ Solve[1 <= a <= 5 && -5 <= b <= 5 && -5 <= c <= 5 && a > b > c && r,
{a, b, c, d}, Integers]
then migt be a need for e.g. Factor
and DeleteDuplicates
.