Thanks to visit codestin.com
Credit goes to github.com

Skip to content

shawsa/ppqf

Repository files navigation

Piecewise Polynomial Quadrature Formulae

A family of quadrature formulae based on piecewise polynomial interpolation. I am not aware of this quadrature rule being previously discovered. Trapezoidal rule is a special case. This is distinct from spline based quadratures. I haven't proven convergence orders, but I expect them to be prescribed by the stencil size parameter.

Derivation

This is an interpolation based quadrature scheme used to approximate $\int_a^b f(x) \ dx$. Quadrature formula are given by a set of nodes $X = \{x_i\}_{i=1}^{N}$ and associated weights $\{w_i\}_{i=1}^N$. The definate integral is then approximated by

$$ \int_a^b f(x) \ dx \approx \sum_{i=1}^N w_i f(x_i). $$

Interpolation based quadratures rely on approximating the function $f$ by a function $s$ that interpolates $f$ at the quadrature nodes

$$ f(x_i) = s(x_i) \text{ for } i=1, 2, 3, \dots N $$

and then exactly integrating $s$. That is

$$ \int_a^b f(x) \ dx \approx \int_a^b s(x) \ dx. $$

We can represent this in the form above by defining cardinal basis functions. Let $\ell_i$ be the interpolant of the delta function $f(x) = \delta(x - x_i)$. Then for an arbitrary function $f$, the interpolant $s$ is given as

$$ s(x) = \sum_{i=1}^N f(x_i) \ell(x). $$

Our quadrature weights are thus

$$ w_i = \int_{a}^{b} \ell_i(x) \ dx. $$

In this way, our quadrature weights are uniquely defined by our nodes and interpolation.

The piecewise polynomial interpolant

First, we partition the domain $[a, b]$ into a set of intervals

$$ \mathcal{D} = {I_1, I_2, \dots, I_M} = {[a, \xi_1], [\xi_1, \xi_2], \dots, [\xi_{M-1}, b]} $$

where the values $\xi_i$ are called break-points.

For each interval, $I_i$, we associate a non-empty subset of our quadrature nodes $S_i \subset X$ called the stencil.

Our interpolant is defined piecewise over each interval $I_i$ as the polynomial that interpolates $f$ at the nodes in the stencil $S_i$.

Some Sample QF on equally spaced points.

A natural set of quadrature formulae arrise for equally spaced points.

First, choose a number of points $N$ and place them equally spaced in the interval $[a, b]$. Then choose an order parameter $k \ge 2$. For even orders, the break-points are chosen to be the quadrature nodes themselves. For odd orders, the break points are placed halfway between each successive pair of nodes. In either case the stencil for an interval is chosen to be the $k$ nearest quadrature nodes.

The special case of $k=2$ gives the Trapezoidal Rule.

Due to translational symmetries, all of the interior quadrature weights will be the constant

$$ \frac{1}{h} = \frac{b-a}{N - 1}. $$

It is therefore only necessary to list the weights near the boundary that differ from this value.

We can present these weights in a standardized format: choose a grid to be the positive integers (so $h=1$) and only report the weights that differ from 1. We then have

