# Validity of $\ln z=\frac{\pi}{\operatorname{AGP}(\theta_2^2(1/z),\theta_3^2(1/z))}$

Definitions

For the definitions of $$\operatorname{AGP}$$ and $$\operatorname{AGO}$$, see here or here. $$\theta_2(z)$$ and $$\theta_3(z)$$ are defined as follows: $$\theta_2(z)=\sum_{n=-\infty}^\infty z^{(n+1/2)^2},$$ $$\theta_3(z)=\sum_{n=-\infty}^\infty z^{n^2}$$ where $$z\in\mathbb{C}$$ and $$|z|\lt 1$$.

Problem

Due to Brent (pages 38 and 48), we have the following "formula": $$\ln z=\frac{\pi}{\operatorname{AGP}(\theta_2^2(1/z),\theta_3^2(1/z))}$$ where $$z\in\mathbb{C}\setminus (-\infty ,0]$$ and $$|z|\gt 1$$. It is based on Sasaki and Kanada's formula which is essentially the same, but less general: $$\ln x=\frac{\pi}{\operatorname{AGP}(\theta_2^2(1/x),\theta_3^2(1/x))}$$ where $$x\in\mathbb{R}$$ and $$x\gt 1$$.

Sasaki and Kanada's formula is fine, but Brent's formula turns out to be very problematic. For example, it works for $$z=-1-2i$$, but doesn't seem to work for $$z=-0.4+i$$ and $$z=0.4+i$$. All these complex numbers are greater than $$1$$ in absolute value and they don't lie on $$(-\infty ,0]$$.

To be specific, on page 48 Brent writes

The theory that we outlined for the $$\operatorname{AGM}$$ iteration and $$\operatorname{AGM}$$ algorithms for $$\log (z)$$ can be extended without problems to complex $$z\setminus (-\infty ,0]$$ provided we always choose the square root with positive real part.

Note that he is describing the $$\operatorname{AGP}$$. Apparently there are some problems, though. It is not clear what he means: can it be extended to some complex $$z\setminus (-\infty ,0]$$ or all complex $$z\setminus (-\infty ,0]$$? Nevertheless, on page 28, he is referencing Borwein & Borwein:

Given $$(a_0,b_0)$$, the $$\operatorname{AGM}$$ iteration is defined by $$(a_{n+1},b_{n+1})=\left(\frac{a_n+b_n}{2},\sqrt{a_nb_n}\right).$$ For simplicity we'll only consider real, positive starting values $$(a_0,b_0)$$ for the moment, but the results can be extended to complex starting values (see Borwein & Borwein, Pi and the AGM, pp. 15–16) and we'll use that later.

However, in their book on page 15 and 16, Borwein & Borwein write:

All of the algorithms and functional relations extend naturally to the complex domain. In fact, all the algorithms and functional equations of this section hold at least for $$k\in\{\operatorname{re}(z)\gt 0\}-[1,\infty )$$. The interested reader may readily establish the exact domains of validity for the various relations. The analysis of the $$\operatorname{AGM}$$ iteration for complex starting values is reasonably complicated (See Cox .) The problem is to decide which root is appropriate in the computation of $$b_{n+1}=\sqrt{a_nb_n}$$. The right choice is made to ensure $$|a_{n+1}-b_{n+1}|\le |a_{n+1}+b_{n+1}|$$ [with $$\operatorname{im}(b_{n+1}/a_{n+1})\gt 0$$ in the case of equality].

As you can see, Borwein & Borwein are describing $$\operatorname{AGO}$$, not $$\operatorname{AGP}$$. I was thinking that Brent just erroneously assumed $$\operatorname{AGP}$$ instead of $$\operatorname{AGO}$$, but even if we replace $$\operatorname{AGP}$$ with $$\operatorname{AGO}$$ in Brent's formula, the computation of $$\ln z$$ for both $$z=-0.4+i$$ and $$z=0.4+i$$ still gives wrong results. Quite curiously, $$\operatorname{AGP}\left(\theta_2^2 \left(\frac{1}{0.4+i}\right),\theta_3^2\left(\frac{1}{0.4+i}\right)\right)\ne \operatorname{AGO}\left(\theta_2^2 \left(\frac{1}{0.4+i}\right),\theta_3^2\left(\frac{1}{0.4+i}\right)\right),$$ but $$\operatorname{AGP}\left(\theta_2^2 \left(\frac{1}{-0.4+i}\right),\theta_3^2\left(\frac{1}{-0.4+i}\right)\right)=\operatorname{AGO}\left(\theta_2^2 \left(\frac{1}{-0.4+i}\right),\theta_3^2\left(\frac{1}{-0.4+i}\right)\right).$$

Question

Brent's formula is apparently wrong, but what is the largest subset of $$\mathbb{C}$$ such that his formula holds true?

Motivation

Sasaki and Kanada's formula provides one of the fastest algorithms for the computation of the real natural logarithm and the real inverse hyperbolic functions. Newton's method can be used to compute the real exponential function and the real hyperbolic functions by means of a fast inversion.

However, it is harder to compute the real trigonometric and the real inverse trigonometric functions this way. Namely, one has to extend Sasaki and Kanada's formula to the complex plane. But still, according to Brent, the convergence in the complex plane should be very fast and the algorithm should be even faster than the one based on Landen's transformations.

An empirical result $$\ln z=\frac{\pi}{\operatorname{AGP}(\theta_2^2(1/z),\theta_3^2(1/z))}$$ should be valid everywhere outside the square with vertices at $$-2.1-1.6i$$, $$1.1-1.6i$$, $$1.1+1.6i$$, $$-2.1+1.6i$$.

Complex plots The horizontal axis represents $$\operatorname{Re}z$$ and the vertical axis represents $$\operatorname{Im}z$$.

Note

$$\ln$$ denotes the principal branch of the complex natural logarithm.

This question was also asked on MSE.

• Have you tried to involve the expression of the arithmetic-geometric mean through elliptic integrals? The latter are multi-valued, maybe this relates to the multi-valuedness you introduce? Mar 28, 2021 at 12:07
• What I meant is that multi-valuedness might help, actually. If I understand correctly, your AGP and AGO are choices of branches of a multivalued function, and you want to know when do these branches coincide. If you study branching points and monodromy around them, you can get detailed description of how particular branches behave. For example, how far can they be continuously extended in the complex plane. Mar 28, 2021 at 15:19