philsupertramp/game-math
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
LagrangeBase Class Reference

#include <SupportValues.h>

Inheritance diagram for LagrangeBase:
PolynomialBase

Public Member Functions

 LagrangeBase (const Matrix< double > &X, const Matrix< double > &Y)
 
double GetCoefficient (const double &xk, const size_t i) const
 
virtual Matrix< double > Evaluate (const Matrix< double > &in) const
 
std::string buildLx (size_t i) const
 
virtual std::string Function () const
 
- Public Member Functions inherited from PolynomialBase
 PolynomialBase (const Matrix< double > &X, const Matrix< double > &Y)
 
virtual Matrix< double > Evaluate (const Matrix< double > &) const =0
 
virtual std::string Function () const =0
 

Private Attributes

Matrix< double > x
 $$x_i$$ Support values More...
 
Matrix< double > y
 $$y_i$$ Support values evaluated with the function More...
 

Detailed Description

Lagrange-Base using lagrange coefficients to build the polynomial

https://wiki.godesteem.de/wiki/interpolation-and-approximation/#Lagrange-Base

Examples
numerics/analysis/TestSupportValues.cpp, and plot/TestPlot.cpp.

Constructor & Destructor Documentation

◆ LagrangeBase()

LagrangeBase::LagrangeBase ( const Matrix< double > &  X,
const Matrix< double > &  Y 
)
inline

Default constructor

Parameters
X$$x_i$$
Y$$y_i$$

Member Function Documentation

◆ buildLx()

std::string LagrangeBase::buildLx ( size_t  i) const
inline

builds lagrange coefficient $$L_i$$ string representation

Parameters
iindex
Returns
coefficient representation

◆ Evaluate()

virtual Matrix< double > LagrangeBase::Evaluate ( const Matrix< double > &  in) const
inlinevirtual

Evaluates the lagrange base

Parameters
invalues to evaluate
Returns
interpolated values

Implements PolynomialBase.

Examples
plot/TestPlot.cpp.

◆ Function()

virtual std::string LagrangeBase::Function ( ) const
inlinevirtual

Builds string representation in lagrange base

Returns
representational string

Implements PolynomialBase.

◆ GetCoefficient()

double LagrangeBase::GetCoefficient ( const double &  xk,
const size_t  i 
) const
inline

Computes i-th coefficient

$$L_i(x) = \prod_{j=0, j\neq i}^{n} \frac{x-x_j}{x_i-x_j}, \forall i=0, \dots, n$$

Parameters
xkcurrent value $$x_k$$
iindex i
Returns
coefficient value

Member Data Documentation

◆ x

Matrix<double> LagrangeBase::x
private

$$x_i$$ Support values

◆ y

Matrix<double> LagrangeBase::y
private

$$y_i$$ Support values evaluated with the function


The documentation for this class was generated from the following file: