Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We used the bisection method to find the root of a polynomial equation in the second C++ home- work. If you recall, we were solving
We used the bisection method to find the root of a polynomial equation in the second C++ home- work. If you recall, we were solving f(x) = 3 +Cz-10 = 0 by guessing initial upper and lower bounds zu and zl on the root z*, and we then proceeded by: (i) finding the mid-point Zmid = ( +Zu)/2; (ii) evaluating the function at this new value, ie, computing f(Trna); (iii) replacing one of the two bounds xi or 3u with Emid, thus cutting the interval in half; and (iv) repeating this until the bounds were very close together Let's re-implement the bisection method here in a slightly more general way. Specifically, we want the actual bisection algorithm (the description above) to be in the main part of the program, but we want the actual function evaluation (i.e., where we compute the value of f(x) for any x) to be in a C++ function declared as float myfcn(float x); Take the initial bounds as zl =-100 and ru-100, and keep iterating until Tu-z!
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