PHP Класс MathPHP\NumericalAnalysis\RootFinding\BisectionMethod
In numerical analysis, the Bisection method is a method for finding successively
better approximations to the roots (or zeroes) of a continuous, real-valued
function f(x). It starts with two points $a and $b, such that f($a) and f($b)
have different signs (one is positive, one is negative). This lets us use
the intermediate value theorem to prove that there is a root $p such that
p is between $a and $b. We initially set $p to be the average of $a and $b
and analyze the result of f($p). Based on the sign, we construct a new $p that
is either the average of $a and the original $p, or the average of the
original $p and $b. We continue doing this until our function evaluation f($p)
is within the tolerance set on our input.
https://en.wikipedia.org/wiki/Bisection_method
Показать файл
Открыть проект
Открытые методы
Приватные методы
Метод |
Описание |
|
validate ( callable $function, number $a, number $b, number $tol ) |
Verify the input arguments are valid for correct use of the bisection
method. If the tolerance is less than zero, an Exception will be thrown. |
|
Описание методов
solve()
публичный статический Метод
Use the Bisection Method to find the x which produces $function(x) = 0.