Question
Given the following two functions: f(x) = x 3 + 2x 2 + 10x 20, g(x) = x tan x. (a) Write a Matlab or
Given the following two functions: f(x) = x 3 + 2x 2 + 10x 20, g(x) = x tan x.
(a) Write a Matlab or Fortran or C code (in double precision) to apply the Bisection Method to f(x) = 0 on the interval [1, 2]. Find the root to full machine precision. Output your final computed root and the number of iterations required to obtain it.
(b) Modify your code such that it will stop when the function value at the computed root is less than 105 . Again, output your final computed root and the number of iterations required to obtain it. Are the results same as those of Question (a)?
(c) Write another Matlab or Fortran or C code (in double precision) to implement Newtons Method for finding the zero of g(x) that is closest to 99 (radians). Stop the computation when two successive iterates differ by 106 . Output your final computed root and the number of iterations required to obtain it. (Hint: Extremely accurate starting values are needed for this function. You may want to use the computer to construct a table of values of g(x) around 99 to see the behavior of this function.)
(d) Maple and Matlab have built-in programs to solve nonlinear equations. Maples program is fsolve and Matlabs is fzero. Try both programs on the functions f(x) and g(x). If you do not know how to use the built-in programs, type: ?fsolve in Maple and type: help fzero in Matlab to see the help pages.
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