Write a short Python program to perform the bisection method for root finding.
- User
Write a short Python program to perform the bisection method for root finding.
Assistant
def root_finder(f, a, b): root = float('NaN') while True: root = (a + b)/2.0 if f(root): return root if abs(root - a)/root > 1.0: b = root else: a = root
return Nonedef f(x): return x*x - 3
root_finder(f, 1, 100)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.