top of page
CPMSE Worked Examples
LAW OF COSINES
The four sided figure consists of two triangles having a common side a.
The law of cosines states that for the top triangle
and a similar equation can be written for the bottom triangle.
Test Cases
Think of some tests you could devise to check your algorithm.
-
Does your script file pass these tests?
-
Consider that there is a case where there is no correct answer. When does this arise what does your code do in this case?
-
Consider that there is a case where there is more than one correct answer. When does this arise what does your code do in this case?
Develop a procedure forcomputing the length of side c2 if you are given the lengths of sides b1, b2 and c1 andthe angles A1 and A2 in degrees. Write a script file (M-file) to implement this procedure.
bottom of page