You will test Ptolemy's theorem and Brahmagupta's formula on four points of a circle. The points are given by their angles in degrees.
The idea. A chord between the angles and on a circle of radius has length . For corners in order round the circle, Ptolemy says that the product of the diagonals equals the sum of the products of opposite sides.
Your tasks.
chord(R, a, b). Return the length of the chord between the angles a and b (in degrees).ptolemy_gap(R, angles). For four angles in order, return AC * BD - (AB * CD + AD * BC).brahmagupta(a, b, c, d). Return the area of a cyclic quadrilateral with these sides.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…