Towards non-linear quadrature formulae

Abstract: Prompted by an observation about the integral of exponential functions of the form $f(x)=\lambda\mathrm{e}^{\alpha x}$, we investigate the possibility to exactly integrate families of functions generated from a given function by scaling or by affine transformations of the argument using nonlinear generalizations of quadrature formulae. The main result of this paper is that such formulae can be explicitly constructed for a wide class of functions, and have the same accuracy as Newton-Cotes formulae based on the same nodes. We also show how Newton-Cotes formulae emerge as the linear case of our general formalism, and demonstrate the usefulness of the nonlinear formulae in the context of the Padé-Laplace method of exponential analysis.

\section{Motivation}

One of the most basic tasks in numerical analysis is the approximate evaluation
of definite integrals by quadrature formulae. Since one of the most fundamental
properties of integration is its linearity, typical quadrature formulae consist
of taking linear combinations of the values of the integrand at specific values
of the integration variable. Depending on whether only the linear coefficients
(weights) or also the abscissae (nodes) are adjusted to minimize the error made
in the numerical evaluation, one gets families of quadrature formulae such as
the Newton-Cotes or Gaussian quadrature formulae. These are then exact on
polynomials of a given degree.

However, the case sometimes arises that one needs to evaluate the integral of
some numerically given function which is known to be very close to a family of
functions (other than polynomials) whose integrals are known analytically. As
an example, which arises for instance in the analysis of time series known to
consist of a sum of exponentially decaying components using the Padé-Laplace
method \cite{Yeramian:1987nature} or in certain calculations in theoretical
high-energy physics \cite{Bernecker:2011gh},
consider a function $f$ which is known to be very close to an
exponential, $|f(x)-\lambda\mathrm{e}^{\alpha x}|<\epsilon$. Then the integral of this
function can be approximated by
\begin{equation}
\int_a^b f(x)\,\mathrm{d} x =
\frac{\lambda}{\alpha}\left(\mathrm{e}^{\alpha b}-\mathrm{e}^{\alpha a}\right)
  +\mathrm{O}\left(\epsilon(b-a)\right).
\end{equation}
This approximation is still useful even if $\lambda$ and $\alpha$ are not known
beforehand, because they can be estimated from $f$. Indeed, within the bound
given by $\epsilon$, we can replace
$\lambda\mathrm{e}^{\alpha a}$ and $\lambda\mathrm{e}^{\alpha b}$ by $f(a)$ and $f(b)$,
respectively,
and estimate $\alpha$ from the numerical derivative of the logarithm of $f$ as
$\alpha = \frac{1}{h}\left(\log f(x+h)-\log f(x)\right) + \mathrm{O}(h)$. Putting
these ingredients together, we arrive at a non-linear quadrature formula
\begin{equation}
\int_a^b f(x)\,\mathrm{d} x \approx \frac{f(b)-f(a)}{\log f(b)-\log f(a)} (b-a).
\label{eq:exemplary}
\end{equation}
We note that this formula is exact for functions of
the form $f(x)=\lambda\mathrm{e}^{\alpha x}$, which form a non-linear family. In the
following, we will try to develop a more general theoretical background for
non-linear quadrature formulae of this kind.

Even though the results we will obtain are not especially deep and ought to be
well-known, there appears to be hardly any literature on the topic of
non-linear quadrature formulae, apart from two papers by Werner \cite{Werner:1978CMwA}
and Wuytack \cite{Wuytack:1975JCAM}, which relate to the use of rational interpolants
or Padé approximants instead of interpolating polynomials to integrate functions known
to have a singularity at one end of the integration interval. Our approach here
will be much more general and will take eq.~(\ref{eq:exemplary}) as its
exemplary case.

To this end, we will first define the class of non-linear quadrature formulae we will
be considering, and will derive some general results on their accuracy and
analytical properties as a consequence of their behaviour on certain families
of functions. As an excursion, we will consider the traditional Newton-Cotes formulae as
special (linear) cases of the general (non-linear) case and rederive some
well-known results in this way. Finally, we give some explicit examples and perform
some numerical experiments to investigate the potential usefulness of
non-linear quadrature rules.

\section{General results}

We will typically consider integration over an interval of length $h>0$ and
write
\begin{equation}
I[f] = \int_a^{a+h}f(x)\,\mathrm{d} x
\end{equation}
for the definite integral. We will approximate this by a (generally non-linear)
function
$q:\mathbb{R}^n\to\mathbb{R}$ of $\hat{f}=(f(a+\xi_0 h),\ldots,f(a+\xi_{n-1}h))\in\mathbb{R}^n$
via
\begin{equation}
\hat{I}[f] = h q(\hat{f})
\end{equation}
in the sense that
\begin{equation}
\left|\hat{I}[f]-I[f]\right|=o(h^r)
\end{equation}
for some $r>1$. We will assume throughout that $q$ and $f$ are sufficiently
smooth.

To make such approximations useful, one typically has to require that they
become exact in some limiting case. We therefore define several properties that
will become useful in the following:

