Question: 5) Automated root bracketing If a given bracket contains more than one root, the bisection method will converge to one root but may miss other
5) Automated root bracketing If a given bracket contains more than one root, the bisection method will converge to one root but may miss other roots. One way to automatically find brackets for roots is to test an evenly spaced set of z values to find sign changes. Write a function called find-brackets that takes arguments f and x Here f should be a function, and x should be an array of x values. This function should evaluate f at each of the given x values, and return a list of tuples (pairs) of adjacent x values that consist of all adjacent x values where the function changes sign. Note, to generate a list of tuples you may first create an empty list, and then repeatedly append values to the list, as in the following code mylist mylist.append ((1.0,1.2)) mylist.append ((1.4,1.6)) which would create a list containing the two tuples ii) Use this function to automatically find brackets for all of the roots of the function f(x) sin(25z)- /20 for x between -4 and 4 ili) Once these are bracketed, compute all of these roots to 10 d.p. of accuracy
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
