interpolations.hpp#

Methods for interpolating experimental data.

Functions

double lagrange_interpolation_3(double xi, const Array<double> &f, double x_min, double x_max)#

Lagrange interpolation with the 3 closest points.

Parameters
  • xi – value in wich to interpolate

  • fArray of corresponding f(x) values

  • x_min – x corresponing to first value in f

  • x_max – x corresponing to last value in f

Returns

f(xi) interpolated from f

double lagrange_interpolation_3(double xi, const Array<double> &xs, const Array<double> &f)#

Lagrange interpolation with the 3 closest points.

Parameters
  • xi – value in wich to interpolate

  • xsArray of x values (sorted ascendingly)

  • fArray of corresponding f(x) values

Returns

f(xi) interpolated from f

double lagrange_interpolation_3(double xi, const Array<double> &xs, const Matrix2D<double> &f, size_t col)#

Lagrange interpolation with the 3 closest points.

Parameters
  • xi – value in wich to interpolate

  • xsArray of x values (sorted ascendingly)

  • f – Matrix of corresponding f(x) values

  • col – column from which to take the values

Returns

f(xi) interpolated from f

double four_point_formula(double x, double y, const Array<double> &xs, const Array<double> &ys, const Matrix2D<double> &M)#

Interpolate 2D using the 4 points formula.

Abramowitz, M., Stegun, I. A., & Romer, R. H. (1988). Handbook of mathematical functions with formulas, graphs, and mathematical tables. 25.2.66

Parameters
  • x – from (x, y) desidered interpolation point.

  • y – from (x, y) desidered interpolation point.

  • xsArray of points corresponding to x that the matrix represents

  • ysArray of points corresponding to y that the matrix represents

  • M – Matrix representation to interpolate

Returns

interpolated M(x, y).

double four_point_formula(double x, double y, ScalarField f)#

Interpolate 2D using the 4 points formula.

Abramowitz, M., Stegun, I. A., & Romer, R. H. (1988). Handbook of mathematical functions with formulas, graphs, and mathematical tables. 25.2.66

Parameters
  • x – from (x, y) desidered interpolation point.

  • y – from (x, y) desidered interpolation point.

  • f – scalar field given by a matrix and the (x, y) limits of the space it represents

Returns

interpolated f(x, y).

double six_point_formula(double x, double y, ScalarField f)#

Interpolate 2D using the 6 points formula.

Abramowitz, M., Stegun, I. A., & Romer, R. H. (1988). Handbook of mathematical functions with formulas, graphs, and mathematical tables. 25.2.67

Parameters
  • x – from (x, y) desidered interpolation point.

  • y – from (x, y) desidered interpolation point.

  • f – scalar field given by a matrix and the (x, y) limits of the space it represents

Returns

interpolated f(x, y).

double four_point_formula(double x, double y, Matrix2D<double> &M, double x_min, double x_max, double y_min, double y_max)#

Interpolate 2D using the 4 points formula.

Abramowitz, M., Stegun, I. A., & Romer, R. H. (1988). Handbook of mathematical functions with formulas, graphs, and mathematical tables. 25.2.66

Parameters
  • x – from (x, y) desidered interpolation point.

  • y – from (x, y) desidered interpolation point.

  • f – scalar field given by a matrix and the (x, y) limits of the space it represents

Returns

interpolated f(x, y).

double six_point_formula(double x, double y, Matrix2D<double> &M, double x_min, double x_max, double y_min, double y_max)#

Interpolate 2D using the 6 points formula.

Abramowitz, M., Stegun, I. A., & Romer, R. H. (1988). Handbook of mathematical functions with formulas, graphs, and mathematical tables. 25.2.67

Parameters
  • x – from (x, y) desidered interpolation point.

  • y – from (x, y) desidered interpolation point.

  • f – scalar field given by a matrix and the (x, y) limits of the space it represents

Returns

interpolated f(x, y).