Question: Roots of an Equation Using Bisection Write a C++ program that finds a solution of the equation: 2sin(x) x = 0 For this project, I

Roots of an Equation Using Bisection Write a C++ program that finds a solution of the equation: 2sin(x) x = 0 For this project, I will tell you that there is a root between x = 1 and x = 2; The equation is > 0 for x = 1, and < 0 for x = 2. We will narrow the range using bisection. The algorithm is: Pseudo-code for Bisection Algorithm: Find a root of f(x) = 0 between x_pos and x_neg: x_pos // a number where f(x) > 0 x_neg // a number where f(x) < 0 error // an error limit on the value of x while |x_pos x_neg| > error x_mid = a point midway between x_pos and x_neg y = f(x) if y > 0 x_pos = x_mid else x_pos = x_mid output x_mid We will later put this code in a function, learn how to pass an equation to solve as a parameter, and write a loop to locate places where the function crosses the x axis. You can include in your program to get the sin() and abs() functions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!