6

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?

Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
minthao_2011
  • 4,503
  • 3
  • 31
  • 46

2 Answers2

5

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})
Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
3

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}];
  ];
cartonn
  • 1,005
  • 6
  • 15