1
$\begingroup$

I am trying to find six integer numbers a, b, c, x, y, z so that the angle of two vector {a, b, c and {x, y, z} equal to Pi/6. I tried

Clear[a, b, c]
u = {x, y, z};
v = {a, b, c};
list = {u, v} /. 
   Solve[{4*(a*x + b*y + c*z)^2 == 
      3*(a^2 + b^2 + c^2)*(x^2 + y^2 + z^2), a b c x y z != 0, a > x, 
     0 < a*x + b*y + c*z, GCD[a, b, c] == 1, GCD[x, y, z] == 1, 
     Sequence @@ Thread[0 < {a, b, c, x, y, z} < 15]}, {x, y, z, a, b,
      c}, Integers];
Select[list, (6 == Length[Union @@ #] &)]

If I use

Sequence @@ Thread[0 < {a, b, c, x, y, z} < 9]}

I got

{{{1, 2, 7}, {4, 3, 5}}, {{1, 3, 4}, {5, 2, 7}}, {{1, 4, 3}, {5, 7, 2}}, {{1, 7, 2}, {4, 5, 3}}, {{1, 7, 8}, {3, 2, 5}}, {{1, 8, 7}, {3, 5, 2}}, {{2, 1, 7}, {3, 4, 5}}, {{2, 3, 5}, {7, 1, 8}}, {{2, 5, 3}, {7, 8, 1}}, {{2, 5, 7}, {3, 1, 4}}, {{2, 7, 1}, {3, 5, 4}}, {{2, 7, 5}, {3, 4, 1}}, {{4, 1, 3}, {7, 5, 2}}, {{4, 3, 1}, {7, 2, 5}}, {{5, 2, 3}, {8, 7, 1}}, {{5, 3, 2}, {8, 1, 7}}, {{5, 3, 4}, {7, 2, 1}}, {{5, 4, 3}, {7, 1, 2}}}

The time is longer If I use

Sequence @@ Thread[0 < {a, b, c, x, y, z} < 15]}

How can I reduce timing?

$\endgroup$
4
  • $\begingroup$ Your results have an angle of Pi/6 not Pi/3. You should use 2 and 1 as coefficients rather than 4 and 3. $\endgroup$ – Daniel Huber Mar 12 at 11:46
  • $\begingroup$ Thank you very much. $\endgroup$ – minhthien_2016 Mar 12 at 11:53
  • $\begingroup$ @DanielHuber I think 4 and 1 as coefficients rather than 4 and 3 (if angle of Pi/3). $\endgroup$ – minhthien_2016 Mar 12 at 12:32
  • $\begingroup$ Yes, you are right it of Cos[]^2 not Cos[] $\endgroup$ – Daniel Huber Mar 12 at 12:44
0
$\begingroup$

If you can allow an upper limit for the components, we may simply check all possibilities. As the angle of Pi/3 is less than Pi, we may restrict the search to one quadrant. Further solutions may be obtained by reflection at the coordinate planes.

n = 10;
res = Reap[
   Do[
    If[4 ({j1, j2, j3}.{i1, i2, i3})^2 == {i1, i2, i3}.{i1, i2, 
         i3} {j1, j2, j3}.{j1, j2, j3}, Sow[{i1, i2, i3, j1, j2, j3}]]
    , {i1, n}, {i2, n}, {i3, n}, {j1, n}, {j2, n}, {j3, n}]
   ][[2, 1]]

This results in:

enter image description here

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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