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

solve() публичный статический Метод

Use Fixed Point Iteration to find the x which produces f(x) = 0 by rewriting f(x) = 0 as g(x) = x, where g(x) is our input function.
public static solve ( callable $function, number $a, number $b, number $p, number $tol ) : number
$function callable g(x) callback function, obtained by rewriting f(x) = 0 as g(x) = x
$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, in [$a, $b]
$tol number Tolerance; How close to the actual solution we would like.
Результат number
    public static function solve(callable $function, $a, $b, $p, $tol)
    {
        // Validate input arguments
        self::validate($a, $b, $p, $tol);
        do {
            $g⟮p⟯ = $function($p);
            $dif = abs($g⟮p⟯ - $p);
            $p = $g⟮p⟯;
        } while ($dif > $tol);
        return $p;
    }
FixedPointIteration