\begin{defn}
A non-linear quadrature formula $\hat{I}$ is
\begin{enumerate}
\item \emph{exact} on a function $f^*$ if $\hat{I}[f^*]=I[f^*]$ for all $h>0$,
\item \emph{scalably exact} on a function $f^*$ if there exist
$\lambda_-<1<\lambda_+$ such that $\hat{I}[\lambda f^*]=I[\lambda f^*]$
for all $\lambda\in(\lambda_-;\lambda_+)$ and all $h>0$,
\item \emph{affinely exact} on a function $f^*$ if with
$f^*_{\alpha,\beta}(x)=f^*(\alpha x+\beta)$
we have $\hat{I}[f^*_{\alpha,\beta}]=I[f^*_{\alpha,\beta}]$
for all $\alpha,\beta\in\mathbb{R}$ and $h>0$,
\item \emph{symmetric} if $\xi_{n-1-k}=1-\xi_k$ for all $k\in\{0,\ldots,n-1\}$
and $q(f_{n-1},\ldots,f_0)=q(f_0,\ldots,f_{n-1})$ for all $f\in\mathbb{R}^n$, and
\item \emph{quasilinear} if $q(\lambda\hat{f})=\lambda q(\hat{f})$ for all
$\lambda\in\mathbb{R}$ and all $\hat{f}\in\mathbb{R}^n$.
\end{enumerate}
\end{defn}

The idea behind these definitions is that we will take exactness on a family of
target functions as our guide
as to the goodness of a quadrature rule (while noting that this has recently
been pointed out by Trefethen \cite{Trefethen:20210109501} to not be an entirely
reliable heuristic in the case of traditional linear quadrature rules), and we
will attempt to preserve at least some of the linear properties of integration
when acting on these target functions.

