MathPHP\Functions\Polynomial::integrate PHP Метод

integrate() публичный Метод

Note that this method assumes the constant of integration to be 0.
public integrate ( ) : Polynomial
Результат Polynomial The integral of our polynomial object, also a polynomial object
    public function integrate() : Polynomial
    {
        $integralCoefficients = [];
        // Start with empty set of coefficients
        // Iterate over each coefficient, integrating term-by-term
        for ($i = 0; $i < $this->degree + 1; $i++) {
            $integralCoefficients[] = $this->coefficients[$i] / ($this->degree - $i + 1);
        }
        $integralCoefficients[] = 0;
        // Make the constant of integration 0
        return new Polynomial($integralCoefficients);
    }