You will write the rule for the sum of two inverse tangents, the rule for the difference, and a function that finds the acute angle between two lines from their slopes. The checker compares your answers with the values from atan.
The idea. is when . When you add if and subtract if . When the sum is . The difference is the sum with replaced by .
Your tasks.
atan_sum(x, y). Use the three cases of the rule. Do not use atan(x) + atan(y).atan_diff(x, y). Call atan_sum with -y.acute_angle(m1, m2). Two lines with slopes m1 and m2 make the angle abs(atan_diff(m1, m2)) or its supplement. Return the one that is at most .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…