HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Labs
  2. /Ptolemy and Brahmagupta on a circle
MathematicsHardHigh School (11–12)Euclidean Geometry

Ptolemy and Brahmagupta on a circle

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 α\alphaα and β\betaβ on a circle of radius RRR has length 2Rsin⁡∣α−β∣22R\sin\dfrac{|\alpha - \beta|}{2}2Rsin2∣α−β∣​. 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.

  1. Finish chord(R, a, b). Return the length of the chord between the angles a and b (in degrees).
  2. Finish ptolemy_gap(R, angles). For four angles in order, return AC * BD - (AB * CD + AD * BC).
  3. Finish brahmagupta(a, b, c, d). Return the area of a cyclic quadrilateral with these sides.

Run it first, just as it is. The checker at the end prints FAIL for each task. Then do the tasks one at a time, and run the program again after each one. A Hint appears under every check that still fails.

When every line says PASS, try the angles [0, 72, 144, 216], four corners of a regular pentagon. What does the ratio of a diagonal to a side come to?

StemPy LabContributed by StemPy Lab
python
Loading Python runtime…

A worked solution

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 save
← All Labs
← Power, tangent and radical axisSolving a triangle →
More onEuclidean Geometry

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Ptolemy's theorem and Brahmagupta's formulaPower of a Point, Cyclic Quadrilaterals and Ptolemy

More labs on this topic

  1. The Euler line on coordinatesHard
All labs on this topic →