Question: ( a ) the bisection method ( b ) Ridders' method ( c ) Steffensen's method ( d ) the Newton - Raphson method The
a the bisection method
b Ridders' method
c Steffensen's method
d the NewtonRaphson method
The events:
a Find that satisfies
b Find that satisfies
c Find that satisfies erfx
For each equation, I guarantee that there is only one root in the interval For bisection
and Ridders, you should start the bracketing at and For Steffensen and Newton
Raphson, you should start with a first guess at the midpoint
In each event, each contestant's score is the number of function evaluations of either or that
it takes before reaching the root with an absolute tolerance
Your mission: code up the methods yourselves ie don't use canned rootfinding routines
determine all scores, and crown the
evaluations
x xstart
while True:
fx fx
evaluations
if absfx tol:
break
xnext x fxfxfx fx
evaluations
if absxnext x tol:
break
x xnext
return x evaluations
def newtonraphsonmethodf df xstart, tole
:
evaluations
x xstart
while True:
fx fx
dfx dfx
evaluations
if absfx tol:
break
xnext x fx dfx
if absxnext x tol:
break
x xnext
return evaluations
#function definitions
def funcx:
return math.tanhx x
def funcx:
return math.sinx x
def funcx:
return erfxxwinner with the lowest total score
ERROR
TypeError
Traceback most recent call last
Cell In line
for i in enumeratefunction
s:
if methodname "Newton
Raphson":
root, evals method
f f start
else:
root, evals method
f start start if lenstart
else start
TypeError: cannot unpack noniterable i
nt object
TypeError
Traceback most recent call last
Cell In line
for i f in enumeratefunction
s:
if methodname "Steffe
nsen:
root, evals method
f f start
else:
root, evals method
f start start if lenstart
else start
TypeError: 'function' object is not su
bscriptable WHY AM I GETTING THESE ERRORS DEBUG
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
