Question: Complete the question using while- loop for- loop then recursion if possible The secant method uses two numbers to approximate the root, the two numbers
The secant method uses two numbers to approximate the root, the two numbers being endpoints of a line whose intercept approximates. The graphic shows one of the circumstances (there are two, but it's not necessary for the implementation here). (n f() 72 T1 * To Figure 3: The root is r. We use two points, ro,ri to determine r2 which is the approximation to r* The recurrence is: f(xn)-f(xn-1) Although the recurrence looks a little intimidating, the code is actually minimal! secant.py 1 def secant(f,x0, x1,tau) # TODO: Implement function # Use the following print statement to display the data nicely #print("(0: .5f} {1: .5f} {2: .5f} {3: .5f)",format (x0,f(x0),f(x1).x0-x1) 5 7 secant(f,2.0,1.0,.0001)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
