cauchy_principal_value, an Octave code which uses Gauss-Legendre quadrature to estimate the Cauchy Principal Value of certain singular integrals.
The singular integrals to be considered will have the form:
Integral ( a <= t <= b ) f(t) / ( t - x ) dtThe Cauchy Principal Value is defined as
CPV = limit ( s --> x ) Integral ( a <= t <= s ) f(t) / ( t - x ) dt + limit ( x <-- s ) Integral ( s <= t <= b ) f(t) / ( t - x ) dt
We suppose that our singular integral is posed on an interval that is symmetric with respect to the location of the singularity:
Integral ( x-d <= t <= x+d ) f(t) / ( t - x ) dtand we propose to estimate the integral using a Gauss-Legendre rule of even order N:
CPV approx sum ( 1 <= i <= N ) w(i) * f(xi(i)*d+x) / xi(i)where xi(i) and w(i) are the points and weights, respectively, of the Gauss-Legendre rule.
The computer code and data files made available on this web page are distributed under the MIT license.
cauchy_principal_value is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.
quad_rule, an Octave code which defines quadrature rules for approximating an integral over a 1D domain.