Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to find vertices (has integer coordinates) of the triangle $ABC$ with the centorid is $G(1,1)$ and orthocenter is $H(3,3)$. I tried

a = {x1, y1};
g = {1, 1};
h = {3, 3};
b = {x2, y2};
c = {x3, y3};
Solve[{x1 + x2 + x3 == 3 g[[1]], 
  y1 + y2 + y3 == 3 g[[2]], (h - a).(c - b) == 0, (h - b).(c - a) == 
   0, -20 < x1 < 20, -20 < y1 < 20, -20 < x2 < 20, -20 < y2 < 20, 
  x2*y3 - x1*y3 + x1*y2 - y2*x3 + y1*x3 - y1*x2 != 0}, {x1, y1, x2, 
  y2, x3, y3}, Integers]

enter image description here

There are some duplicate triangles. How to delete this duplicate triangles?

share|improve this question
    
You can Thread[a + b + c == 3 g] to relate the components of two separate lists more elegantly, not that this answer your question. Also Thread[-20 < a < 20], and Flatten[{a, b, c}]. –  BoLe Apr 23 '13 at 9:03

1 Answer 1

up vote 2 down vote accepted

I am not certain I understand, but starting with sols = Solve[ . . . ] does this help?:

{{x1, y1}, {x2, y2}, {x3, y3}} /. sols;

Union[Sort /@ %]
{{{-17, 7}, {7, -17}, {13, 13}},
 {{-11, 3}, {7, -9}, {7, 9}},
 {{-9, -3}, {3, 9}, {9, -3}},
 {{-9, 7}, {3, -11}, {9, 7}},
 {{-5, -5}, {1, 7}, {7, 1}},
 {{-3, -9}, {-3, 9}, {9, 3}},
 {{-3, 3}, {3, -3}, {3, 3}}}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.