Question
Consider the function f(x) = x 3 + 2x 2 + 10x 20. In this lab, we will approximate a root r of the function
Consider the function
f(x) = x3 + 2x2 + 10x 20. In this lab, we will approximate a root r of the function f in a given interval using three dierent methods: the Bisectionmethod, Newtons method, and the Secant method.
Complete the following steps:
1. Show, using analysis, that the function f has a unique root in the interval [1, 2]; i.e., use techniques learned incalculus to show that
(i) there exists a root r of f in [1, 2], and
(ii) that there is only one root r of f in [1, 2].
2. Implement a MatLab function for each of the three methods. These routines should be very exible; i.e., you shouldbe able to apply them to functions other than the one posed in this project. You should write a separate MatLab function to evaluate the function f given above (you will also need a function for f to be used with Newtons method).
The program for each of the methods should accept a function f as an input (Newtons needs f as an inputas well).
The program for each of the methods should also have inputs for an error tolerance, a maximum numberof iterations, and any other information that the method needs to perform (initial guess x0 for Newtons,endpoints of the interval [a, b] for Bisection, and two initial guesses x0, x1 for the Secant method).
3. For this project, we will stop the iterations once our approximation to the root r is within an error of = 105. For the Bisection method, when the length of the current interval satises b a 2, taking the midpoint c
of [a, b] will satisfy |r c| . For the other two methods, stop the iterations once |xn+1 xn| .
4. For each method, format your output as follows: Output the name of the method. Output the starting information for each method (i.e., a and b for Bisection, x0 for Newtons, x0 and x1 for Secant).
Output a table for each method, organized into four columns, Include a header for the table.
Column 1: display the iteration index n,
Column 2: display the current approximation xn to the root r using 8 digits to the right of the decimal
, Column 3: display the value of f(xn), again using 8 digits to the right of the decimal,
Column 4: display the absolute error |r xn|, using 8 digits to the right of the decimal.
After each table, output the nal approximation to the root r, as well as the absolute error for the nalapproximation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started