How to resolve the algorithm Law of cosines - triples step by step in the Phix programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Law of cosines - triples step by step in the Phix programming language

Table of Contents

Problem Statement

The Law of cosines states that for an angle γ, (gamma) of any triangle, if the sides adjacent to the angle are A and B and the side opposite is C; then the lengths of the sides are related by this formula: For an angle of of   90º   this becomes the more familiar "Pythagoras equation": For an angle of   60º   this becomes the less familiar equation: And finally for an angle of   120º   this becomes the equation:

Note: Triangles with the same length sides but different order are to be treated as the same.

Let's start with the solution: