= 0) { throw new \Exception("Function values at endpoints must have opposite signs."); } $c = $b; $iteration = 0; while (($y = \abs($func($c))) > self::EPSILON && $iteration < $maxIterations) { $fa = $func($a); $fb = $func($b); $c = ($a * $fb - $b * $fa) / ($fb - $fa); if ($y === 0.0) { return $c; } if ($y * $fa < 0) { $b = $c; } else { $a = $c; } ++$iteration; } return $c; } }