Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify this function a. Modify the algorithm to take the approximate error and the maximum number of iterations in consideration b. code the false-position algorithm

Modify this function a. Modify the algorithm to take the approximate error and the maximum number of iterations in consideration b. code the false-position algorithm

def bisect_naive(func, xl, xu, maxit = 20): ''' Input: func = main function we want to compute the roots xl = lower bound --> guess xu = upper bound --> guess Output: xr = root estimate or error message if initail guess [xl, xu] is not good --> does not bracket the solution ''' if func(xl) * func(xu) > 0: return 'Initial guess [xl, xu] does not bracket the solution' for i in range(maxit): xr = (xl + xu)/2 if func(xr)*func(xl) >0: xl = xr else: xu = xr return xr

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

Students also viewed these Databases questions