queso-0.57.1
|
Class for one-dimensional Lagrange polynomials. More...
#include <1D1DFunction.h>
Public Member Functions | |
Constructor/Destructor methods | |
LagrangePolynomial1D1DFunction (const std::vector< double > &positionValues, const std::vector< double > *functionValues) | |
Default constructor. More... | |
~LagrangePolynomial1D1DFunction () | |
Destructor. More... | |
Mathematical methods | |
double | value (double domainValue) const |
Returns the value of the Lagrange polynomial at point domainValue . More... | |
double | deriv (double domainValue) const |
TODO: Returns the value of the derivative of the Lagrange polynomial at point domainValue . More... | |
Public Member Functions inherited from QUESO::Base1D1DFunction | |
Base1D1DFunction (double minDomainValue, double maxDomainValue) | |
Default constructor. More... | |
virtual | ~Base1D1DFunction () |
Destructor. More... | |
double | minDomainValue () const |
Returns the minimum value of the domain of the (one-dimensional) function. More... | |
double | maxDomainValue () const |
Returns the maximum value of the domain of the (one-dimensional) function. More... | |
virtual double | multiplyAndIntegrate (const Base1D1DFunction &func, unsigned int quadratureOrder, double *resultWithMultiplicationByTAsWell) const |
TODO: Multiplies this function with function , and integrates it numerically. See template specialization. More... | |
Protected Attributes | |
std::vector< double > | m_positionValues |
std::vector< double > | m_functionValues |
Protected Attributes inherited from QUESO::Base1D1DFunction | |
double | m_minDomainValue |
double | m_maxDomainValue |
Class for one-dimensional Lagrange polynomials.
The Lagrange interpolating polynomial of a one-dimensional function \( f(x) = y \) is the polynomial \( P(x) \) of degree \( \leq n-1 \) that passes through the \( n \) points \( (x_1,y_1=f(x_1)), (x_2,y_2=f(x_2)), ..., (x_n,y_n=f(x_n))\), and is given by:
\[ P(x)=\sum_{j=1}^n \prod_{k=1; k\not=j}^n \frac{x-x_k}{x_j-x_k}.\]
Written explicitly,
\[ P(x)=\frac{(x-x_2)(x-x_3)...(x-x_n)}{(x_1-x_2)(x_1-x_3)...(x_1-x_n)}y_1+ \frac{(x-x_1)(x-x_3)...(x-x_n)}{(x_2-x_1)(x_2-x_3)...(x_2-x_n)}y_2+...+ \frac{(x-x_1)(x-x_2)...(x-x_(n-1))}{(x_n-x_1)(x_n-x_2)...(x_n-x_(n-1))}y_n.\]
In this class, the array std::vector<double>& positionValues
stores the points \( x_1, x_2, ... x_n \) and the array std::vector<double>* functionValues
stores the points \( y_1, y_2, ... y_n \) of the Lagrange polynomial.
Definition at line 558 of file 1D1DFunction.h.
QUESO::LagrangePolynomial1D1DFunction::LagrangePolynomial1D1DFunction | ( | const std::vector< double > & | positionValues, |
const std::vector< double > * | functionValues | ||
) |
Default constructor.
Definition at line 743 of file 1D1DFunction.C.
References m_functionValues, m_positionValues, and QUESO::queso_require_equal_to_msg.
QUESO::LagrangePolynomial1D1DFunction::~LagrangePolynomial1D1DFunction | ( | ) |
|
virtual |
TODO: Returns the value of the derivative of the Lagrange polynomial at point domainValue
.
domainValue
belongs to the domain of this
function, and in affirmative case, it returns the value of the derivative at such point. Implements QUESO::Base1D1DFunction.
Definition at line 797 of file 1D1DFunction.C.
References QUESO::Base1D1DFunction::m_maxDomainValue, QUESO::Base1D1DFunction::m_minDomainValue, and value().
|
virtual |
Returns the value of the Lagrange polynomial at point domainValue
.
Implements QUESO::Base1D1DFunction.
Definition at line 762 of file 1D1DFunction.C.
References m_functionValues, and m_positionValues.
Referenced by deriv().
|
protected |
Definition at line 585 of file 1D1DFunction.h.
Referenced by LagrangePolynomial1D1DFunction(), and value().
|
protected |
Definition at line 584 of file 1D1DFunction.h.
Referenced by LagrangePolynomial1D1DFunction(), and value().