43 for (
double coef :
m_coef) {
44 result += coef * xPow;
62 for (
size_t i = 1; i <
m_coef.size(); i++) {
74 for (
size_t i = 0; i <
m_coef.size(); i++) {
std::shared_ptr< Function > m_derivative
The function representing the derivative (uses lazy initialization)
std::shared_ptr< Function > indefiniteIntegral() const override
Returns the indefinite integral of the polynomial.
std::shared_ptr< Function > m_indefIntegral
The function representing the indefinite integral (uses lazy initialization)
Polynomial(std::vector< double > coefficients)
std::vector< double > m_coef
The vector where the polynomial coefficients are stored.
double operator()(const double) const override
Calculates the value of the polynomial for the given value.
std::unique_ptr< Function > clone() const override
Creates a new polynomial with the same coefficients.
std::shared_ptr< Function > derivative() const override
Returns the derivative of the polynomial.
const std::vector< double > & getCoefficients() const
Returns the coefficients of the polynomial.