This page is about cubature formulae for numerical integration over the unit disk. In the first part we try to derive coefficients by direct approach, second is devoted to Gauss rules for 2D unit disk based on product of two 1D quadratures.
We offer C/C++ open source library which allows user to estimate integral over disk with center at where can be arbitrary. Algorithm is based on Gauss product rules and includes high-precision coefficients.
Direct derivation
We would like to build approximation of the integral
by the weighted sum of integrand values
where are such that is exact on polynomials . Formulas of such type are called cubatures of algebraic degree .
After switching to polar coordinates we obtain
and
Let’s represent in the form of multivariate Maclaurin series as
This gives us approximation error conveniently expressed through function derivatives.
To unsure exactness on polynomials up to total degree of we have to find such that multipliers of all partial derivatives in are equal to zero. This leads to the system of nonlinear equations, which can be solved analytically for small and numerically for the higher degrees.
Additionally we set and to be symmetric, since such choice makes cubature exact on naturally, where at least one of or is odd.
Below we show several cubature formulas derived by the explained procedure.
Please leave comment on this page if you find these formulas useful.
Product rule
Derivation of optimal cubatures with minimal function evaluations required to achieve given algebraic degree is not an easy task, they are known only for some (see [1],[2]).
However if we want to build cubatures for any desired approximation order we can use product of two 1D rules to estimate . Although this approach is not optimal in the sense of number of integrand evaluations it gives flexible and easy way of cubature derivation (see [1],[2],[6] for details) which we repeat here.
At first we use slightly different transformation to polar coordinates:
After substitution in the second integral we get
These integrals can be computed separately from each other by using 1D Gauss quadratures.
We use Gauss-Chebyshev formula of the first kind for approximation
where nodes and weights are known in the closed form
To compute second integral
we need to build Gauss quadrature with weight function . I have no access to [3] where it is considered in details, so I derived points and coefficients using standard procedure for constructing quadrature formulas [5]:
- Find coefficients of two-term recursion relation for monic polynomials orthogonal on with weight :
- Find eigenvalues and first component of eigenvectors of principal leading minor of Jacobi matrix:
It is a symmetric tridiagonal matrix. Implicit QL algorithm can be applied to solve this task efficiently (
sterf
,stein
routines in LAPACK). Then points are calculated eigenvalues. Weights where is the first component of corresponding eigenvector).
In our case , and can be calculated by analytical formula for any (send me e-mail if you are interested).
Combining both rules and we obtain Gauss-type cubature (or product rule) for the unit disk which has points and which is exact on polynomials of a total degree at most . Distribution of the points for some can be observed on these plots (click on image to zoom):
Download
C/C++ library implementing Gauss product rule for the integration over the disk (2D sphere) is available for download:
- Gauss 2D Sphere Cubature.zip (400KB)
It uses high-precision points and coefficients of 1D rules and to approximate integral over 2D sphere with center at .
Tools
I have used Maple for all symbolic calculations and QuickLaTeX for rendering mathematical equations on the web page. Unfortunately Maple was too slow and unstable for derivation of 1D -quadrature with . I ended up writing my own C++ program specifically for that using ALGLIB and multi-precision arithmetic library MPFR. Let me know if your interested in this program.
References
The most complete and recent compendium of cubature formulas is Encyclopaedia of Cubature Formulas maintained by Ronald Cools . He wrote several surveys on cubature formulas, some of them are available online, check his publication page.
In particular his survey on cubatures for unit disk is available here A survey of known and new cubature formulas for the unit disk. Although it doesn’t contain numeric values for weights and points (exept for ) it has huge number of useful links to other topic-specific papers.
[1] A.H. Stroud, Approximate calculation of multiple integrals, 1971.
[2] R. Cools, K.J. Kim, A survey of known and new cubature formulas for the unit disk.
[3] A.H. Stroud, D. Secrest, Gaussian Quadrature Formulas, 1966.
[4] G.H. Golub, J.H. Welsch, Calculation of Gauss quadrature rules, Math. Соmр. 23 1969.
[5] W. Gautschi, Orthogonal Polynomials: Computation and Approximation, 2004.
[6] I.P. Mysovskikh. Interpolatory cubature formulas. Moskva: “Nauka”. 1981. (Russian).
13 Comments
Hi
I downloaded Gauss_2D_Sphere_Cubature.zip and try to run example.c but got an error message that gauss_product_2D_sphere is not found.
Could you please let me know if gauss_product_2D_sphere is missing in the distribution and if it is send set to me.
Thanks
nagaraj.
You have to compile & link
gauss_2d_sphere.c
along withexample.c
.Thanks for making this available. When running the example, I notice that the error in the integral starts to increase for n > 50 (10^-13 as opposed to 10^-15). I don’t need that level of precision, but was curious if this is something particular to the function used in the example or a generic effect. Also, one rule in particular stands out: “n = 384: error = 2.44418289875682”. Maybe one of the coefficients for this rule is incorrect?
Brian, thank you for your feedback! My code contains cubature of following orders:
1-50, 64, 128, 192, 256, 320, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024, 2048
.No
384
is supported – sorry for not making clear this on the page.Ahh. Sorry, I assumed since it was being run in the example that a rule existed. The fact that the error is larger than the true value should have been enough of a hint…
Hi
I am trying to develop gauss like formulas for cubature over the unit disc with the constraint that all the points need to be located on three straight lines, all three lines intersecting on the boundary; in one point (say x=0, y=-1). This leaves entire areas not covered but what can be done?
Hi Bernard,
Interesting case. You can build 2D interpolating polynomial over the points you have and then derive cubature formula by integrating this polynomial. Take a closer look to “Direct derivation” section on the page – it briefly describes this idea (using power series instead of polynomial).
Let me know about your further progress on the task – it is very interesting for me.
By the way, are there any restrictions on number of points?
Location of lines is fixed or can be chosen?
Location of points on the lines is fixed (uniform sampling) or can be chosen?
Let me know if you need my further help.
This is a practical industrial problem
We want to get a flow by “sampling” velocities, in a pipe, in cases the ISO standart cannot be used
So practically the number of points is less than 16
The position location of the lines can be free as long as all 3 lines intersect on the circle x2+y2=1
more than 3 lines could be considered, all n lines having a common intersect, on the unit circle
On each line the location of the points is free. All points must be inside the unit disk, strictly (x2+y2 < 1)
The interpolating polynomial is not practical for field people. Setting a probe at given, preset locations, &nd appplying weights is. Regards
In your example for an 8 point cubature the radius of 4 of the points is sqrt((3+sqrt3)/3). This is obviously greater than 1.0 and outside the unit circle.
It is perfectly normal for cubature to have nodes outside unit disk. Check out paper by R. Cools (second reference in the list).
Constructing of cubature with all nodes inside sphere – is a real challenge and might not be possible at all (at least for algebraic accuracy)
Pavel,
Many thanks for freely providing the information on this webpage. I would like to use this cubature in my meshfree code and would like to confirm the points and weights. Are the cubature points given by x = r[j]*q[i] and y = r[j]*t[i] as shown in the example C++ code? With that said are the weights given by A*B? I am also interested in the C++ program using ALGIB mentioned above.
Many thanks,
JW.
Hi,
thanks for the article! I have a question: what if I want to integrate over a regular multidimensional rectangular domain, let’s say
and I want to compute the following definite n-dmensional integral
what’s the best numerical approach known in literature?
thanks!
marco
Hi Pavel,
Great resource! Question: Do you know where I could find Kronrod-type extensions for these formulae? Cools lists a couple of rules in his survey, but they all have fatal flaws, like negative weights, nodes outside the unit disk or on the boundary. Do Kronrod style extensions with positive weights and interior nodes exist?