2

In the standard literature topics like numerical differentiation and numerical integration are usually discussed in detail. However, numerical integration is not the same as calculating the (true) antiderivative numerically.

What is the reason nobody is discussing this topic? Is there simply no application for this?

Note that the antiderivative is unique up to a constant.


To expand:

The function $f(x)=x$ is given at five discrete points (Legendre-Gauss)

$x_i= \begin{pmatrix} -0.906 & -0.538 & 0.000 & 0.538 & 0.906 \end{pmatrix}^\text{T} $

with function values

$f_{i}= \begin{pmatrix} -0.906 & -0.538 & 0.000 & 0.538 & 0.906 \end{pmatrix}^\text{T} $

f

and the related quadrature weights

$\omega_{j}= \begin{pmatrix} 0.237& 0.479& 0.569& 0.479& 0.237 \end{pmatrix} $

and the related derivative matrix at these points

$D_{ij}=\begin{pmatrix} -5.067&7.702&-4.044&1.960&-0.552\\ -0.960&-0.758&2.403&-0.929&0.244\\ 0.301&-1.435&-0.000&1.435&-0.301\\ -0.244&0.929&-2.403&0.758&0.960\\ 0.552&-1.960&4.044&-7.702&5.067\\ \end{pmatrix}$

and the related antiderivative matrix at these points

$A_{ij}=\begin{pmatrix} -0.109&-0.559&-0.262&0.030&-0.006\\ 0.029&-0.281&-0.334&0.062&-0.015\\ 0.000&0.000&0.000&0.000&0.000\\ 0.015&-0.062&0.334&0.281&-0.029\\ 0.006&-0.030&0.262&0.559&0.109\\ \end{pmatrix}$.

Note that

$A_{ij} \ne D_{ij}^{-1}$.


Now it is possible to define following numerical operations:

Numerical integration (quadrature)

$I=\omega_{j} f_i = 0.000$

Numerical differentiation

$\partial f_i=D_{ij} f_i = \begin{pmatrix} 1.000 & 1.000 & 1.000 & 1.000 & 1.000 \end{pmatrix}^\text{T} $

df

Numerical antidifferentiation

$F_i=A_{ij} f_i = \begin{pmatrix} 0.411 & 0.145& 0.000& 0.145& 0.411 \end{pmatrix}^\text{T} $

F

Note that applying the Fundamental theorem of calculus to this function

$ I = F(-1) - F(1)=0.000 $

would give you a similar result to Gauss quadrature.

ConvexHull
  • 1,287
  • 1
  • 4
  • 11
  • Just to clarify, from the antiderivative graph you show, I get the feeling that the the numerical antiderivative $\hat{G}(x)$ you compute is an approximation to $G(x) = \int_{0}^{x} f(s)\text{d}s$. Is that right? – Abdullah Ali Sivas May 08 '21 at 06:38
  • @AbdullahAliSivas Yes it is the antiderivative of the polynomial approximation. The calculation of the antiderivative matrix is similar to the calculation of the derivation matrix, however the other way round. I am curious no literature is discussing this topic. – ConvexHull May 08 '21 at 07:23
  • It is exact up to roundofferrors in this case. – ConvexHull May 08 '21 at 07:47
  • 1
    The basic answer is that for orthogonal polynomials, the integration weights are as good you can get and it's a diagonal matrix. I'll expand that later into an answer, because it's a good question. – davidhigh May 08 '21 at 08:42
  • See also https://scicomp.stackexchange.com/questions/21869/plot-integral-function on plotting a numerical anti-derivative or primitive function. – Lutz Lehmann May 08 '21 at 08:44
  • @davidhigh Can you elaborate on this. My main issue is the lack of literature. In the meanwhile i found some useful applications. I will share an additional answer. – ConvexHull May 09 '21 at 06:46
  • @ConvexHull: I will, hopefully this evening (in Germany), and I'll also point to some literature – davidhigh May 09 '21 at 07:38
  • @ConvexHull You don't have to use integration matrices to achieve your goals though. For example, MATLAB's cumulative trapezoidal integration ( https://www.mathworks.com/help/matlab/ref/cumtrapz.html ) achieves the same result. You could also use other cumulative quadrature techniques and basically cut the middle man (interpolation of the function) and interpolate the result of the cumulative quadrature to approximate the antiderivative. It definitely has place in scientific computing, just I dont know anyone who approaches the problem the way you do. – Abdullah Ali Sivas May 09 '21 at 09:15
  • @AbdullahAliSivas Thank you. I am aware that antiderivatives may be defined via parameter integrals. You call it cumulative integration. $\int_a^x f(t),\mathrm dt$ – ConvexHull May 09 '21 at 10:11

3 Answers3

3

Ok, here is the answer promised in the comment section. I thought I would have more time to elaborate, but as usual, that was not the case, so I'll just add some thoughts

First of all, there is no obvious definition of the antiderivative matrix $A$, because the derivative matrix $D$ is one order short to full rank. This is akin to the fact that he antiderivative has a an integration constant $c$. So, claiming $AD=I$ od $DA = I$ won' t work.

There is a method called rectangular spectral collocation (google!), which takes this into account and from the first defines a rectangular derivative matrix of size $N \times N-1$. Moreover, in this context, people use integration matrices as preconditioner, which allow to avoid the influence badly conditioned derivative matrices. These matrices, however, are defined as a solution to a Birkhoff interpolation problem. But this just as a pointer whether integration matrices are used in the literature.

Now to your question, 'why they are not used more'. This is quite subjective, but I'd say, they're not often needed. Take your case, numerical integration: Instead of applying a matrix (which takes $\mathcal O(N^2)$ and then making use of the fundamental theorem, one can simply use Gaussian or Newton-Cotes integration, which is at least as accurate. For the special functions you mention in your answer, there are more appropriate methods, but even if one wanted to go with numerical integration, one could use standard integration methods as well.

davidhigh
  • 3,127
  • 14
  • 15
1

Antiderivatives are considered through numerical integration. The following antiderivative

$$\int f(x)\, dx = G(x) + C\, ,$$

can be rewritten as

$$\frac{d G(x)}{dx} = f(x)\, .$$

And then solved numerically.

nicoguaro
  • 8,500
  • 6
  • 23
  • 49
1

One useful application is the calculation of antiderivatives of nonelementary integrable functions. They are obviously only approximations.

Error Integral:

$\text{erf}(\tilde{x})=\int e^{-x^2}\,dx$

enter image description here

Trigonometric Integral:

$\text{si}(\tilde{x})=\int \frac{\sin x}{x}\,dx$

enter image description here

ConvexHull
  • 1,287
  • 1
  • 4
  • 11