# #include #include double bisect(double x_left, double x_right, double epsilon, double f(double argP)

#include #include 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)= %en”, 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); }

**Posted:**4 years ago**Due:**02/12/2015**Budget:**$20

## You don't know how to answer this question. We can help you find the right answer.

We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount! Use Discount Code "save15" for a 15% Discount!

Get StartedNo need to wonder who can do my homework. You can always reach our team of professionals to do your homework at a low price.