09/28/2009, 07:20 AM
Oh dear. I finally see why the circle contour wasn't working! Geez, why didn't I think of this earlier...
The expression K/2 for the half-circle Cauchy integral of a constant function _only_ makes sense when the parameter (the "a" in the integrand) is at the center of the circle, i.e. when a = +/-iA. But that's only when you're evaluating the endpoints... when you're not, then a is something else, namely whatever point you're evaluating at. Otherwise, the integral is more complicated.
We have
\( K = \frac{1}{2 \pi i} \oint \frac{K}{z - a} dz \)
Now the cricle is parameterized by \( C(t) = e^{it} + iA \) for the top and \( C(t) = e^{it} - iA \) for the bottom. This does NOT cancel a, so we get for the semicircles
\( I_2 = \frac{L}{2 \pi i} \int_{0}^{\pi} \frac{ie^{it}}{e^{it} + iA - a} dt \)
(upper)
and
\( I_4 = \frac{\bar{L}}{2 \pi i} \int_{\pi}^{2\pi} \frac{ie^{it}}{e^{it} - iA - a} dt \)
(lower)
Now I see why you were warning about branchcuts and log and all that as this involves log now!!! Let's see how it goes. The indefinite integral of \( I_2 \) is (substitution \( u = e^{it} \) and \( du = ie^{it} dt \))
\( \int \frac{e^{it}}{e^{it} + iA - a} dt = \int \frac{du}{u + iA - a} = \log(u + iA - a) + const = \log(e^{it} + iA - a) + const. \)
So that for \( I_4 \) is
\( \int \frac{ie^{it}}{e^{it} - iA - a} = \log(e^{it} - iA - a) + const. \).
Now of course as you mention, the devil is in the branch cut. For the upper integral, there is no problem, as at the "lowest" value for a, i.e. -iA, we get \( log(e^{it}) \) whcih equals it for t in (-pi, pi] and t goes from 0 to pi. For the lower integral, however, there is a problem, as we go from pi to 2pi or alternatively -pi to 0 but -pi is not in the principal branch of logarithm. Thus when a is +iA, it breaks. The alternative then is to use a branch of log that is "continuous from below", not from above, at the negative real axis, which I'll denote as \( blog \) for "below-log". This equals the principal log(z) at all z except negative reals, where it instead equals log(z) - 2pi i. Thus we get
\( \int_{0}^{\pi} \frac{ie^{it}}{e^{it} + iA - a} dt = \log(-1 + iA - a) - \log(1 + iA - a) \)
\( \int_{\pi}^{2\pi} \frac{ie^{it}}{e^{it} - iA - a} dt = \int_{-\pi}^{0} \frac{ie^{it}}{e^{it} - iA - a} dt = \mathrm{blog}(1 - iA - a) - \mathrm{blog}(-1 - iA - a) \)
and so the sum of the integrals at the upper/lower part of the contour is
\( K(z) = \frac{L}{2\pi i} \left(\log(-1 + iA - z) - \log(1 + iA - z)\right) + \frac{\bar{L}}{2\pi i} \left(\mathrm{blog}(1 - iA - z) - \mathrm{blog}(-1 - iA - z)\right) \).
So we get the Pari/GP code
and we change the I1...I4 in OneIteration and PointEvaluate to
With this, the problem appears solved and I now can obtain exquisite convergence. The graph on the imag. axis is finally correct:
Residual is extremely good -- at z = 0 (i.e. of corrected function biased so it equals 1 at z = 0), 209 nodes, A = 10 its magnitude is just a hair over 0.0000004 after 32 normalized iterations and 6 unnormalized ones. Value of tetration at z = 0.5 is 1.6463536, which when rounded to 6 places past the point yields \( ^{1/2}e \approx 1.646354 \). Even at z = 9i and z = -9i the residual still only has magnitude a little over 0.0000006.
The expression K/2 for the half-circle Cauchy integral of a constant function _only_ makes sense when the parameter (the "a" in the integrand) is at the center of the circle, i.e. when a = +/-iA. But that's only when you're evaluating the endpoints... when you're not, then a is something else, namely whatever point you're evaluating at. Otherwise, the integral is more complicated.
We have
\( K = \frac{1}{2 \pi i} \oint \frac{K}{z - a} dz \)
Now the cricle is parameterized by \( C(t) = e^{it} + iA \) for the top and \( C(t) = e^{it} - iA \) for the bottom. This does NOT cancel a, so we get for the semicircles
\( I_2 = \frac{L}{2 \pi i} \int_{0}^{\pi} \frac{ie^{it}}{e^{it} + iA - a} dt \)
(upper)
and
\( I_4 = \frac{\bar{L}}{2 \pi i} \int_{\pi}^{2\pi} \frac{ie^{it}}{e^{it} - iA - a} dt \)
(lower)
Now I see why you were warning about branchcuts and log and all that as this involves log now!!! Let's see how it goes. The indefinite integral of \( I_2 \) is (substitution \( u = e^{it} \) and \( du = ie^{it} dt \))
\( \int \frac{e^{it}}{e^{it} + iA - a} dt = \int \frac{du}{u + iA - a} = \log(u + iA - a) + const = \log(e^{it} + iA - a) + const. \)
So that for \( I_4 \) is
\( \int \frac{ie^{it}}{e^{it} - iA - a} = \log(e^{it} - iA - a) + const. \).
Now of course as you mention, the devil is in the branch cut. For the upper integral, there is no problem, as at the "lowest" value for a, i.e. -iA, we get \( log(e^{it}) \) whcih equals it for t in (-pi, pi] and t goes from 0 to pi. For the lower integral, however, there is a problem, as we go from pi to 2pi or alternatively -pi to 0 but -pi is not in the principal branch of logarithm. Thus when a is +iA, it breaks. The alternative then is to use a branch of log that is "continuous from below", not from above, at the negative real axis, which I'll denote as \( blog \) for "below-log". This equals the principal log(z) at all z except negative reals, where it instead equals log(z) - 2pi i. Thus we get
\( \int_{0}^{\pi} \frac{ie^{it}}{e^{it} + iA - a} dt = \log(-1 + iA - a) - \log(1 + iA - a) \)
\( \int_{\pi}^{2\pi} \frac{ie^{it}}{e^{it} - iA - a} dt = \int_{-\pi}^{0} \frac{ie^{it}}{e^{it} - iA - a} dt = \mathrm{blog}(1 - iA - a) - \mathrm{blog}(-1 - iA - a) \)
and so the sum of the integrals at the upper/lower part of the contour is
\( K(z) = \frac{L}{2\pi i} \left(\log(-1 + iA - z) - \log(1 + iA - z)\right) + \frac{\bar{L}}{2\pi i} \left(\mathrm{blog}(1 - iA - z) - \mathrm{blog}(-1 - iA - z)\right) \).
So we get the Pari/GP code
Code:
blog(z) = if(imag(z) == 0 && real(z) < 0, log(z) - 2*Pi*I, log(z));
UpperSemicircle(K, A, z) = (K/(2*Pi*I))*(log(-1 + I*A - z) - log(1 + I*A - z));
LowerSemicircle(K, A, z) = (K/(2*Pi*I))*(blog(1 - I*A - z) - blog(-1 - I*A - z));and we change the I1...I4 in OneIteration and PointEvaluate to
Code:
(OneIteration)
I1 = CauchyIntegrateArr(1-I*A, 1+I*A, expv, zi);
I2 = UpperSemicircle(L, A, zi);
I3 = -CauchyIntegrateArr(-1-I*A, -1+I*A, logv, zi);
I4 = LowerSemicircle(conj(L), A, zi);
(PointEvaluate)
I1 = CauchyIntegrateArr(1-I*A, 1+I*A, expv, a);
I2 = UpperSemicircle(L, A, a);
I3 = -CauchyIntegrateArr(-1-I*A, -1+I*A, logv, a);
I4 = LowerSemicircle(conj(L), A, a);With this, the problem appears solved and I now can obtain exquisite convergence. The graph on the imag. axis is finally correct:
Residual is extremely good -- at z = 0 (i.e. of corrected function biased so it equals 1 at z = 0), 209 nodes, A = 10 its magnitude is just a hair over 0.0000004 after 32 normalized iterations and 6 unnormalized ones. Value of tetration at z = 0.5 is 1.6463536, which when rounded to 6 places past the point yields \( ^{1/2}e \approx 1.646354 \). Even at z = 9i and z = -9i the residual still only has magnitude a little over 0.0000006.

