Questions tagged [quadrature]
Also called numerical integration, quadrature refers to the approximation of an integral made by evaluating the integrand at a finite number of points.
142
questions
0
votes
0
answers
43
views
3D Quadrature schemes with points on boundary
In one dimension there are two types of quadrature schemes.
asymmetric rules like Newton-Cotes like formulas (Trapezodi, Simpson), and Clenshaw-Curtis place sampling points on boundary of the ...
3
votes
1
answer
159
views
Optimal quadrature rule for heavy tail measure
I'm looking for a well-thought quadrature rule for this measure
$d\mu(t)=\frac{dt}{t^s}$ for $s\in(0,1)$, the underlying motivation is to compute this integral
$$
\lambda^{s-1}=\frac{1}{\Gamma(1-s)}\...
2
votes
0
answers
75
views
Quadrature rules with the weight function $w(x) = |x|^\gamma$
I am interested in integrals of the form
$$
\int_{[0,1]^{d}} |x|^{\gamma}f(x)dx.
$$
$\gamma>0$ and $f$ has some singular behavior at $\vec{0}$. The weight function $|x|^\gamma$ is commonly used in ...
1
vote
0
answers
95
views
Integration problem
I want to numerically solve integrals of the form,
$$
I = \int_a^b x^k f(x) dx
$$
where $k$ is a given integer, and $f(x)$ is a cubic polynomial, expressed as,
$$
f(x) = c_0 + c_1 (x - a) + \frac{c_2}{...
0
votes
0
answers
42
views
Quadrature rules for products of 2D regions
I am interested in computing integrals of the form $\iint_{P\times P} Q(x_1,x_2,y_2,y_2) dxdy$ where $P$ is a polygon and $Q$ is a polynomial. The coordinates $(x_1,x_2)$ are in the plane of $P$. Of ...
5
votes
2
answers
204
views
Which way is the right way to compute the integrals in finite element methods?
Finite element methods involve integrals of functions that are not polynomials, and these integrals must be computed numerically.
For example, suppose that $f$ is the right-hand side of a Poisson ...
2
votes
1
answer
188
views
Quadrature of rational functions
I have a class of integrals I need to solve numerically which have the form:
$$
I_k = \int_a^b \frac{p_k(x)}{x^k} dx, \quad k = 0, 1, \dots, K
$$
where $p_k(x)$ is a cubic polynomial on the interval $[...
1
vote
1
answer
100
views
numerical integration of integrals in the p-adaptive version of the finite element method
In the p-adaptive version of the finite element method, elements are allowed to have shape functions with arbitrary different polynomial orders. Therefore regarding a 2D problem with quadrilateral ...
4
votes
0
answers
130
views
Quadrature rules for non-linear finite element problems
For solving linear problems stemming from PDEs with the FEM, such as the Poisson equation or the wave equation, it is customary to use the "simplest" numerical quadrature that exactly ...
6
votes
3
answers
267
views
Numerical integration giving incorrect sign
For my research, I need to integrate the following function:
$$
W(z)=\int_0^{\infty}dx\ w(x,z)\\
=\int_0^{\infty}dx\frac{e^x}{(e^x+1)^2}\log{\left(\frac{e^{z^2/4x+x}+1}{e^{z^2/4x+x}-e^x}\right)}\\
=\...
5
votes
2
answers
174
views
Optimizing a quadratic form integral over unit sphere
I have an optimization problem, which is to maximize the following integral over the unit sphere:
$$
\max_B \int d\Omega \mathbf{f}^{\dagger}(\theta,\phi) (B^{\dagger} + B) \mathbf{f}(\theta,\phi)
$$
...
2
votes
1
answer
174
views
Variational loss of hp-Variational Physics Informed Neural Networks for 2D-Poisson Equation in Tensorflow
I am trying to reproduce the results from the hp-VPINN paper (https://arxiv.org/pdf/2003.05385.pdf) on tensorflow (v1) for Poisson's equation, particularly the two-dimensional Poisson equation.
In one ...
0
votes
1
answer
107
views
How is the integral of a projection over an element $T$ computed in practice? (deal.II related)
I'm studying an error estimator for the equation $\nabla\cdot(\beta u) + cu = f$ and it contains the following term $$||f - cU_h - \Pi(f-c U_h) ||_T$$
where :
$\Pi$ is the local orthogonal $L^2$ ...
1
vote
1
answer
367
views
Compute 2D numerical double integration with Boost C++ with parameters
I am trying to compute the double Richardson and Wolf integrals for the focusing of a lens with Boost in C++ (using the Gauss Kronrod method).
As a starting point, I used the example presented in this ...
0
votes
0
answers
41
views
Calculating magnetic flux density
I have a geometry where current density distribution is constant. I can calculate the $z$ component of magnetic flux density according to Biot-Savart law as following:
$$B_z(x,y,z) = \int\limits_x\int\...
-1
votes
1
answer
1k
views
Integrate function with cumulative distibution function inside
I'm trying to integrate a function which is defined as func in my code below, a cumulative distribution function is inside:
...
6
votes
1
answer
1k
views
Gauss-Lobatto quadrature and nodal points for FEM
By using the Legendre-Gauss-Lobatto (LGL) quadrature formula (QF) and LGL nodal points one achives a diagonal mass-matrix for finite element problems. (More specifically, the spectral element method.)
...
-1
votes
1
answer
109
views
Integral over a surface, given experimental data
I have a mesh of a 3D surface composed by triangles, and I have the value of a function $u(x,y,z)$ in every vertex of the mesh (every vertex of each triangle).
I need to calculate the following ...
3
votes
1
answer
185
views
Find quadrature points and weights
I'm struggling with the following problem:
What is the maximum degree of exactness that we can obtain with the following quadrature >formula
$$\int_0^1 f(x)\frac{1}{\sqrt{x}}dx \approx w_0 f(x_0) +...
3
votes
1
answer
571
views
How to use numerical integration to calculate the surface area of a superellipsoid?
I am working in an application in which I need to calculate the surface area of a superellipsoid. I have read that there is no closed form solution (see here), so I am trying to compute it using ...
2
votes
3
answers
191
views
Numerical solution of high-dimensional integral involving positive-part function
Consider a potentially high-dimensional (say, $N$ up to 20) integral of the form
$$
\int_0^\infty \rho_1(x_1)\rho_2(x_2) \cdots \rho_N(x_N) \bigg(x_1+x_2+\cdots+x_N -K\bigg)^+ \, dx_1 \cdots dx_N.
$$
...
0
votes
0
answers
68
views
Adaptive quadrature methods for Fourier Optics
In Fourier Optics one often needs to compute approximations to bivariate integrals like
$$
\int_{-\frac{l}{2}}^{\frac{l}{2}}\int_{-\frac{l}{2}}^{\frac{l}{2}} {\rm e}^{i\phi(\xi,\eta)}\mathrm{exp}\left[...
1
vote
0
answers
163
views
Is Romberg integration method implemented as weighted function values numerically correct?
I have to integrate expression f(x) * g(x) for many different functions f but just one g.
I ...
2
votes
0
answers
51
views
To use the confluent hypergeometric function or not to?
I am numerically computing the following integral as a function of positive $k$.
$$I(k) := \int_0^\infty x^b(k+x)^{a-1} e^{-x} dx \tag1$$
It is shown in math.stackexchange.com that this can be ...
4
votes
1
answer
1k
views
Performing 2d numerical integration with Boost Cpp
I've been learning to use the numerical quadrature of the Boost library for Cpp. In the documentation, I've found an example for 1D Gauss-Kronrod Quadrature using Boost.
...
2
votes
1
answer
745
views
How to implement Simpson's rule for double integral (without numeric limits of first integral)
I want to use Simpson's rule to evaluate the following double integral:
$$\int_{a}^{b}\left|\int_{0}^{z}x\cdot \mathrm{erf}(x-10)\cdot J_{0}(x) \mathrm{dx}\right|^{2}\exp(-0.5*(z-40)^2)\mathrm{dz} $$
...
1
vote
1
answer
120
views
Evaluating an indefinite integral that has no closed form
I need to evaluate the following indefinite integral:
$$I=\int\frac{x^5+2ax^3+a^2x-4a}{x^7+ax^5+2ax^4}dx=\int\frac{x^5+2ax^3+a^2x-4a}{x^4(x^3+ax+2a)}dx$$
The solution that I obtained while ...
1
vote
1
answer
86
views
Algorithm for evaluation of spin-weighted spherical harmonics
Is there an algorithm to evaluate spin-weighted spherical harmonics (swSH) at arbitrary points on the sphere? In particular I am looking for, e.g. a recursion relation to evaluate the "spin weighted ...
7
votes
1
answer
239
views
Numerical calculation of Integral of Si(x)/x
I'm interested in evaluating
\begin{equation}
\int_0^x \frac{Si(t)}{t}\;dt
\end{equation}
Where
\begin{equation}
Si(x) = \int_0^x \frac{\sin t}{t}\;dt
\end{equation}
I've found a nice method for ...
4
votes
2
answers
7k
views
Numerical evaluation of a Gaussian Integral in Python?
Goal
I'm trying to write code to compute the normalized Gaussian in the following,
$$
\begin{equation}
\int_{-\infty}^{\infty} \frac{1}{ \sigma \sqrt{2 \pi}} \exp\bigg( - \frac{(x - \mu)^{2}}{2 \...
11
votes
3
answers
854
views
Numerical evaluation of highly oscillatory integral
In this advanced course on applications of complex function theory at one point in an exercise the highly oscillatory integral
$$I(\lambda)=\int_{-\infty}^{\infty} \cos (\lambda \cos x) \frac{\sin x}...
-2
votes
1
answer
106
views
How to : numerical integration by quadrature in C language / remove NaN
What I wanna solve it the problem following
( by quadrature method )
I want to get two arrays of data ( z & tau )
from z[0], tau[0] to z[2249], tau[2249].
Since the integrand diverges at z=0.9, ...
1
vote
0
answers
48
views
How to integrate the contents of a vector using an adaptive quadrature routine [duplicate]
I have a function which requires the return type to be a container. The problem is that I need to integrate the contents of the container as efficiently as possible and was hoping to use adaptive ...
2
votes
0
answers
61
views
Does adaptive Gauss-Kronrod reuse function evaluations?
I'm curious to know how QUADPACK's QAG routine works. My understanding is that it begins by calculating on each subinterval the numerical quadrature with a Gaussian-Legendre rule and a nested Kronrod ...
1
vote
1
answer
28
views
Domain transformation squashing interior quadrature nodes into boundary
In many quadrature problems, we are interested in computing $\int_a^b f(x) \, \mathrm{d}x$ via a quadrature sum. However, most software packages precompute the quadrature nodes and weights for use ...
7
votes
0
answers
96
views
Quadrature methods for peaky integrands
Consider
$$
I = \int_{-L}^L f(x)dx,
$$
where $f(x)$ is real-valued and analytic on $[-L,L]$, but it has a pole in the complex plane whose real part lies in $[-L,L]$. Call it $z_0$, and assume it is a ...
0
votes
1
answer
176
views
How to cope with the following singularity
I have the following integral:
$\int_{1}^{Xd} \dfrac{(X^{z_i}-1)}{[X^2 \sum_{l=1}^{N}c_l(X^{z_l}-1)]^{1/2}}dX = \int_{1}^{Xd} h(X) dX$
where:
Xd is a real that can be either negative, positive or ...
6
votes
1
answer
356
views
How do I integrate a function defined over an arbitrary area?
Let's say, I have a compact area $S$ (for example a circle, a square or some arbitrary polygon) and a function $f: S \rightarrow \mathbb{R}$. I want to numerically calculate the Integral
$$ \int_S f(\...
1
vote
2
answers
339
views
How many quadrature points should I use?
I am trying to compute the following integration
$$
\int_0^\infty e^{-y}y^{a/2}L_c^b(y)L_e^d(y)dy
$$
using the generalized Gauss-Laguerre quadrature routine in the GNU Scientific Library. Here the $L$'...
1
vote
0
answers
29
views
Algorithm for integrating a 6D function in a Morse-Smale 3D cell
Lets say that one has a scalar field defined in 3D space for whose gradient he wants to find the Morse-Smale Complex for later performing an integration of several hexa-dimensional functions over ...
5
votes
1
answer
315
views
What is the best numerical method for a six dimensional spherical integral?
I am trying to do integrals of the type
$$
\int d^3\vec{p} \int d^3\vec{p}' e^{-p^2} e^{-{p'}^2}f(\vec{p}, \vec{p}')
$$
where $\vec{p}$ and $\vec{p}'$ are three dimensional vectors represented using ...
7
votes
3
answers
244
views
Evaluating an integral numerically at many points
Given a real function $f$, how can one efficiently evaluate $\int_0^{a_i}f(x)dx$ for millions of different $a_i$?
Applying a standard quadrature method (such as Simpson's rule or Gaussian quadrature) ...
12
votes
2
answers
415
views
For noisy or fine-structured data, are there better quadratures than the midpoint rule?
Only the first two sections of this long question are essential. The others are just for illustration.
Background
Advanced quadratures such as higher-degree composite Newton–Cotes, Gauß–Legendre, ...
3
votes
0
answers
316
views
Convergence of Gauss quadrature for a discontinuous function
Is there a known error estimate for Gaussian quadrature when applied to a discontinuous function?
For simple one-dimensional experiments, the error appears to be bounded by $C h$, where $C$ is some ...
1
vote
0
answers
53
views
Stability of different quadrature rules in 1st-kind Volterra integral equation
I am dealing with a integral equation
$$ f'(t) = -\int_0^t K(s) f(t-s)\quad t\in [0,t_\max] \tag{1}$$
in which $f(t)$ and $f'(t)$ are known, well-behaved functions of $t$ and $K(t)$ is the unknown. In ...
5
votes
1
answer
170
views
Kernel-based differentiation
Consider a $\mathcal{C}^1$ function $V:\Omega\rightarrow\mathbb{R}$ where $\Omega\subset\mathbb{R}^n$. If a random vector $X$ has a parametric density $p_\theta(\textbf{x})$ that's smooth in its ...
5
votes
2
answers
239
views
Building Gaussian-type quadrature schemes with Zernike polynomials
The abscissas for Gauss quadrature are given by the zeros of the Legendre polynomials. The Legendre polynomials form an orthogonal set over $[-1, 1]$, and it is shown in (for instance) Kress that the ...
-3
votes
1
answer
69
views
Modulus (absolute) of a function, its quadrature, and relevance of zeros
Modulus of a (discretized) function, $|f_h(x)|$, where $h$ refers to the mesh spacing, would, in general, have zeros, and those zeros would not necessarily lie exactly at the mesh points.
A naive <...
0
votes
1
answer
141
views
Reference for Dunavant Quadrature Implementations
I am using Dunavant quadrature in my software, specifically this file by John Burkardt. Recently, I wanted to convert the code into a constexpr code in C++. But ...
5
votes
1
answer
2k
views
2D numerical integration with infinite limit (C++)
In order to integrate a two dimensional function of the form
$$\int_{1}^\infty \int_{-\sqrt{x^2-1}}^{\sqrt{x^2-1}} e^{-x} \rm{d}y \rm{d}x,$$
I have been attempting to use the following code (written ...