You will write three functions that change points between the two coordinate systems. The checker uses points in every quadrant.
The idea. From polar to rectangular, and . From rectangular to polar, , and the angle must have the right quadrant. The cosine rule gives the distance between two polar points without changing coordinates.
Your tasks.
to_rect(r, theta). Return the pair (x, y).to_polar(x, y). Return (r, theta) with r not negative and theta from up to (not including) .polar_distance(r1, t1, r2, t2). Return the distance from the cosine rule.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…