Halving Function
I intentionally made the interval halving bisection method above look a little more like java than scala in case anyone in the java world needed some help. In mathematics the bisection method is a root finding method that applies to any continuous functions for which one knows two values with opposite signs.