Polynomial Class Reference#
|
DiFfRG
|
A class representing a polynomial. More...
#include <polynomials.hh>
Public Member Functions | |
| Polynomial (const std::vector< double > &coefficients) | |
| Construct a new Polynomial object from a list of coefficients. The coefficients are ordered from the lowest to the highest power, starting with 0. | |
| const double & | operator[] (const uint &i) const |
| Access the i-th coefficient of the polynomial. | |
| double & | operator[] (const uint &i) |
| Access the i-th coefficient of the polynomial. | |
| double | operator() (const double &x) const |
| Evaluate the polynomial at a given point x. | |
| void | operator*= (const double &scalar) |
| Multiply the polynomial by a scalar. | |
| void | operator*= (const Polynomial &other) |
| Multiply the polynomial by another polynomial. | |
| Polynomial | anti_derivative (const double &integration_constant) const |
| Compute the antiderivative of the polynomial. An integration constant is given as an argument. | |
| Polynomial | derivative () const |
| Compute the derivative of the polynomial. | |
| double | integral (const double &x_min, const double &x_max) const |
| Compute the integral of the polynomial between two points. | |
| Polynomial | square_argument () const |
| A utility function to obtain from this polynomial P(x) the polynomial Q(x) = P(x^2) | |
Private Attributes | |
| std::vector< double > | coefficients |
Detailed Description
A class representing a polynomial.
Constructor & Destructor Documentation
◆ Polynomial()
| DiFfRG::Polynomial::Polynomial | ( | const std::vector< double > & | coefficients | ) |
Construct a new Polynomial object from a list of coefficients. The coefficients are ordered from the lowest to the highest power, starting with 0.
Member Function Documentation
◆ anti_derivative()
| Polynomial DiFfRG::Polynomial::anti_derivative | ( | const double & | integration_constant | ) | const |
Compute the antiderivative of the polynomial. An integration constant is given as an argument.
The antiderivative is a polynomial of one degree higher than the original polynomial.
- Parameters
-
integration_constant The constant term of the antiderivative.
- Returns
- Polynomial The antiderivative of the polynomial.
◆ derivative()
| Polynomial DiFfRG::Polynomial::derivative | ( | ) | const |
Compute the derivative of the polynomial.
The derivative is a polynomial of one degree lower than the original polynomial.
- Returns
- Polynomial The derivative of the polynomial.
◆ integral()
| double DiFfRG::Polynomial::integral | ( | const double & | x_min, |
| const double & | x_max ) const |
Compute the integral of the polynomial between two points.
- Parameters
-
x_min The lower bound of the integral. x_max The upper bound of the integral.
- Returns
- double The integral of the polynomial between x_min and x_max.
◆ operator()()
| double DiFfRG::Polynomial::operator() | ( | const double & | x | ) | const |
Evaluate the polynomial at a given point x.
◆ operator*=() [1/2]
| void DiFfRG::Polynomial::operator*= | ( | const double & | scalar | ) |
Multiply the polynomial by a scalar.
◆ operator*=() [2/2]
| void DiFfRG::Polynomial::operator*= | ( | const Polynomial & | other | ) |
Multiply the polynomial by another polynomial.
◆ operator[]() [1/2]
| double & DiFfRG::Polynomial::operator[] | ( | const uint & | i | ) |
Access the i-th coefficient of the polynomial.
◆ operator[]() [2/2]
| const double & DiFfRG::Polynomial::operator[] | ( | const uint & | i | ) | const |
Access the i-th coefficient of the polynomial.
◆ square_argument()
| Polynomial DiFfRG::Polynomial::square_argument | ( | ) | const |
A utility function to obtain from this polynomial P(x) the polynomial Q(x) = P(x^2)
- Returns
- Polynomial The polynomial Q(x) = P(x^2).
Member Data Documentation
◆ coefficients
|
private |
The documentation for this class was generated from the following file:
- /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/polynomials.hh
Generated by