6
$\begingroup$

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?

$\endgroup$
10
  • 1
    $\begingroup$ You know the VectorAngle[] function? $\endgroup$ Nov 10, 2012 at 3:01
  • 3
    $\begingroup$ 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]. $\endgroup$
    – VF1
    Nov 10, 2012 at 3:13
  • 1
    $\begingroup$ 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$... $\endgroup$
    – user484
    Nov 10, 2012 at 3:25
  • 3
    $\begingroup$ 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. $\endgroup$
    – m_goldberg
    Nov 10, 2012 at 4:16
  • 3
    $\begingroup$ @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... $\endgroup$ Nov 10, 2012 at 9:32

2 Answers 2

5
$\begingroup$

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})
$\endgroup$
1
  • $\begingroup$ of course you can make it much easier $\endgroup$ Nov 10, 2012 at 22:02
3
$\begingroup$

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}];
  ];
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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