PIECEWISE_LINEAR_PRODUCT_INTEGRAL
Piecewise Linear Product Integral


PIECEWISE_LINEAR_PRODUCT_INTEGRAL, a MATLAB library which calculates the exact value of the integral of the product of two piecewise linear functions F(X) and G(X).

The piecewise linear function F(X) is defined by

The piecewise linear function G(X) is defined similarly, and there is no requirement that G(X) uses the same nodes as F(X), or the same number of nodes.

The task, then, is to determine the value of

        Integral ( A <= X <= B ) F(X) * G(X) dx
      
This value can be determined exactly, by breaking the interval ot integration into subintervals over which F(X) and G(X) are simple linear functions.

In finite element programs over 1-dimensional geometries, integrals like this may occur when assembling the stiffness matrix, but these integrals are generally treated using quadrature.

A more appropriate use for this function occurs when coarsening a finite element solution, or constructing a piecewise linear least squares finite element approximant to data that is regarded as a piecewise linear function.

In case 1, we treat the original finite element solution as the function F(X), and in case 2, we treat the data as a finite element function whose mesh is implicit in the X coordinates of the given data.

Our G_X is, in case 1, the coarse mesh and in case 2 the given mesh. To determine the finite element coefficient U(I) on this mesh, we must integrate our data function F(X) against the I-th basis function, which in this case is simply the I-th "hat function. So to use our formula for G(X), we set G_V(1:G_NUM) to 0, except that G_V(I) = 1, and compute

        U(I) = Integral ( G_X(I-1) <= X <= G_X(I+1) ) F(X) * G(X) dx
      
Doing this for I from 1 to G_NUM allows us to compute the coefficients of the coarsened solution (case 1) or the least squares approximant to the piecewise linear function representing the data F.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

PIECEWISE_LINEAR_PRODUCT_INTEGRAL is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

FEM1D, a data directory which contains a description and examples of files that describe a 1D finite element model.

FEM1D, a MATLAB program which applies the finite element method to a 1D linear two point boundary value problem.

FEM1D_ADAPTIVE, a MATLAB program which applies the finite element method to a 1D linear two point boundary value problem using adaptive refinement to improve the solution.

FEM1D_NONLINEAR, a MATLAB program which applies the finite element method to a 1D nonlinear two point boundary value problem.

FEM1D_PMETHOD, a MATLAB program which applies the p-method version of the finite element method to a linear two point boundary value problem in a 1D region.

FEM1D_SAMPLE, a MATLAB program which samples a scalar or vector finite element function of one variable, defined by FEM files, returning interpolated values at the sample points.

piecewise_linear_product_integral_test

Reference:

  1. Hans Rudolf Schwarz,
    Finite Element Methods,
    Academic Press, 1988,
    ISBN: 0126330107,
    LC: TA347.F5.S3313.
  2. Gilbert Strang, George Fix,
    An Analysis of the Finite Element Method,
    Cambridge, 1973,
    ISBN: 096140888X,
    LC: TA335.S77.
  3. Olgierd Zienkiewicz,
    The Finite Element Method,
    Sixth Edition,
    Butterworth-Heinemann, 2005,
    ISBN: 0750663200,
    TA640.2.Z54.

Source Code:


Last revised on 25 February 2019.