Commit d2310b16 authored by Jim Newton's avatar Jim Newton

comments

parent 931a1f67
......@@ -14,9 +14,10 @@ def binSearch(left:Double,right:Double,f:Double=>Double,epsilon:Double):Option[D
else
recur(left, m)
}
if (f(left) <=0 && f(right) >=0)
if (f(left) <=0 && f(right) >=0) // increasing
Some(recur(left,right))
else if (f(left) >=0 && f(right) <=0)
else if (f(left) >=0 && f(right) <=0) // decreasing
Some(recur(right,left))
else
None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment