Brent's algorithm 
Use Brent's algorithm to find all real roots of the equation
  $$9-\sqrt{99+2x-x^2}=\cos(2x),\\ x\in[-8,10]$$

I am having difficulty understanding Brent's algorithm. I looked at an example in wikipedia and in my book but the examples given isn't the same as this question. Any help will be greatly appreciated. 
 A: I would start by looking at the problem and trying to analyze it with other methods.
If we plot these two functions over the indicated range, we have:

As you can clearly see, there are eight roots.
These are located at:


*

*x = -3.80962245582300...

*x = -2.08783181165642...

*x = -1.21128304795669...

*x = 1.49277841962787...

*x = 1.67831642586421...

*x = 4.17818286865309...

*x = 5.54381657586530...

*x = 6.64685888158733...


The original Brent paper has the Algo based algorithm.
For Brent's method, of course, you are going to write:
$f(x) = -9 + \sqrt{99+2x-x^2} + \cos 2x , x\in [-8,10]$
Now, you would 'single step' through each line in the algorithm, test the conditional and continue until a root is found.
A: The wikipedia entry you cite explains Brent's algorithm as a modification on other ones. Write down all algorithms that are mentioned in there, see how they go into Brent's. Perhaps try one or two iterations of each to feel how they work.
Try to write Brent's algorithm down as a program in some language you are familiar with. Make sure your program follows the logic given.
Run your program on the function given (or some simpler one), and have it tell you what it is doing each step. Look over the explanation to see why that step makes sense, check what the alternative would have been.
As a result, you will have a firm grasp of the algorithm (and some others, with their shortcommings and strong points), and thus why it is done the way it is.
[Presumably that is what this assignment is all about...]
