Added Brent's method for root-finding.