You will write three functions: the tangent line to a curve at a point, the normal line at the same point, and the angle between two lines. A line is given as a pair (m, c) for . The checker tests several curves.
The idea. The gradient of the tangent is the derivative at the point. A computer can find it from a very short balanced interval, . The line has the point on it, so . The normal has gradient . The angle between two lines with gradients and satisfies .
Your tasks.
tangent_line(f, x0). Return (m, c), each rounded to 4 decimal places.normal_line(f, x0). Return (m, c) for the normal, rounded to 4 decimal places.angle_between(m1, m2). Return the acute angle in degrees, rounded to 2 decimal places.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…