FunctionRacerProblemsRace

Where It Crosses Zero

MediumSciPyPython

coeffs are the coefficients of a polynomial, highest power first ([1, 0, -2] is x**2 - 2). Between low and high the polynomial crosses zero exactly once, and its values at the two ends have opposite signs. Return the x where it is zero. Answers within 0.00001 of the right one are accepted.

Example 1

coeffs [1,0,-2]
low 0.0
high 2.0
returns 1.4142135623730951

x squared is 2 at the square root of 2.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More SciPy problems