$\mathcal{O}(2)$ $\frac{1}{2}$
$\mathcal{O}(3)$ $\frac{3}{8}$ $\frac{7}{6}$ $\frac{23}{24}$
$\mathcal{O}(4)$ $\frac{1}{3}$ $\frac{31}{24}$ $\frac{5}{6}$ $\frac{25}{24}$
$\mathcal{O}(5)$ $\frac{95}{288}$ $\frac{317}{240}$ $\frac{23}{30}$ $\frac{793}{720}$ $\frac{157}{160}$
$\mathcal{O}(6)$ $\frac{51}{160}$ $\frac{991}{720}$ $\frac{59}{90}$ $\frac{97}{80}$ $\frac{1333}{1440}$ $\frac{91}{90}$
$\mathcal{O}(7)$ $\frac{5257}{17280}$ $\frac{22081}{15120}$ $\frac{54851}{120960}$ $\frac{103}{70}$ $\frac{89437}{120960}$ $\frac{16367}{15120}$ $\frac{23917}{24192}$
$\mathcal{O}(8)$ $\frac{278}{945}$ $\frac{185153}{120960}$ $\frac{3667}{15120}$ $\frac{8167}{4480}$ $\frac{733}{1890}$ $\frac{156451}{120960}$ $\frac{2777}{3024}$ $\frac{905}{896}$
$\mathcal{O}(9)$ $\frac{25713}{89600}$ $\frac{1153247}{725760}$ $\frac{130583}{3628800}$ $\frac{903527}{403200}$ $- \frac{797}{5670}$ $\frac{6244961}{3628800}$ $\frac{56621}{80640}$ $\frac{3891877}{3628800}$ $\frac{1028617}{1036800}$
$\mathcal{O}(10)$ $\frac{81385}{290304}$ $\frac{5982811}{3628800}$ $- \frac{105103}{518400}$ $\frac{3384373}{1209600}$ $- \frac{27673}{28350}$ $\frac{371081}{145152}$ $\frac{175523}{1209600}$ $\frac{4758181}{3628800}$ $\frac{6767167}{7257600}$ $\frac{14269}{14175}$
$\mathcal{O}(11)$ $\frac{4777223}{17418240}$ $\frac{19494601}{11404800}$ $- \frac{21664009}{45619200}$ $\frac{20082647}{5702400}$ $- \frac{357595981}{159667200}$ $\frac{101509}{24948}$ $- \frac{177536819}{159667200}$ $\frac{80938271}{39916800}$ $\frac{212182463}{319334400}$ $\frac{255314179}{239500800}$ $\frac{783809}{788480}$
$\mathcal{O}(12)$ $\frac{1657}{6160}$ $\frac{1693103359}{958003200}$ $- \frac{183182141}{239500800}$ $\frac{155823623}{35481600}$ $- \frac{52948363}{13305600}$ $\frac{41542229}{6386688}$ $- \frac{54633}{15400}$ $\frac{601537459}{159667200}$ $- \frac{2733413}{13305600}$ $\frac{48112633}{35481600}$ $\frac{44838553}{47900160}$ $\frac{38522153}{38320128}$
$\mathcal{O}(13)$ $\frac{106364763817}{402361344000}$ $\frac{681136420843}{373621248000}$ $- \frac{1401331298077}{1307674368000}$ $\frac{2832366494131}{523069747200}$ $- \frac{438200202533}{69742632960}$ $\frac{4442934458299}{435891456000}$ $- \frac{1965283}{250250}$ $\frac{3251907989573}{435891456000}$ $- \frac{125285857217}{49816166400}$ $\frac{249304895401}{104613949440}$ $\frac{820902291229}{1307674368000}$ $\frac{2775843989651}{2615348736000}$ $\frac{473293717537}{475517952000}$
$\mathcal{O}(14)$ $\frac{27770156197}{106748928000}$ $\frac{4910982739693}{2615348736000}$ $- \frac{1830414679453}{1307674368000}$ $\frac{17308443934079}{2615348736000}$ $- \frac{3239871500473}{348713164800}$ $\frac{6802893055867}{435891456000}$ $- \frac{105610027}{7007000}$ $\frac{130582029653}{8895744000}$ $- \frac{13824839392867}{1743565824000}$ $\frac{2819830208717}{523069747200}$ $- \frac{752403440483}{1307674368000}$ $\frac{3634010752403}{2615348736000}$ $\frac{4920175305323}{5230697472000}$ $\frac{28145907}{28028000}$
$\mathcal{O}(15)$ $\frac{25221445}{98402304}$ $\frac{7577074249153}{3923023104000}$ $- \frac{109758975737401}{62768369664000}$ $\frac{2619716486083}{326918592000}$ $- \frac{823993097730133}{62768369664000}$ $\frac{3652938751549}{156920924160}$ $- \frac{185364174597109}{6974263296000}$ $\frac{362611972}{13030875}$ $- \frac{406567190928929}{20922789888000}$ $\frac{5691974352499}{435891456000}$ $- \frac{11068437145699}{2510734786560}$ $\frac{2729565317047}{980755776000}$ $\frac{12392155500563}{20922789888000}$ $\frac{4149740674111}{3923023104000}$ $\frac{687122652947}{689762304000}$
$\mathcal{O}(16)$ $\frac{69181108}{273648375}$ $\frac{124527838997953}{62768369664000}$ $- \frac{8301345801121}{3923023104000}$ $\frac{602923312676921}{62768369664000}$ $- \frac{1596315823547}{89159616000}$ $\frac{2120764633122901}{62768369664000}$ $- \frac{172974549513301}{3923023104000}$ $\frac{21497071030031}{426995712000}$ $- \frac{53570696141}{1277025750}$ $\frac{1918959527598691}{62768369664000}$ $- \frac{58518753821611}{3923023104000}$ $\frac{474505422337963}{62768369664000}$ $- \frac{980645013239}{980755776000}$ $\frac{8132582533301}{5706215424000}$ $\frac{528870628631}{560431872000}$ $\frac{1285469654383}{1280987136000}$

This form makes it easy to compare to, for example, the Gregory weights.

Piecewise Polynomial Interpolation

This quadrature is an interpolation based quadrature. The interpolants found are piecewise polynomials with breakpoints at the nodes. The interpolants will be continuous, but we do not enforce any degree of smoothness over the break points (unlike splines).

Select a target order $k$. Over each subdomain $(x_{i}, x_{i+1})$ we select the $k$ closest nodes to this interval to be our stencil. We interpolate the stencil points with a dregree $k-1$ polynoial, then restrict the domain of this polynomial to the subdomain.

These quadrature rules are equivalent to integrating exactly this resulting interpolant.

Not Splines

These interpolants are not the traditional splines. Like splines, they are continuous piecewise polynomials. Unlike splines, they do not enforce smoothness. The figure below compares a function to the local interpolant (our interpolant) of degree 3 and also to a cubic spline with not-a-not boundary conditions. It also plots the first and second derivatives of each of these functions. Not Splines Note that the second derivative of the local interpolant is discontinuous at some of the breakpoints. This demonstrates that it is distinct from splines.

We can also compare the cardinal basis for the space of interpolants to the cardinal spline basis. Cardinal Basis We see from the cardinal basis that the local interpolant is not smooth over the breakpoints. It is not easy to see from this plot, but the cubic spline basis functions are supported over the entire interval. A consequence of this is that the interpolant over each piece depends on all of the function values over the entire interval. In contrast, the cardinal basis functions for local interpolation are supported only over a continguous set of $k-$ sub domains. This means that an individual piece of the interpolant is only sensitive to nearby function values. It is also the reason for the repeated quadrature weights far from the boundary, as the cardinal basis functions are simply translates of one another.

Convergence

I've tested convergence of the even order equally spaced quadrature formulae above on several test functions.

We see that convergence is roughly $\mathcal{O}(h^k)$ for smooth functions. Exponential test

We avoid error from Runge's phenomenon. Runge test

Furthermore we are exact up to numerical error on polynomials of degree less than $k$. Polynomial test

Lastly, convergence is limited by the smoothness of our function. Non-smooth test

About

A quadrature formula based on piecewise polynomial interpolation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published