Question: Please fill in the part of the code where stated #YOUR CODE HERE, written in python Find a function f(x) with a root at x
Please fill in the part of the code where stated #YOUR CODE HERE, written in python
Find a function f(x) with a root at x 0 where bisection and Newton both converge, but Newton has an error of at least 10-2 -.01 even when the residual is smaller than 10-10. @tests.add("newton_inaccurate' def f(x): # YOUR CODE HERE raise NotImplementedError() plotf(tests plot_conv (tests, (bisect, newton)) newton inaccurate 1) h newton(tests smallresid np.abs(h[:,1]) 1e-10 newton_inaccurate'], -1, 3) assert np.sometrue(smallresid) assert np.sometru e(h[smallre sid print( Tests pass > 1e-2) Find a function f(x) with a root at x 0 where bisection and Newton both converge, but Newton has an error of at least 10-2 -.01 even when the residual is smaller than 10-10. @tests.add("newton_inaccurate' def f(x): # YOUR CODE HERE raise NotImplementedError() plotf(tests plot_conv (tests, (bisect, newton)) newton inaccurate 1) h newton(tests smallresid np.abs(h[:,1]) 1e-10 newton_inaccurate'], -1, 3) assert np.sometrue(smallresid) assert np.sometru e(h[smallre sid print( Tests pass > 1e-2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
