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. /Turning the axes
MathematicsHardHigh School (11–12)Coordinate Geometry

Turning the axes

You will write three functions for a turn of the axes through an angle given in degrees.

The idea. New from old: X=xcos⁡θ+ysin⁡θX = x\cos\theta + y\sin\thetaX=xcosθ+ysinθ and Y=−xsin⁡θ+ycos⁡θY = -x\sin\theta + y\cos\thetaY=−xsinθ+ycosθ. The new coefficients of ax2+2hxy+by2ax^2 + 2hxy + by^2ax2+2hxy+by2 are a′=aC2+2hSC+bS2a' = aC^2 + 2hSC + bS^2a′=aC2+2hSC+bS2, h′=(b−a)SC+h(C2−S2)h' = (b - a)SC + h(C^2 - S^2)h′=(b−a)SC+h(C2−S2) and b′=aS2−2hSC+bC2b' = aS^2 - 2hSC + bC^2b′=aS2−2hSC+bC2. The term in XYXYXY goes when tan⁡2θ=2ha−b\tan 2\theta = \dfrac{2h}{a - b}tan2θ=a−b2h​.

Your tasks.

  1. Finish turn_point(x, y, deg). Return (X, Y).
  2. Finish new_coeffs(a, h, b, deg). Return (a2, h2, b2).
  3. Finish remove_xy(a, h, b). Return the angle in degrees, using math.atan2(2 * h, a - b) / 2.

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, use your functions on 2x2+6xy+10y22x^2 + 6xy + 10y^22x2+6xy+10y2. Which angle removes the term in xyxyxy, and what are the new coefficients?

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
← Shifting the originPolar points in Python →
More onCoordinate Geometry

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Rotating the axesTranslation and Rotation of Axes

More labs on this topic

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