Bisection search
1. In MATLAB, implement a function that performs a bisectionsearch. It should take the following parameters:
• F: A function (assumed to be continuous) whose roots you wantto find,
• a: A floating-point number giving the left endpoint of theinitial interval in which you want to search for a root of F.
• b: A floating-point number giving the right endpoint of theinitial interval.
• delta: A non-negative floating-point number giving theacceptable proximity of the output to a root of F.
Your function should first check a and b to determine whether ornot they satisfy the condition given by the Intermediate ValueTheorem that allows us to conclude that [a, b] contains a root ofF. If this condition is not satisfied, return NaN (Matlab for “Nota numberâ€). If the condition is satisfied, your function shouldperform a bisection search until it finds a number z that it canguarantee satisfies |x−x∗| < delta, for some real-valued root x∗of F. It should return z.
2. Use the MATLAB function that you wrote to find a real-valuedroot of the function F(x) = x 5 +x+ 1, with accuracy to 4 decimalplaces (this last requirement will determine your choice ofdelta).
3. Suppose that you use bisection search to find a root of F(x)= sin x, with a = −π/2, b = 5π/2. To which root will the bisectionsearch converge?