Some section in the file is missing you are to fill out the missing part aprropriately
#include <stdio.h>
#include <math.h>
double bisect(double x_left, double x_right, double epsilon, double f(double argP), int *errP);
double myFunction(double rt);
void main()
{
double x_left, x_right, // interval endpoints
root, //Root that bisect will return
epsilon; //error tolerance
int err;
/*Ask user to enter endpoints and tolerance and store them*/
//Fill out here
//Utilize bisect function to search for root of myFunction
root=bisect(x_left, x_right, epsilon, myFunction, &err);
if (!err)
printf("\n f(%.7f)= %e\n", root, myFunction(root));
return 0;
}
double bisect(double x_left, double x_right, double epsilon, double f(double argP), int *errP){
double F_left, //value of myFunction at left endpoint
F_right, //value of myFunction at right endpoint
F_mid, //endpoint
x_mid; //interval mid point
int root_found=0; //This is a flag
/*???? Fill out here: Computes myFunction values at initial endpoints of interval
and assign them to appropriate variables declared above*/
//If signs of value of each endpoint of myFunction are same there may not be a unique root
//Hint: multiplication of numbers of same sign is always larger than zero
if(/*??? Fill out here according to condition explained above*/){
*errP=1;
printf("There may not be root in this interval: [%.6f,%.f]", x_left, x_right);
exit(1); //Terminate the program if there may not be any roots in this interval
}
else{
*errP=0;
//Search for root as long as interval length > epsilon and no root found
while(/*???? Fill out here: enter the conditions for while loop explained in previous line*/){
x_mid=//?? Computes mid point of the interval
F_mid=//??? Computes value of midPoint
if(F_mid==0.0){
root_found==1;
}
else if(/*Fill out here: enter the conditions for when root is in [x_left, x_mid]*/){
//???? Update your x_right
}
else{
//???? Update your x_left
//???? Update your F_left
}
//Print root if found and interval, otherwise just new interval
if(root_found)
printf("\nRoot found at x x = %.6f, midpoint of interval [%.6f, %.6f]", x_mid, x_left,x_right);
else
printf("\nNew interval that root is searched: [%.6f, %.6f]", x_left,x_right);
}//While-LOOP ends here
}
//If there is a root
return ((x_left+x_right)/2);
}
double myFunction(double x){
// Function that we look for its roots is 5x^5-2x^3+6x+3
int val;
/* ???? Fill out here: Compute the value of x for your function (5x^5-2x^3+6x+3) and assign it to val */
return (val);
}11 years ago
20
Answer(1)![blurred-text]()
![]()
Purchase the answer to view it

- filling_the_missing_bisect_method.zip
- editted_missing_fills_bisect_method.zip
Bids(1)
other Questions(10)
- ECE 601 Week 4 Assignment ( Final Paper Outline ) - A Graded - Best Tutorial - Quality Work - Latest Syllabus
- home work help
- Econometrics Questions( Must use Stata to finish !!!)
- The U.S. government has put in place IPv6-compliance mandates to help with the IPv4-to-IPv6 transition. Such mandates require government agencies...
- International Trade
- spciology homework
- FINA 310 IP 5 ( FINA310 IP 5 ) [ FINA/310 IP 5 ]
- paraphrase
- ZeeK the GeeK
- APU Busn311 week 2 quiz (All Correct)