HOME ›  AREAS OF EXPERTISE  #1 ›   Interpolation Apps ›  ~ Barycentric Method

 "Interpolation Solutions" Barycentric Method
 X = (1, 3, 5, 7)
 Y = (1, 9, 25, 49)

 Array X = { , , , , } Array Y = { , , , , } Specify New X values = { , , , } [ Initial ArrayValues X: {0,2,4,6,8} ] [ Initial ArrayValues Y: {0,4,16,36,64} ] [ Initial BarycentricX Values specified: {1,3,5,7} ]

IMPLEMENTATION
Barycentric Interpolation

The Lagrange interpolation method (see) Lagrange Interpolation requires recomputation for all of the terms for each distinct x value, meaning that this method can be applied for small numbers n of nodes. Some shortcomings are associated with the Lagrange interpolation:

• Each evaluation of f(x) requires O(n2) additions and multiplications.
• Adding a new data point (xn+1,yn+1) requires a new computation from scratch.
• The computation is numerically unstable.

In order to improve the Lagrange method, simply rearrange the terms in the equation of the Lagrange interpolation by defining weight functions that do not depend on the interpolated value of x.

Algorithm Creation

Introduce the quantity

 l(x) = (x - x0)(x - x1)... (x - xn)

Then rearrange the Lagrange basis polynomial as

 li(x) = [l(x) / x - xi] * [1 / ∏nj=0,j≠i (xi - xj)]

Define the barycentric weight functions

 wi = 1 / ∏j=0,j≠i(xi - xj)

Then simply write

 li = l(x) [ wi / x - xi]

which is usually referred to as the barycentric interpolation formula. The advantage of this representation is that the interpolation polynomial may now be evaluated as

 y = f(x) = l(x) ∑i wi / x - xi f(xi)

Testing the Barycentric Method

In order to test the Barycentric method as defined above, a new TestBarycentric() static method has been added and executed. Supporting code and methods are not shown.

static void TestBarycentric();
{
ListBox1.Items.Clear();
ListBox2.Items.Clear();
double[] xarray = new double[] { t1, t2, t3, t4, t5 };
double[] yarray = new double[] { t6, t7, t8, t9, t10 };
double[] x = new double[] { t11, t12, t13, t14 };
double[] y = Interpolation.Barycentric(xarray, yarray, x);
VectorR vx = new VectorR(x);
VectorR vy = new VectorR(y);
}

We first defined a set of data points as xarray and yarray (same input as in) Lagrange Interpolation, which represent a set of given data points. The Barycentric method returns a single y value or a y array at the input x. The user can manipulate all values and try variations on the arrays themselves as well as specifying new xBarycentric values. Running this example generates the results shown above. From the data points described by x array and y array, we see that the given data can be expressed in term of an analytic function y = x2. The Barycentric method gives the exact results expected from the analytic function.

 Other Implementations...

 Object-Oriented Implementation Graphics and Animation Sample Applications Ore Extraction Optimization Vectors and Matrices Complex Numbers and Functions Ordinary Differential Equations - Euler Method Ordinary Differential Equations 2nd-Order Runge-Kutta Ordinary Differential Equations 4th-Order Runge-Kutta Higher Order Differential Equations Nonlinear Systems Numerical Integration Numerical Differentiation Function Evaluation

 Quotes

Math, Analysis,
expertise..."

EIGENVALUE
SOLUTIONS...

> Rayleigh-Quotient Method

> Cubic Spline Method

 Applied Mathematical Algorithms
 ComplexFunctions NonLinear Differentiation Integration
 About Us KMP Software Engineering is an independent multidisciplinary engineering consulting company specializing in mathematical algorithms.       (About Us) → Areas of Expertise SpecialFunctions VectorsMatrices OptimizationMethods ComplexNumbers Interpolation CurveFitting NonLinearSystems LinearEquations DistributionFunctions NumericalDifferentiation NumericalIntegration DifferentialEquations Smalltalk FiniteBoundary Eigenvalue Graphics UnderstandingMining MiningMastery MineralNews MineralCommodities MineralForum Crystallography Services NumericalModeling WebServices MainframeServices OutsourceServices LINKED IN MINE REVIEW(by G.Pacheco) Brand Login Contact