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.

The measure of the interior angles of a triangle are $15^\circ$, $30^\circ$, $135^\circ$ and the length of one edge is 3. In order to determine the length of the remaining two edges, I've tried

a := 3; 
eq1 := (a^2 + b^2 - c^2)/(2*a*b); 
eq2 := (b^2 + c^2 - a^2)/(2*b*c);
eq3 := (c^2 + a^2 - b^2)/(2*a*c); 
Solve[{eq1 == Cos[15 Degree], eq2 == Cos[30 Degree], eq3 == Cos[135 Degree]}, {b,c}]
(*
{{b -> 3 Sqrt[2], c -> (3 (3 Sqrt[2] - 2 Sqrt[6]))/(-3 + Sqrt[3])}}
*)

And

Solve[{x^2 + y^2        == (3 Sqrt[2])^2, 
       (x - 3)^2 +  y^2 == ((3 (3 Sqrt[2] - 2 Sqrt[6]))/(-3 + Sqrt[3]))^2}, {x, y}]
(*
{{x -> (3 (1 - Sqrt[3]))/(2 (-2 + Sqrt[3])), 
  y -> -3 Sqrt[(26 - 15 Sqrt[3])/(2 (7 - 4 Sqrt[3]))]}, 
 {x -> (3 (1 - Sqrt[3]))/(2 (-2 + Sqrt[3])), 
  y -> 3 Sqrt[(26 - 15 Sqrt[3])/(2 (7 - 4 Sqrt[3]))]}}
*)

By putting A := {0, 0, 0}, B := {3,0, 0} and

C := {(3 (1 - Sqrt[3]))/(2 (-2 + Sqrt[3])), 3 Sqrt[(26 - 15 Sqrt[3])/(2 (7 - 4 Sqrt[3]))], 0}

Are the measure of the angles of the triangle $ABC$ $15^\circ$, $30^\circ$, $135^\circ$?

How do I tell Mathematica to do that?

share|improve this question
1  
You know the VectorAngle[] function? –  J. M. Nov 10 '12 at 3:01
3  
VectorAngle, if you look at the docs, gives the angle between two vectors. For vertices A, B, C, the two vectors surrounding A are B-A and C-A. Try VectorAngle[B-A, C-A]. –  VF1 Nov 10 '12 at 3:13
1  
By the way, it is not true that a triangle with vertices at $(0,0)$, $(a,0)$, and $(b,c)$ has edge lengths $a$, $b$, and $c$... –  Rahul Nov 10 '12 at 3:25
3  
I've used Mathematica for 15 years and I didn't know VectorAngle existed. I see it was added in ver. 6. Had I known about it in the past, I could have made good use of it. Will certainly be using it now. –  m_goldberg Nov 10 '12 at 4:16
3  
@István, feel free to expand on it if you wish, though I was hoping OP would try to help himself this time and read the bloody docs... –  J. M. Nov 10 '12 at 9:32

2 Answers 2

up vote 4 down vote accepted

This is a way to get all possible solutions at once:

d = Degree; Solve /@ (a/Sin[15 d] == b/Sin[30 d] == c/Sin[135 d] /. {# -> 3} & /@ {a, b, c})
share|improve this answer
    
of course you can make it much easier –  belisarius Nov 10 '12 at 22:02

Use the law of sines, which states that the ratio of the sine of an angle to the length of the side opposite that angle is the same for all three angles. This will give three possible solutions because, as the question states, the known side could be located opposite from any of the three angles.

Proper application of the law of sines will also simplify your code quite a bit.

Here's how you might go about doing this:

(*angles given in the problem*)
angles = {15, 30, 135};

(*convert to radians*)
anglesRad = angles*Pi/180;

(*for each orientation*)
For[i = 1, i <= 3, i++,

  (*use law of sines to calculate each side*)
  side1 = 3;
  side2 = side1*Sin[anglesRad[[2]]]/Sin[anglesRad[[1]]];
  side3 = side1*Sin[anglesRad[[3]]]/Sin[anglesRad[[1]]];

  (*get the next orientation*)
  anglesRad = RotateLeft[anglesRad];

  (*print results*)
  Print[{side1, side2, side3}];
  ];
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.