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. /The circle of Apollonius
MathematicsHardHigh School (11–12)Coordinate Geometry

The circle of Apollonius

You will build the circle PA=λ PBPA = \lambda\,PBPA=λPB from the two points that divide ABABAB in the ratio λ:1\lambda : 1λ:1, and then test it.

The idea. The internal division point is A+λB1+λ\dfrac{A + \lambda B}{1 + \lambda}1+λA+λB​ and the external one is λB−Aλ−1\dfrac{\lambda B - A}{\lambda - 1}λ−1λB−A​, worked out one coordinate at a time. They are the ends of a diameter.

Your tasks.

  1. Finish divide(A, B, lam, outside). Return the internal point when outside is False, and the external one when it is True.
  2. Finish apollonius(A, B, lam). Return (centre, radius) from the two division points.
  3. Finish ratio_at(P, A, B). Return PAPB\dfrac{PA}{PB}PBPA​, using math.dist.

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 λ=12\lambda = \tfrac{1}{2}λ=21​ with the same AAA and BBB. Which point does the circle surround now?

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
← Loci of squared distancesShifting the origin →
More onCoordinate Geometry

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Circles of Apollonius and other classic lociLoci in the Coordinate Plane

More labs on this topic

  1. Polar points in PythonHard
  2. Turning the axesHard
  3. Shifting the originHard
  4. Loci of squared distancesHard
All labs on this topic →