Question: Theorem of cosine

I want to make triangle oAB with the angle AoB equal to 2*Pi/3. The following code is not right.

> restart:

N:=10:

 

L:=[]:

 

for x1 to N do

 

for y1 from x1 to N do

 for z1 from y1 to N do

 for x2 to N do

 for y2 to N do

 for z2 to N do

 a:=sqrt(x1^2+y1^2+z1^2):

b:=sqrt(x2^2+y2^2+z2^2):

c:=sqrt(a^2+b^2-2*a*b*cos(2*Pi/3)):

if type(a, positive) and type(b, positive) and type(c, positive)  and c=sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2) then L:=[op(L), {[0, 0, 0], [x1, y1, z1], [x2, y2, z2]}]: fi:

 od: od: od: od: od: od:

 nops(L);

 L:

 

 Please help me. Thank you

Please Wait...