MathPHP\NumericalAnalysis\RootFinding\FixedPointIteration::validate PHP Метод

validate() приватный статический Метод

If $a = $b, then clearly we cannot run our loop as [$a, $b] will not be an interval, so we throw an Exception. If $a > $b, we simply reverse them as if the user input $b = $a and $a = $b so the new $a < $b.
private static validate ( number $a, number $b, number $p, number $tol )
$a number The start of the interval which contains a root
$b number The end of the interval which contains a root
$p number The initial guess of our root
$tol number Tolerance; How close to the actual solution we would like.
    private static function validate($a, $b, $p, $tol)
    {
        Validation::tolerance($tol);
        Validation::interval($a, $b);
        if ($a > $b) {
            list($a, $b) = [$b, $a];
        }
        if ($p < $a || $p > $b) {
            throw new Exception\OutOfBoundsException("Initial guess {$p} must be in [{$a}, {$b}].");
        }
    }
FixedPointIteration