moved brent's algorithm into a new class to make it more generic