First, we show that scalably exact quadratures are at least no worse
than the trapezoidal rule on general functions:
\begin{lem}\label{lem:noworse}
Let $n=2$, $\xi_0=0$, $\xi_1=1$.
If there exists a function $f^*$ with $f^*(a)\not=0$ and $f^{*'}(a)\not=0$
such that $\hat{I}$ is scalably exact on $f^*$,
then $\left|\hat{I}[f]-I[f]\right|=o(h^2)$ for all $f\in C^2(a,a+h)$.
\begin{proof}
The Taylor expansion in $h$ of the exact integration is given by
\begin{equation}
I[f] = f(a) h + \frac{1}{2}f'(a)h^2 + \frac{1}{6}f''(a)h^3 + o(h^3)
\end{equation}
whereas that of the two-point quadrature formula is given by
\begin{equation}
\hat{I}[f] = q(\bar{f}) h + q^{(0,1)}(\bar{f}) f'(a) h^2 +
\frac{1}{2}\left(q^{(0,2)}(\bar{f})[f'(a)]^2+q^{(0,1)}(\bar{f})f''(a)\right)h^3 + o(h^3)
\end{equation}
where $\bar{f}=(f(a),f(a))$ and we understand $q(\bar{f})$ to denote
$\lim_{f_b\to f(a)} q(f(a),f_b)$ in the case where $q(\bar{f})$ itself is
ill-defined. In order for these to be identical for all
$f=\lambda f^*$, we need to have $q(\bar{f})=f(a)$ and
$q^{(0,1)}(\bar{f})=\frac{1}{2}$ for all $\bar{f}$.
Hence, we have for arbitrary $f\in C^2(a,a+h)$ that
\begin{equation}
\left|\hat{I}[f]-I[f]\right| =
\left|\frac{1}{2}q^{(0,2)}(\bar{f})[f'(a)]^2+\frac{1}{12}f''(a)\right|h^3 + o(h^3) =
o(h^2).
\end{equation}
\end{proof}
\end{lem}

Noting that the exactness of $\hat{I}$ on functions of the form $\lambda f^*$
requires linearity of $q$ in the vicinity of $\bar{f}^*$ since $\hat{I}[\lambda
f^*]=I[\lambda f^*]=\lambda I[f^*]=\lambda\hat{I}[f^*]$, we find relationships
between the partial derivatives of $q$:
\begin{lem}
Let $\hat{I}$, $f^*$ be as in Lemma \ref{lem:noworse}. Then
\begin{align}
q^{(1,0)}(\bar{f}^*) + q^{(0,1)}(\bar{f}^*) &= 1, \nonumber\\
q^{(0,2)}(\bar{f}^*) + q^{(1,1)}(\bar{f}^*) &= 0, \\
q^{(0,2)}(\bar{f}^*) + 2q^{(1,1)}(\bar{f}^*) + q^{(2,0)}(\bar{f}^*) &= 0
   \nonumber\\
q^{(0,3)}(\bar{f}^*)
+3q^{(1,2)}(\bar{f}^*) + 3q^{(2,1)}(\bar{f}^*)+q^{(3,0)}(\bar{f}^*) &= 0,
   \nonumber\\
q^{(0,3)}(\bar{f}^*) + 2q^{(1,2)}(\bar{f}^*)+q^{(2,1)}(\bar{f}^*) &= 0.
   \nonumber
\end{align}
\begin{proof}
We expand the exact integral (which is of course linear) in powers of $h$
\begin{equation}
I[\lambda f^*] = h\lambda f^*(a) + \frac{1}{2}h^2\lambda
f^*{}'(a)+\frac{1}{6}h^3\lambda f^*{}''(a)+o(h^3)
\end{equation}
and perform a double expansion of $\hat{I}[\lambda f^*]$ into powers of $h$ and
$\lambda-1$,
\begin{align}
\hat{I}[\lambda f^*] &=
h\Big[q(\bar{f}^*)+(\lambda-1)f(a)\left(q^{(1,0)}(\bar{f}^*) +
q^{(0,1)}(\bar{f}^*)\right) \\
&~~~~~ +\frac{(\lambda-1)^2}{2}f(a)^2\left(q^{(0,2)}(\bar{f}^*) +
2q^{(1,1)}(\bar{f}^*) + q^{(2,0)}(\bar{f}^*)\right) \nonumber\\
&~~~~~ +\frac{(\lambda-1)^2}{6}f(a)^3\left(q^{(0,3)}(\bar{f}^*)
+3q^{(1,2)}(\bar{f}^*) + 3q^{(2,1)}(\bar{f}^*)+q^{(3,0)}(\bar{f}^*)\right)\Big] \nonumber\\
&+\frac{1}{2}h^2 f^*{}'(a)\Big[\lambda +
2\lambda(\lambda-1)f(a)\left(q^{(0,2)}(\bar{f}^*) +
q^{(1,1)}(\bar{f}^*)\right)\nonumber\\
&~~~~~ +(\lambda-1)^2 \lambda f(a)^2\left(q^{(0,3)}(\bar{f}^*) +
2q^{(1,2)}(\bar{f}^*)+q^{(2,1)}(\bar{f}^*)\right)\Big]\nonumber\\
&+o(h^2)+o(h(\lambda-1)^3)+o(h^2(\lambda-1)^2)\nonumber
\end{align}
and equality for all $\lambda$ and $h$ is only possible if the given relations
hold.
\end{proof}
\end{lem}

We therefore find that scalably exact non-linear quadratures locally resemble the
trapezoidal rule:

\begin{corol} Let $n=2$, $\xi_0=0$, $\xi_1=1$, and let $\hat{I}$ be scalably
exact on $f^*$ with $f^*{}'(a)\not=0$.
Then
\begin{equation}
q(f(a),f(b)) = \frac{f(a)+f(b)}{2} - \frac{1}{12} \frac{f^*{}''(a)}{[f^*{}'(a)]^2}
(f(b)-f(a))^2 + o\left(|f(b)-f(a)|^2\right).
\end{equation}
\begin{proof}
Since $\hat{I}[f^*]=I[f^*]$, we must have
\begin{equation}
\frac{1}{2}\left(q^{(0,2)}(\bar{f}^*)[f^{*'}(a)]^2+q^{(0,1)}(\bar{f}^*)f^*{}''(a)\right)
= \frac{1}{6}f^*{}''(a)
\end{equation}
and using $q^{(0,1)}(\bar{f})=\frac{1}{2}$ then yields
\begin{equation}
q^{(0,2)}(\bar{f}^*) = -\frac{1}{6} \frac{f^*{}''(a)}{[f^*{}'(a)]^2}.
\end{equation}
Substituting this into the Taylor expansion of $q(f(a),f(b))$ around
$f(b)=f(a)$ and using the relations between the partial derivatives of $q$
found above yields the result.
\end{proof}
\end{corol}

We note that this corollary can be used to construct an improved trapezoidal
rule for functions known \emph{a priori} to be close to multiples of a given
function $f^*$ for which no explicit form of $q$ satisfying
$\hat{I}[\lambda f^*]=I[\lambda f^*]$ is known by simply setting
\begin{equation}
q(f(a),f(b)) = \frac{f(a)+f(b)}{2} - \frac{1}{12} \frac{f^*{}''(a)}{[f^*{}'(a)]^2}
(f(b)-f(a))^2
\end{equation}
to reduce the integration error of the trapezoidal rule by using the known
curvature behaviour of $f^*$.

Essentially identical results can be shown for affinely exact non-linear
quadrature formulae:
\begin{lem}\label{lem:aff}
Let $n=2$, $\xi_0=0$, $\xi_1=1$.
If there exists a function $f^*$ with $f^*(a)\not=0$ and $f^{*'}(a)\not=0$
such that $\hat{I}$ is affinely exact on $f^*$,
then $\left|\hat{I}[f]-I[f]\right|=o(h^2)$ for all $f\in C^2(a,a+h)$. Moreover,
\begin{align}
q^{(1,0)}(\bar{f}^*) + q^{(0,1)}(\bar{f}^*) &= 1, \nonumber\\
q^{(0,2)}(\bar{f}^*) + q^{(1,1)}(\bar{f}^*) &= 0, \\
q^{(0,2)}(\bar{f}^*) + 2q^{(1,1)}(\bar{f}^*) + q^{(2,0)}(\bar{f}^*) &= 0
   \nonumber\\
q^{(0,3)}(\bar{f}^*)
+3q^{(1,2)}(\bar{f}^*) + 3q^{(2,1)}(\bar{f}^*)+q^{(3,0)}(\bar{f}^*) &= 0,
   \nonumber\\
q^{(0,3)}(\bar{f}^*) + 2q^{(1,2)}(\bar{f}^*)+q^{(2,1)}(\bar{f}^*) &= 0.
   \nonumber
\end{align}
\begin{proof}
We start by noting that the Taylor expansion of $I[f^*_{\alpha,\beta}]$ in $h$
is
\begin{equation}
I[f^*_{\alpha,\beta}] = h f^*(\alpha a+\beta) +
\frac{\alpha h^2}{2}f^{*}{}'(\alpha a+\beta) + o(h^2)
\end{equation}
whereas that of $\hat{I}[f^*_{\alpha,\beta}]$ is
\begin{equation}
\hat{I}[f^*_{\alpha,\beta}] = h q(\bar{f}^*_{\alpha,\beta}) +
\alpha h^2 q^{(0,1)}(\bar{f}^*_{\alpha,\beta}) f^*{}'(\alpha a+\beta) + o(h^2)
\end{equation}
and equality for all $h,\alpha,\beta$ is only possible if for all values of
$\bar{f}$ with $f(a)$ in the range of $f^*$ the equalities $q(\bar{f})=f(a)$
and $q^{(0,1)}(\bar{f})=\frac{1}{2}$ hold, implying
$\left|\hat{I}[f]-I[f]\right|=o(h^2)$ as in Lemma \ref{lem:noworse}.
Furthermore, the Taylor expansions around $\alpha=0$ of the coefficients of $h$
and $h^2$ are
\begin{align}
q(\bar{f}^*_{\alpha,\beta}) &= q(\bar{f}^*_{0,\beta})+ \alpha a
f^*{}'(\beta)\left(q^{(0,1)}(\bar{f}^*_{0,\beta})+q^{(1,0)}(\bar{f}^*_{0,\beta})\right)
\\
&+\frac{(\alpha a)^2}{2}
\Big[f^*{}''(\beta)\left(q^{(0,1)}(\bar{f}^*_{0,\beta})+q^{(1,0)}(\bar{f}^*_{0,\beta})\right)\nonumber\\
&~~~~~ + [f^*{}'(\beta)]^2\left(q^{(0,2)}(\bar{f}^*_{0,\beta}) +
2q^{(1,1)}(\bar{f}^*_{0,\beta}) +
q^{(2,0)}(\bar{f}^*_{0,\beta})\right)\Big] \nonumber\\
&+\frac{(\alpha a)^3}{6}
\Big[f^*{}^{(3)}(\beta)\left(q^{(0,1)}(\bar{f}^*_{0,\beta})+q^{(1,0)}(\bar{f}^*_{0,\beta})\right)\nonumber\\
&~~~~~ + 3f^*{}'(\beta)f^*{}''(\beta)\left(q^{(0,2)}(\bar{f}^*_{0,\beta}) +
2q^{(1,1)}(\bar{f}^*_{0,\beta}) +
q^{(2,0)}(\bar{f}^*_{0,\beta})\right)\nonumber\\
&~~~~~ +[f^*{}'(\beta)]^3\left(q^{(0,3)}(\bar{f}^*_{0,\beta})+3q^{(1,2)}(\bar{f}^*_{0,\beta})+3q^{(2,1)}(\bar{f}^*_{0,\beta})+q^{(3,0)}(\bar{f}^*_{0,\beta})\right)
\Big]\nonumber \\
&+ o(\alpha^3)\nonumber
\end{align}
and
\begin{align}
q^{(0,1)}(\bar{f}^*_{\alpha,\beta}) f^*{}'(\alpha a+\beta) &=
f^*{}'(\beta)q^{(0,1)}(\bar{f}^*_{0,\beta})\\
&+\alpha a \Big[f^*{}''(\beta)q^{(0,1)}(\bar{f}^*_{0,\beta}) \nonumber\\
&~~~~~ +[f^*{}'(\beta)]^2\left(q^{(0,2)}(\bar{f}^*_{0,\beta})+q^{(1,1)}(\bar{f}^*_{0,\beta})\right)\Big]
\nonumber \\
&+\frac{(\alpha a)^2}{2} \Big[
f^*{}^{(3)}(\beta)q^{(0,1)}(\bar{f}^*_{0,\beta})\nonumber \\
&~~~~~ +3 f^*{}'(\beta)f^*{}''(\beta)\left(q^{(0,2)}(\bar{f}^*_{0,\beta}) +
q^{(1,1)}(\bar{f}^*_{0,\beta})\right)\nonumber\\
&~~~~~ +[f^*{}'(\beta)]^3\left(q^{(0,3)}(\bar{f}^*_{0,\beta})+2q^{(1,2)}(\bar{f}^*_{0,\beta})+q^{(2,1)}(\bar{f}^*_{0,\beta})\right)
\Big]\nonumber \\
&+ o(\alpha^2),\nonumber
\end{align}
which must be equal to
\begin{align}
f^*(\alpha a+\beta) &= f^*(\beta)+\alpha a f^*{}'(\beta)+\frac{(\alpha
a)^2}{2}f^*{}''(\beta)+\frac{(\alpha a)^3}{6}f^*{}^{(3)}(\beta) + o(\alpha^3)
\end{align}
and
\begin{align}
\frac{1}{2}f^{*}{}'(\alpha a+\beta) &= \frac{1}{2} f^*{}'(\beta)+\frac{\alpha
a}{2}f^*{}''(\beta)+\frac{(\alpha a)^2}{4}f^*{}^{(3)}(\beta) + o(\alpha^2)
\end{align}
respectively, whence the relations immediately follow.
\end{proof}
\end{lem}

The equations for the partial derivatives of scalably or affinely exact $q$ are
readily solved, leading to the following

\begin{corol}\label{cor:pders}
Let $n=2$, $\xi_0=0$, $\xi_1=1$, and let $\hat{I}$ be scalably or affinely
exact on some function $f^*$ with $f^*(a)\not=0$ and $f^{*'}(a)\not=0$. Then
\begin{align}
q(\bar{f}) &= f(a), \nonumber\\
q^{(1,0)}(\bar{f}) &= q^{(0,1)}(\bar{f}) = \frac{1}{2}, \\
q^{(2,0)}(\bar{f}) &= -q^{(1,1)}(\bar{f}) = q^{(0,2)}(\bar{f}). \nonumber
\end{align}
If $\hat{I}$ is moreover symmetric, then also
\begin{equation}
q^{(3,0)}(\bar{f}) = -3
q^{(1,2)}(\bar{f})=-3q^{(2,1)}(\bar{f})=q^{(0,3)}(\bar{f}).
\end{equation}
\qed
\end{corol}

At least for a certain class of functions, symmetric affinely exact non-linear
quadrature formulae are readily constructed:
\begin{thm}\label{thm:construct}
Let $f^*:\mathbb{R}\to R\subseteq\mathbb{R}$ be bijective with inverse function
$f^*{}^{-1}$, and let $F^*$ be an antiderivative of $f^*$. Define
\begin{equation}\label{eq:construct}
q_1(f_0,f_1) =
\frac{F^*(f^*{}^{-1}(f_1))-F^*(f^*{}^{-1}(f_0))}{f^*{}^{-1}(f_1)-f^*{}^{-1}(f_0)}.
\end{equation}
Then
\begin{equation}
\hat{I}_1[f]=h q_1(f(a),f(a+h))
\end{equation}
is symmetric and affinely exact on $f^*$, and with
\begin{equation}\label{eq:constructh4}
q_2(f_0,f_1,f_2) =
\frac{2}{3}\left(q_1(f_0,f_1))+q_1(f_1,f_2)\right)-\frac{1}{3}q_1(f_0,f_2)
\end{equation}
the three-point non-linear quadrature formula with $\xi_0=0$,
$\xi_1=\frac{1}{2}$, $\xi_2=1$ given by
\begin{equation}
\hat{I}_2[f] = h q_2(f(a),f(a+\frac{h}{2}),f(a+h))
\end{equation}
is symmetric and affinely exact on $f^*$ and
has $o(h^4)$ errors for $f\in C^4(\mathbb{R})$.
\begin{proof}
We have
\begin{equation}
q_1(f^*(\alpha a+\beta),f^*(\alpha (a+h)+\beta)) = \frac{F^*(\alpha
(a+h)+\beta)-F^*(\alpha a + \beta)}{\alpha(a+h)-\alpha a}
\end{equation}
and hence
\begin{equation}
\hat{I}[f^*_{\alpha,\beta}] = \frac{F^*(\alpha
(a+h)+\beta)-F^*(\alpha a + \beta)}{\alpha} = I[f^*_{\alpha,\beta}]
\end{equation}
as required. The symmetry of $q_1$ under an interchange of its two arguments is
readily apparent.

Since $q_1$ is a symmetric affinely exact non-linear quadrature formula, its
partial derivatives at each order are given by Corollary \ref{cor:pders}.
We form the linear combination
\begin{align}
q_2(\hat{f}) &= \alpha_1 q_1(f(a),f(a+h))\\
&+\alpha_2\left(q_1(f(a),f(a+\frac{1}{2}h))+q_1(f(a+\frac{1}{2}h),f(a+h))\right)\nonumber
\end{align}
and determine the weights $\alpha_i$ from expanding
\begin{align}
 h q_2(\hat{f}) &=
   \left(\alpha _1+2 \alpha _2\right) h f(a)+\frac{1}{2} \left(\alpha _1+2 \alpha
   _2\right) h^2 f'(a)\\\nonumber&+\frac{1}{8} h^3 \Big(2 \left(2 \alpha _1+\alpha _2\right)
   f'(a)^2 q_1{}^{(0,2)}(f(a),f(a))\\\nonumber&\;\;\;\;\;+\left(2 \alpha _1+3 \alpha _2\right)
   f''(a)\Big)\\\nonumber&+\frac{1}{48} h^4 \Big(
   4 \left(2 \alpha _1+\alpha _2\right) f'(a)^3 q_1{}^{(0,3)}(f(a),f(a))
\\\nonumber&\;\;\;\;\;+12\left(2 \alpha _1+\alpha _2\right) f''(a)q_1{}^{(0,2)}(f(a),f(a))
   \\\nonumber&\;\;\;\;\;+ \left(4\alpha _1 +5 \alpha _2\right) f^{(3)}(a) \Big)
+o\left(h^4\right)
\nonumber
\end{align}
and equating this with
\begin{equation}
I[f] = h f(a)+\frac{1}{2} h^2 f'(a)+\frac{1}{6} h^3 f''(a)+\frac{1}{24} h^4
   f^{(3)}(a)+o\left(h^4\right)
\end{equation}
which yields the solution $\alpha_1=-\frac{1}{3}$, $\alpha_2=\frac{2}{3}$.

Since each of
the approximations across subintervals is affinely exact, so is their linear
combination. The symmetry of $q_2$ follows from that of $q_1$ by inspection.
\end{proof}
\end{thm}

We note that the proof of eq.~(\ref{eq:constructh4}) only relied on $q_1$ being
affinely exact and symmetric, and hence this construction could also be used to
obtain an $o(h^4)$ quadrature rule $q_2$ from an affinely exact symmetric
quadrature rule $q_1$ that is not of the specific form (\ref{eq:construct}).
Similar constructions can be carried out to obtain analogues of higher-order
Newton-Cotes rules using additional nodes.

\section{Traditional quadrature rules as linear approximations}

We first note that when applying the construction of eq.~(\ref{eq:construct})
to the identity function $f^*(x)=x$ with inverse $f^*{}^{-1}(x)=x$ and
antiderivative $F^*(x)=\frac{1}{2}x^2+C$, we obtain the trapezoidal rule,
\begin{equation}
q(f_0,f_1) = \frac{\frac{1}{2} f_1^2-\frac{1}{2}f_0^2}{f_1-f_0} =
\frac{f_0+f_1}{2},
\end{equation}
which is affinely exact by construction, and hence is exact on all first-order
polynomials $f(x)=\alpha x+\beta$. We have thus given an alternative derivation
of a well-known result:

\begin{corol}
The trapezoidal rule
\begin{equation}
\hat{I}[f] = \frac{h}{2}\left(f(a)+f(a+h)\right)
\end{equation}
is exact for all first-order polynomials $f(x)$ and has $o(h^2)$ errors
for $f\in C^2(\mathbb{R})$ otherwise.
\end{corol}

We note that when the trapezoidal rule is used for $q_1$ in
eq.~(\ref{eq:constructh4}), the rule $q_2$ obtained in this way is precisely
Simpson's rule, yielding another alternative proof of a well-known result:

\begin{corol}
The quadrature rule
\begin{equation}
\hat{I}[f] = \frac{h}{6}\left(f(a)+4f(a+\frac{h}{2})+f(a+h)\right)
\end{equation}
has $o(h^4)$ for $f\in C^4(\mathbb{R})$.
\end{corol}

Similarly, the higher-order Newton-Cotes
rules can be obtained without any explicit reference to polynomial
interpolation by linearly combining the different evaluations of the integral
from $a$ to $a+h$ that can be formed using the trapezoidal rule on the nodes of
the higher-order Newton-Cotes rule and optimizing the coefficients of the
linear combination to minimize the total error:

\begin{corol}
Let $n$ be odd. Then the $n$-point quadrature rule
\begin{equation}
\hat{I}[f] = h\sum_{k=0}^{n-2} \alpha_k
\left(\xi_k\frac{f(a)+f(a+\xi_kh)}{2}+(1-\xi_k)\frac{f(a+\xi_kh)+f(a+h)}{2}\right)
\end{equation}
with $\xi_k=\frac{k}{n-1}$ and $\alpha_k$ given by the solution of the linear
equation system
\begin{equation}
\sum_{k=0}^{n-2}\alpha_k\left(\xi_k^j-\xi_k+1\right)=\frac{2}{j+1} \qquad
j=2,\ldots n
\end{equation}
is identical to the $n$-point Newton-Cotes rule with nodes $\xi_k$ (taking
$\xi_{n-1}=1$).
\begin{proof}
First, we note that by linearity, we can write
\begin{equation}
\hat{I}[f] = h\sum_{k=0}^{n-1} w_k f(a+\xi_k h)
\end{equation}
determining a unique linear $n$-point quadrature formula. Next, we note that
\begin{align}
\xi_k\frac{f(a)+f(a+\xi_kh)}{2}+(1-\xi_k)\frac{f(a+\xi_kh)+f(a+h)}{2}
&= \\ \nonumber f(a)h + \frac{1}{2}f'(a)h^2+\sum_{j=2}^\infty
\frac{1}{2j!}f^{(j)}(a)\left[\xi_k^j-\xi_k+1\right]h^{j+1}
\end{align}
and hence demanding that the Taylor expansion of $\hat{I}[f]$ matches that of
$I[f]$ up to order $h^{n+1}$ amounts to the $(n-1)\times(n-1)$ linear equation
system
\begin{equation}
\sum_{k=0}^{n-2}\alpha_k\left(\xi_k^j-\xi_k+1\right)=\frac{2}{j+1} \qquad
j=2,\ldots n
\end{equation}
which has a unique solution since the rows are polynomials of different orders
in $\xi_k$ and hence must be linearly independent. This unique solution yields
an $n$-point quadrature formula that is exact on polynomials of order $n-1$
(whose derivatives from the $n$\textsuperscript{th} on all vanish), and hence
must be identical to the $n$-point Newton-Cotes rule on nodes $\xi_k$, which is
defined by this exactness.
\end{proof}
\end{corol}

One easily verifies that Simpson's ($n=3$), Boole's ($n=5$) and Weddle's
($n=7$) rules are recovered in this way.

\section{Explicit Non-linear Examples and Numerical Experiments}

The construction of Theorem \ref{thm:construct} for $f^*(x)=\mathrm{e}^x$ yields
\begin{equation}\label{eq:qexp}
q_1(\hat{f}) = \frac{f(a+h)-f(a)}{\log \frac{f(a+h)}{f(a)}}
\end{equation}
which by construction is symmetric and affinely exact for $f^*(x)=\mathrm{e}^x$.
Since $\lambda\mathrm{e}^{\alpha x}=\mathrm{e}^{\alpha x+\beta}$ with $\beta=\log\lambda$,
the corresponding non-linear quadrature formula is also scalably exact
on all functions of the form $f(x)=\mathrm{e}^{\alpha x}$. Finally, this quadrature
formula is quasilinear since the numerator is linear and any scalar factor
$\lambda$ cancels within the denominator.

We have tested the accuracy of eq.~(\ref{eq:qexp}), and of the corresponding
three-point quadrature formula by comparison with the trapezoidal rule and
Simpson's rule, respectively. To this end we consider the integrals of
\begin{align}
f_1(x) &= \mathrm{e}^{-x}+\frac{1}{2}\mathrm{e}^{-2x}, \\
f_2(x) &= \sum_{n=1}^\infty \mathrm{e}^{-n x} = \frac{1}{\mathrm{e}^x-1}, \\
f_3(x) &= \cosh x, \\
f_4(x) &= \sin x,
\end{align}
over the intervals $[a;b] = [0,1]$, $[1;2]$, $[0;1]$, and
$[\frac{\pi}{8};\frac{\pi}{4}]$, respectively.

First, we consider the accuracy of a single step $[a;a+h]$. Figures
\ref{fig:trap} and \ref{fig:simps} show the comparison between the relative
errors
\begin{equation}
e(h) = \frac{|\hat{I}[f]-I[f]|}{|I[f]|}
\end{equation}
for the $o(h^2)$ and $o(h^4)$ cases in their respective left columns. The right
columns show the error ratios
\begin{equation}
r(h) = \frac{|\hat{I}[f]-I[f]|}{|\hat{I}_0[f]-I[f]|}
\end{equation}
where $\hat{I}$ and $\hat{I}_0$ are the non-linear and linear quadrature
formulae, respectively.

It can be seen that on $f_1$ and $f_2$, which are well described as being
dominated by a leading exponential, the non-linear quadrature formulae
outperform their linear counterparts by approximately an order of magnitude in
error in the case of $f_1$ and a factor of $2$ to $4$ in the case of $f_2$. In the
case of $f_3$, which is a sum of two exponentials, but with opposite signs of
the exponent, the advantage of the non-linear rules is very small in the
$o(h^2)$ case and non-existent in the $o(h^4)$ case, where Simpson's rule is
more efficient by a factor of $4$. In the case of $f_4$, which not a sum of
real exponentials at all (although it is the sum of complex exponentials), the
non-linear rules tailored to real exponentials fare very poorly, with one to
two orders of magnitude larger errors than their linear counterparts (a large
part of this likely being due to the fact that $f_4$ is positive and concave on
the integration interval, while the non-linear rules implicitly assume a
positive convex, or negative concave, function).

This is relevant to applications like the Padé-Laplace method or the
Bernecker-Meyer method, in which we also require the momenta of
multiexponential functions, and thus need to integrate products of
multiexponential functions given as data points and monomials $x^n$. In this
case, the integrand decays exponentially at large $x$, but grows polynomially
at small $x$, so that nonlinear quadrature rules for exponentials will only
work well at large $x$, while Newton-Cotes rules will be more appropriate at
small $x$. One way to determine where the change in regime to exponential decay
happens is to consider numerical derivatives of the data $f_k=f(kh)$ and to use
the nonlinear quadrature rule only in the convex decaying region wher
$f_k<f_{k-1}$ and $2f_k<f_{k-1}+f_{k+1}$, and to use Simpson's rule otherwise.

Given that the construction of Theorem \ref{thm:construct} takes the quotient
of two differences, the question of its numerical stability naturally arises.
This is even more pronounced in the case of the higher-order rule, which
involves an additional difference due to the negative coefficient
$-\frac{1}{3}$. This expectation is borne out by the numerical data, which show
the advantage of the nonlinear rules over the linear ones vanishing as the step
size $h$ is reduced to below a point where the differences become numerically
unstable.

As the examples of the trapezoidal rule and Simpson's rule in the previous
section show, numerical instability is not a given since there may be a
manifestly stable form of the quadrature rule that is mathematically equivalent
to the construction of Theorem \ref{thm:construct} in exact arithmetic.
Whenever possible, it is therefore desirable to bring the quadrature rule
derived from Theorem \ref{thm:construct} into a form that involves as few
differences as possible.

Next, we consider the convergence of the full integrals over $[a;b]$ evaluated
using $N$ steps from $a+kh$ to $a+(k+1)h$ with $h=\frac{b-a}{N}$. Figure
\ref{fig:multi} shows the exact values of the integrals as dotted horizontal
lines and the numerical evaluations using the $o(h^2)$ and $o(h^4)$ rules in
the left and right columns, respectively (note that the vertical scales in the
left and right columns differ markedly). The approach to the continuum limit is
as expected from the previous two figures. We note that a form of Romberg
quadrature based on the non-linear formulae should work as well (or better in
the nearly-exponential cases where the extrapolation is much flatter) as
traditional Romberg quadrature based on the linear formulae.

Finally, we note that for the case (common in applications) where we need to
estimate an improper integral out to infinity from a finite number of samples
$f(x_k)$, we can readily generalize eq.~(\ref{eq:qexp}) in order
to get a quadrature rule for improper integrals of the form
\begin{equation}
\int_a^\infty f(x)\,\mathrm{d} x \approx h\frac{f(a)}{\log \frac{f(a)}{f(a+h)}}
\end{equation}
assuming that $f$ is monotonically decaying with exponential speed such that
the integral converges and $f(a)>f(a+h)$. This rule is scalably exact on all
functions of the form $f(x)=\mathrm{e}^{\alpha x}$, but the error analysis for the
case of the proper integral does not carry through (as there is notably no $h$
dependence of the left-hand side).

\section{Conclusions and Outlook}

We have defined general classes of non-linear quadrature rules that are exact
on certain families of functions related by scaling of their value
or affine transformations of their argument,
and have shown that such non-linear quadrature rules must
obey various relations between their partial derivatives. Our core result is
Theorem~\ref{thm:construct}, which gives an explicit construction of affinely
exact non-linear quadrature rules for given target functions and demonstrates
that these can be combined to yield higher-order non-linear quadrature rules.
Numerical experiments demonstrate the superiority of the non-linear formulae on
functions close to the families on which they are exact, while also indicating
that their usefulness outside this intended domain of application is rather
limited.

Future research should adress the question of how to generalize Gaussian
quadrature to the non-linear case. The most naive approach of simply varying
the nodes $\xi_k$ and trying to reach higher-order accuracy by an optimal
choice does not work in general. However, there is a tantalizing glimpse of
what non-linear Gaussian integration could look like in the form of the
$o(h^4)$ two-point formula
\begin{equation}
q(f_0,f_1) =
\frac{f_0-f_1}{\log\frac{f_0}{f_1}}-\frac{1}{12}(f_0-f_1)\log\frac{f_0}{f_1}
\end{equation}
with $f_0=f(a+\xi h)$, $f_1=(a+(1-\xi)h)$, $\xi=\frac{3-\sqrt{3}}{6}$,
which, however, is no longer scalably exact or affinely exact on exponential
functions. It is probably no accident that the nodes $\xi$, $1-\xi$ are
precisely those of $n=2$ Gauss-Legendre quadrature, but a general theory of
such quadrature rules is still elusive. Likewise, non-linear analogues of
Clenshaw-Curtis quadrature would be an interesting direction of research.

\begin{figure}[p]
{\centering
\includegraphics[width=0.49\textwidth]{figures/err_comp_qexp_qtrap_func1.pdf}
\includegraphics[width=0.49\textwidth]{figures/err_ratio_qexp_qtrap_func1.pdf}\\
\includegraphics[width=0.49\textwidth]{figures/err_comp_qexp_qtrap_func2.pdf}
\includegraphics[width=0.49\textwidth]{figures/err_ratio_qexp_qtrap_func2.pdf}\\
\includegraphics[width=0.49\textwidth]{figures/err_comp_qexp_qtrap_Cosh.pdf}
\includegraphics[width=0.49\textwidth]{figures/err_ratio_qexp_qtrap_Cosh.pdf}\\
\includegraphics[width=0.49\textwidth]{figures/err_comp_qexp_qtrap_Sin.pdf}
\includegraphics[width=0.49\textwidth]{figures/err_ratio_qexp_qtrap_Sin.pdf}\\
}
\caption{\label{fig:trap}
Comparison between the non-linear exponential rule (blue) and the trapezoidal
rule (red) of the relative error $|\hat{I}[f]-I[f]|/|I[f]|$ (left) and the
ratio of the errors between the two rules (right) on a range of integrands (top
to bottom: $\mathrm{e}^{-x}+\frac{1}{2}\mathrm{e}^{-2x}$, $[\mathrm{e}^x-1]^{-1}$, $\cosh x$,
$\sin x$). See the text for details.
}
\end{figure}

\begin{figure}[p]
{\centering
\includegraphics[width=0.49\textwidth]{figures/err_comp_qexpsimps_qsimps_func1.pdf}
\includegraphics[width=0.49\textwidth]{figures/err_ratio_qexpsimps_qsimps_func1.pdf}\\
\includegraphics[width=0.49\textwidth]{figures/err_comp_qexpsimps_qsimps_func2.pdf}
\includegraphics[width=0.49\textwidth]{figures/err_ratio_qexpsimps_qsimps_func2.pdf}\\
\includegraphics[width=0.49\textwidth]{figures/err_comp_qexpsimps_qsimps_Cosh.pdf}
\includegraphics[width=0.49\textwidth]{figures/err_ratio_qexpsimps_qsimps_Cosh.pdf}\\
\includegraphics[width=0.49\textwidth]{figures/err_comp_qexpsimps_qsimps_Sin.pdf}
\includegraphics[width=0.49\textwidth]{figures/err_ratio_qexpsimps_qsimps_Sin.pdf}\\
}
\caption{\label{fig:simps}
Comparison between the higher-order non-linear exponential rule (blue) and
Simpson's rule (red) of the relative error $|\hat{I}[f]-I[f]|/|I[f]|$ (left) and the
ratio of the errors between the two rules (right) on a range of integrands (top
to bottom: $\mathrm{e}^{-x}+\frac{1}{2}\mathrm{e}^{-2x}$, $[\mathrm{e}^x-1]^{-1}$, $\cosh x$,
$\sin x$). See the text for details.
}
\end{figure}

\begin{figure}[p]
{\centering
\includegraphics[width=0.49\textwidth]{figures/multistep__qexp_qtrap_func1.pdf}
\includegraphics[width=0.49\textwidth]{figures/multistep__qexpsimps_qsimps_func1.pdf}\\
\includegraphics[width=0.49\textwidth]{figures/multistep__qexp_qtrap_func2.pdf}
\includegraphics[width=0.49\textwidth]{figures/multistep__qexpsimps_qsimps_func2.pdf}\\
\includegraphics[width=0.49\textwidth]{figures/multistep__qexp_qtrap_Cosh.pdf}
\includegraphics[width=0.49\textwidth]{figures/multistep__qexpsimps_qsimps_Cosh.pdf}\\
\includegraphics[width=0.49\textwidth]{figures/multistep__qexp_qtrap_Sin.pdf}
\includegraphics[width=0.49\textwidth]{figures/multistep__qexpsimps_qsimps_Sin.pdf}\\
}
\caption{\label{fig:multi}
Comparison between the results from multistep evaluation of integrals using the non-linear exponential rule (blue) and the trapezoidal
rule (red) on the lest, and the higher-order non-linear exponential rule (blue) and
Simpson's rule (red) on the right. The integrands are (top
to bottom) $\mathrm{e}^{-x}+\frac{1}{2}\mathrm{e}^{-2x}$, $[\mathrm{e}^x-1]^{-1}$, $\cosh x$,
$\sin x$. Note the differences in scale. See the text for details.
}
\end{figure}

\section*{Conflicts of interest}

The author is not aware of any personal, professional, financial, political or
other circumstances that could give rise to a relevant conflict of interest.

\section*{Acknowledgements}

The author is grateful to Ron R. Horgan and Harvey B. Meyer for useful comments.

Numerical Analysis (math.NA); High Energy Physics - Lattice (hep-lat); Computational Physics (physics.comp-ph)

Towards non-linear quadrature formulae