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);
}