The midpoint rule of numerical integration

$\displaystyle \int_a^b f(x)\,dx \approx (b-a)f\left(\frac{a+b}{2}\right)$

is approximate in general, but exact for linear functions (polynomials of degree at most one).

With two sample points we can integrate any cubic polynomial exactly. The choice of sample points is not obvious: they are to be placed at distance ${\dfrac{1}{2\sqrt{3}}(b-a)}$ from the midpoint. On the example below, ${a=0}$ and ${b=1}$, so the sample points are ${x_{1,2} = \dfrac12 \pm \dfrac{1}{2\sqrt{3}}}$. The integral is equal to ${\dfrac12 f(x_1)+\dfrac12 f(x_2)}$. One can say that each sample point has weight ${1/2}$ in this rule.

Three sample points are enough for polynomials of degrees up to and including five. This time, the weights attached to the sample points are not equal. The midpoint is used again, this time with the weight of ${4/9}$. Two other sample points are at distance ${\dfrac{\sqrt{3}}{2\sqrt{5}}(b-a)}$ from the midpoint, and their weights are ${5/18}$ each. This contraption exactly integrates polynomials of degrees up to five.

Compare this with Simpson’s rule, which also uses three sample points but is exact only up to degree three.

The above are examples of Gaussian quadrature: for each positive integer ${n}$, one can integrate polynomials of degree up to ${2n-1}$ by taking ${n}$ samples at the right places, and weighing them appropriately.

Let’s move from the real line to the complex plane. If one accepts that the analog of interval ${(a,b)}$ is a disk in the plane, then quadrature becomes very simple: for any disk ${D}$ and any complex polynomials ${p}$,

$\displaystyle \iint_D p = \pi r^2 p(c)$

where ${c}$ is the center of the disk and ${r}$ is its radius. One sample point is enough for all degrees! The proof is easy: rewrite ${p}$ in terms of powers of ${(z-c)}$ and integrate them in polar coordinates. The same works for any holomorphic function, as long as it is integrable in ${D}$.

But maybe the disk is a unique such shape? Not at all: there are other such quadrature domains. A simple family of examples is Neumann ovals (Neumann as in “boundary condition”). Geometrically, they are ellipses inverted in a concentric circle. Analytically, they are (up to linear transformations) images of the unit disk ${\mathbb{D}}$ under

$\displaystyle \varphi(z)=\frac{z}{1-c^2 z^2}\quad (0\le c<1)$

This image, denoted ${\Omega }$ below, looks much like an ellipse when ${c}$ is small:

Then it becomes peanut-shaped:

For ${c\approx 1}$ it looks much like the union of two disks (but the boundary is smooth, contrary to what the plot suggests):

In each of these images, the marked points are the quadrature nodes. Let’s find out what they are and how they work.

Suppose ${f}$ is holomorphic and integrable in ${\Omega}$. By a change of variables,

$\displaystyle \iint_{\Omega } f = \iint_{\mathbb D} (f\circ \varphi)\, \varphi' \,\overline{\varphi'}$

Here ${ (f\circ \varphi) \varphi'}$ is holomorphic, but ${ \overline{\varphi'} }$ is anti-holomorphic. We want to know what ${ \overline{\varphi'} }$ does when integrated against something holomorphic. Power series to the rescue:

$\displaystyle \varphi(z) = z\sum_{n=0}^\infty c^{2n} z^{2n} = \sum_{n=0}^\infty c^{2n} z^{2n+1}$

hence

$\displaystyle \overline{\varphi'(z)} = \sum_{n=0}^\infty c^{2n} (2n+1) \bar z^{2n}$

Multiply this by ${z^{k}}$ and integrate over ${\mathbb D}$ in polar coordinates: the result is ${0}$ if ${k}$ is odd and

$\displaystyle 2\pi c^{k} (k+1) \int_0^1 r^{2k} r\,dr= \pi c^{k}$

if ${k}$ is even. So, integration of ${\overline{\varphi'(z)}}$ against a power series ${g(z) = \sum a_k z^k}$ produces the sum of ${a_{k} c^{k}}$ over even powers ${k}$ only (with the factor of ${\pi}$). The process of dropping odd powers amounts to taking the even part of ${g}$:

$\displaystyle \iint_{\mathbb D} g\, \overline{\varphi'} = \frac{\pi}{2} ( g(c)+ g(-c))$

Yes, there’s something about ${ \overline{\varphi'} }$ that’s magic (key words: reproducing kernel, specifically Bergman kernel). Plug ${g= (f\circ \varphi)\, \varphi' }$ to conclude

$\displaystyle \iint_{\Omega } f = \frac{\pi}{2} \Big\{f(\varphi(c))\, \varphi'(c) + f(\varphi(-c) ) \,\varphi'(-c)\Big\}$

So, the nodes are ${\varphi(\pm c) = \pm c/(1-c^4)}$. They have equal weight, because ${\varphi'(\pm c) = \dfrac{1+c^4}{(1-c^4)^2}}$. Final result:

$\displaystyle \iint_{\Omega } f = \frac{\pi (1+c^4)}{2 (1-c^4)^2}\, \left\{f \left( \frac{c}{1-c^4} \right) + f \left(- \frac{c}{1-c^4} \right) \right\}$

Again, this is a two-point quadrature formula that is exact for all complex polynomials.

As a bonus, put ${f\equiv 1}$ to find that the area of ${\Omega}$ is ${\dfrac{\pi (1+c^4)}{ (1-c^4)^2}}$.

## Diana the Huntress and curve-fitting

Diana the Huntress was created by Anna Hyatt Huntington in 1934.

The sculpture was moved recently, and the guardrail was added very recently (this week, I think). Walking around it, one can clearly see that the guardrail is not round. What shape does it have? Direct measurements are difficult because the sculpture gets in the way.

It is natural to conjecture that the shape is an ellipse. A wonderful property of the ellipse is that it remains an ellipse in any perspective. This is despite the fact that the rectangle bounding the ellipse can be projected into an arbitrary convex quadrilateral.

Thus, the conjecture can be tested directly on the photograph: if the curve is an ellipse, then its original form is also an ellipse. And conversely. Since the rail has nonzero thickness, I worked with its upper outer edge. The ratio of major axes was measured at ${b/a\approx 0.454}$ which corresponds to the eccentricity ${e=\sqrt{1-(b/a)^2}\approx 0.89}$. Also, the angle between the major axis and the horizontal line was measured at ${\approx 0.0956}$ radian.

I created such an ellipse in fooplot using the polar form ${\displaystyle r=\frac{a(1-e^2)}{1+e\cos (\theta-\theta_0)}}$.

After adjusting the pixel size, it fit the outer edge very well:

And this is how math solves Real World Problems.