Exact Values of the Gamma Function from Stirling’s Formula

In this work the complete version of Stirling’s formula, which is composed of the standard terms and an infinite asymptotic series, is used to obtain exact values of the logarithm of the gamma function over all branches of the complex plane. Exact values can only be obtained by regularization. Two methods are introduced: Borel summation and Mellin–Barnes (MB) regularization. The Borel-summed remainder is composed of an infinite convergent sum of exponential integrals and discontinuous logarithmic terms that emerge in specific sectors and on lines known as Stokes sectors and lines, while the MB-regularized remainders reduce to one complex MB integral with similar logarithmic terms. As a result that the domains of convergence overlap, two MB-regularized asymptotic forms can often be used to evaluate the logarithm of the gamma function. Though the Borel-summed remainder has to be truncated, it is found that both remainders when summed with (1) the truncated asymptotic series, (2) Stirling’s formula and (3) the logarithmic terms arising from the higher branches of the complex plane yield identical values for the logarithm of the gamma function. Where possible, they also agree with results from Mathematica.


Introduction
Discovered in the 1730s [1], Stirling's formula is a well-known result for determining approximate values of the gamma function, Γ(z), which is so important in the definition of Mittag-Leffler functions. Mystery has lingered whether it is indeed possible to obtain exact values of the gamma function from the complete version of the formula as opposed to its more famous truncated form. Moreover, due to the function's rapid exponentiation, its logarithm or ln Γ(z) is studied more often. This, however, introduces multivaluedness, which makes the asymptotic analysis of the function more formidable. Consequently, no one has ever been able to obtain exact values of either function via the entire formula.
In its entirety, Stirling's formula is an asymptotic expansion and is, therefore, divergent. Here exact values of ln Γ(z) are determined for all values of arg z from the complete asymptotic expansion of the formula. This process known as exactification represents the ultimate goal of hyperasymptotics, whose primary aim is to obtain far more accurate values from asymptotic expansions than standard Poincaré asymptotics [2]. In such studies one not only includes all the terms in a dominant asymptotic series, but also, subdominant exponential terms, which are said to lie beyond all orders [3]. To observe their effect, hyperasymptotic calculations are generally carried out to more than 20 decimal places.
Since a complete asymptotic expansion is composed of divergent series, exactification involves obtaining meaningful values from them. This is achieved by the process of regularization, which is defined here as the removal of the infinity in the remainder of an asymptotic series so as to make the series summable. It was first demonstrated in [4] that the infinity in the remainder of an asymptotic series arises from an impropriety in the asymptotic method used to derive it. Hence regularization represents the method of correcting asymptotic methods.
Two very different techniques will be used to regularize the divergent series in this work. As discussed in [5,6], the most common method of regularizing a divergent series is Borel summation, but often, it produces results that are not amenable to fast and accurate computation. To overcome this drawback, the numerical technique of Mellin-Barnes regularization was developed in [7]. In this method, divergent series are expressed in terms of Mellin-Barnes integrals and divergent arc-contour integrals. Regularization removes the latter resulting in the Mellin-Barnes integrals yielding finite values, similar to the Hadamard finite part of a divergent integral [8]. Amazingly, the finite values obtained from applying the technique to an asymptotic expansion yield exact values of the original function with the main difference being that instead of dealing with Stokes sectors and lines, one now deals with overlapping domains of convergence over which the Mellin-Barnes integrals are valid.

Stirling's Formula
Stirling's formula [1] for the factorial function is often written for large integers, n, as ln n! = ln Γ(n + 1) = n ln n − n + 1 2 ln(2πn) + · · · . (1) As this is accurate to within 1% for n > 5, it represents a good approximation in standard (Poincaré) asymptotics [2], but not so in hyperasymptotics. Moreover, our aim is to consider complex values, not large integers. Thus, we replace the factorial function by the more general gamma function, Γ(z + 1). The terms in (1), denoted here by F(z), then become the leading terms of the complete asymptotic expansion for ln Γ(z). They will be treated as a separate contribution in all calculations of ln Γ(z), so that the reader will be able to observe just how inadequate standard asymptotics is compared with hyperasymptotics.
Occasionally, a problem arises where there is an interest in the missing terms in (1). Then Stirling's formula is expressed differently. For example, according to No. 6.1.41 in [9], for z → ∞ and |arg z| < π, ln Γ(z) is given by where F(z) represents all the terms in Stirling's formula, namely, Hence the leading terms are identical to those in (1). In other texts the dots in (2) are replaced by the Landau gauge symbol, which would be O(z −9 ) here since it is the next highest order term. In [10] the power series after ln(2π) is truncated with the coefficients expressed in terms of the Bernoulli numbers, while the remainder term, R N (z) in No. 8.344, is given as |R N (z)| = ∞ ∑ k=N B 2k 2k(2k − 1)z 2k−1 < |B 2n | 2n(2n − 1)|z| 2n−1 cos 2n−1 ((arg z)/2) .
Although the remainder is dependent upon z and N, for z > 0, the series diverges once N passes the optimal point of truncation, N OP . Moreover, the above result is even more vague than (2) because the expansion is only valid for "large" values of |z| without indicating what large means. Here, we shall evaluate exact values of ln Γ(z) from the complete version of Stirling's formula by following the concepts and theory in [6], but before this can be done, the following lemma is required.
Proof. For brevity, the proof is not given here, but appears in [11].
It should be noted that an equivalence symbol appears in one of the results, indicating that one side possesses a divergent series, while the other side represents a finite regularized value. That is, arctan, u is defined for all values of u, while the series representation for the function is divergent when u does not lie within −1 < (iu) < 1. Since the equivalence symbol is less stringent than an equals sign, we can re-write the lemma as ∞ ∑ k=0 (−1) k u 2k+1 (2k + 1) ≡ arctan u, ∀u. (6) Therefore, if the series appears in a problem, then it can be replaced by the right-hand side (rhs).
Though equivalence statements will appear throughout this paper, it does not necessarily mean that a power series is divergent for all values of the variable. Now we derive the complete form of Stirling's formula. This will not be original, but we need to establish that it is complete. Binet's second expression for ln Γ(z) in [2] is ln Γ(z) = F(z) + 2 ∞ 0 dt arctan(t/z) e 2πt − 1 .
By making a change of variable, y = 2πt, and noting that z is complex, we can then introduce (5). Replacing k by k + 1 yields The left-hand side (lhs) of (8) is finite (convergent), while the rhs can be either divergent or convergent. From No. 3.411(1) in [10], the integral in the above equivalence is equal to Γ(2k)ζ(2k), where ζ(z) represents the Riemann zeta function. Thus, the above result becomes From here on, S(z) denotes the series on the rhs. On the other hand, Paris and Kaminski [12,13], replace the terms on the lhs by Ω(z). With the aid of the reflection formula for the gamma function, the following continuation formula can be derived: This enables one to obtain values of ln Γ(z) whenever z is situated in the left-hand complex plane via the corresponding values in the right-hand complex plane. Furthermore, the rhs will play an important role when the Stokes phenomenon is discussed later.
In order to continue with this study, the following definitions are required: Definition 1. An asymptotic (power) series is defined here as an infinite power series with zero radius of absolute convergence.

Definition 2.
An asymptotic form is composed of: (1) a complete asymptotic expansion, which not only possesses all terms in a dominant asymptotic power series, e.g., S(z) above, but also all the terms in each subdominant asymptotic series, should they exist, and (2) the common sector or ray in the complex plane over which the argument of the variable in each series is valid.
By truncating S(z) at N terms, we arrive at where the first term will be denoted as TS N (z), N is the truncation parameter and c k (1) represents a specific value of the cosecant polynomials [14], given by The infinite series over k in the second term is known as a generalized Type I terminant [6]. Terminants were first introduced by Dingle [15] because he found that special functions often possess asymptotic series whose late coefficients exhibit gamma function growth, viz. Γ(k + α). A Type II terminant differs in that the coefficients possess an extra phase factor of (−1) k . The notation S I p,q (N, z β ) was introduced in [6] to denote the generalization of Dingle's Type I terminants, which are defined as Alternatively, (11) can be expressed as Thus, β and z in (13) are equal to 2 and 1/2nπz in (14). Although [6] states that both p and q have to be positive and real, it is N + q/p, which appears in the regularized value of a generalized terminant. Therefore, provided (N + q/p) > 0, the regularized value of the series still exists. Alternatively, k can be replaced by k + 1 in the infinite series in (14), in which case q equals unity. Since S I 2,−1 N, z 2 = −z 2 S I 2,1 N − 1, z 2 , we can apply the result in [6] to S I 2,1 N − 1, z 2 instead. According to Rule A in ( [15], Chapter 1), Stokes lines occur whenever the arguments or phases of the variable result in the terms of an asymptotic series becoming homogeneous in phase and having the same sign. In the case of the generalized terminant in (13), this means that Stokes lines occur whenever arg −z β = 2lπ, for l, an integer. Then the terms in either S I 2,−1 N, 1/z 2 ) or S I 2,1 N, 1/z 2 ) are all positively real. Because l is arbitrary, we can replace −1 by exp(−iπ). Thus, we find that the Stokes lines for S(z) occur whenever arg z = −(l + 1/2)π, i.e., at half integer multiples of π.
The concept of a primary Stokes sector/line was introduced in [6] to indicate the first Stokes sector/line over which an asymptotic expansion is derived. It was also necessary to define asymptotic forms since two functions can have the same complete asymptotic expansion, but will still be different if the expansion applies over different primary Stokes sectors or lines. For example, in solving a problem for positive real values of the variable, one may obtain a generalized Type I terminant as the asymptotic solution. However, as the variable moves off the real axis, it will acquire subdominant semi-residue contributions of opposing signs in either direction as a result of the Stokes phenomenon. However, if the same asymptotic solution is obtained for positive imaginary values of the variable, then as the variable hits the positive and negative real axes, the asymptotic solution will acquire a semi-residue contribution. When the variable moves into the lower half of the complex plane, the asymptotic solution will acquire a full residue contribution. Clearly, both cases are different and will yield different values even though the same generalized Type I terminant was derived. Hence the original functions or solutions for these cases are different. In the first case the positive real axis becomes the primary Stokes line for the generalized Type I terminant, while in the second case, the upper half of the complex plane represents the primary Stokes sector. Then as more secondary Stokes sectors/lines are encountered either in a clockwise or anti-clockwise direction from the primary Stokes sector/line, more Stokes discontinuities arise at the boundaries. Although the choice of a primary Stokes sector/line is arbitrary, it will be taken here to be the Stokes sector/line situated in the principal branch of the complex plane, since most asymptotic expansions are derived under the condition that the variable lies initially in the principal branch of the complex plane.
Before we can regularize the asymptotic series, S(z), we require the following lemma: Regularization of the Taylor series for the logarithmic function yields Proof. There is no need for the proof to appear here as it can be found in [16].
As in the first lemma, we can replace the equals sign in the lemma by the less stringent equivalence symbol, which reduces the lemma to With this result we can now regularize S(z), which will enable the asymptotic forms for ln Γ(z) to be derived.
Theorem 1. As a result of the regularization of its asymptotic power series, the logarithm of the gamma function possesses the following asymptotic forms: where the remainder R SS N (z) is given by and the Stokes discontinuity term SD M (z) is given by The remainder is valid for either (M − 1/2)π < θ = arg z < (M + 1/2)π or −(M + 1/2)π < θ < −(M − 1/2)π, where M is a non-negative integer. However, the Stokes discontinuity term possesses two forms that are complex conjugates. The upper-signed version of (19) applies to (M − 1/2)π < θ < (M + 1/2)π, while the lower-signed version is valid over −(M + 1/2)π < θ < −(M − 1/2)π. For z lying on the Stokes lines, i.e., for θ = ±(M + 1/2)π, R SS N (z) and SD SS M (z) are replaced by R SL N (z) and SD SL M (z), respectively. Then the remainder is given by while the Stokes discontinuity term becomes In (20), P denotes the Cauchy principal value.
Proof. For brevity, the proof is not presented here as it can be found in [11].
The remainder in Theorem 1 is conceptually different from the remainder term in standard Poincaré asymptotics, which is expressed in terms of the Landau gauge symbol, O(), or as + . . . In fact, (17) would typically be written as Moreover, by introducing c 1 (1) = −1/3, c 2 (1) = −1/45, c 3 (1) = −2/945 and c 4 (1) = −1/4725, into the above result, we obtain (2). For real values of z, (22) is referred to as a large z or z → ∞ expansion with the limit point at infinity. For z complex, it becomes a large |z| expansion. In other cases, where the Landau gauge symbol is omitted, a tilde often replaces the equals sign. Nevertheless, in all these representations it means that the later terms in the truncated power series have been neglected despite their eventual divergence past the optimal point of truncation.

Numerical Analysis
In the previous section the asymptotic forms for ln Γ(z) were derived via Borel summation. However, we still need to verify that these results yield exact values of the special function. This section aims to present such a numerical analysis. For the analysis to be effective, a large number of values of |z| is not required. This is because the results change across Stokes sectors or rays, but within each sector or on each line, they behave uniformly with respect to z. Thus, a few values of |z| are necessary for testing the validity of the asymptotic forms. In fact, only two values of |z| are necessary: a relatively large one, where the asymptotic series in (17) can be truncated, and a small one, where truncation breaks down completely. Then a range of values for both N and arg z or θ, need to be considered across the Stokes sectors and lines. Note also that selecting extremely large/small values of |z| may result in overflow or underflow problems in the numerical calculations. This would then give the misleading impression that the asymptotic forms are incorrect rather than implying a deficiency in the computing system. Since the variable in the asymptotic series is 1/(2nπz) 2 with n ranging from unity to infinity, |z| = 3 is deemed to be sufficiently large, while for |z| = 1/10, there is no optimal point of truncation. The second value is, therefore, sufficiently small to demonstrate the breakdown of standard Poincaré asymptotics.
Before undertaking the numerical analysis, let us present plots of ln Γ(z) to help the reader understand the nature of the function. Figure 1 displays graphs of the real part of the function for several fixed values of |z| used in this paper as a function of θ over (0, π). There we see for the larger values of |z|, the real part of ln Γ(z) dips to a minimum before it begins to grow dramatically, which is the rapid exponentiation mentioned in the introduction. The smaller values of |z| do not vary as much, although both are similar to the larger values of |z| in that they dip to a minimum and rise afterwards. Unlike the other graphs, the graph for |z| = 1/2 has a positive minimum and increases rather slowly.  Here we see that the large values of |z| rise to a positive maximum before rapidly decreasing into the negative right quadrant. The plot for |z| = 9/10 does not attain a positive maximum, but decreases relatively slowly from the origin into the negative right quadrant. The graph for |z| = 1/2 follows that for |z| = 9/10 until about θ = π/2. Then it decreases faster than the |z| = 9/10 graph, but when θ is close to π, it rises until it meets the |z| = 9/10 graph at θ = π. The optimal point of truncation, N OP , is determined by calculating the first value of the truncation parameter, N, when successive terms in an asymptotic series begin to dominate the preceding terms. That is, it occurs at the first value of k, where the k + 1-th term is greater than the k-th term in S(z), namely, Since the ratio of the Riemann zeta functions is close to unity, we observe that N OP occurs around π|z|. Therefore, for |z| = 3, N OP will be close to 10, while for |z| = 1/10, it does not exist, meaning that N OP = 0. In the latter case the first or leading term of the asymptotic series will yield the "nearest" value to ln Γ(z), but it will not be accurate. On the other hand, the larger N OP is, the more accurate truncation of the asymptotic series becomes.
Typically, when a software package such as Mathematica [17] determines values of a special function, it only does so over the principal branch of the complex plane. Hence, the numerical analysis will be confined to arg z over (−π, π], which means in turn that the numerical analysis of (17) will only be conducted over the three Stokes sectors, −3π/2 < θ < −π/2, −π/2 < θ < π/2 and π/2 < θ < 3π/2, and the two Stokes lines at θ = ±π/2. In other words, only the M = 0 and M = ±1 results in Theorem 1 will be tested for the time being. By denoting the truncated sum in (17) by TS N (z), i.e., we need to verify the following results: In the above the superscripts, U and L, have been introduced into the Stokes discontinuity terms in the Stokes sectors to indicate the upper-and lower-signed versions of (21). Although equal to zero, the Stokes discontinuity term for the third asymptotic form will be denoted as SD SS 0 (z). If we put N = 4 in the third result of (24) and neglect the final term or remainder, then we arrive at (2). However, the remaining terms in this result are now expressed as and while the Stokes discontinuity terms are given by and Note the connection with Ω(z) mentioned below (9). For the numerical analysis we need to consider the results over the Stokes sectors separately from those at the Stokes lines since the latter require the evaluation of the Cauchy principal value and the Stokes discontinuity terms possess a factor of 1/2 compared with zero when |θ| < π/2 or unity when |θ| > π/2. Thus, ln Γ(z) will be evaluated via two different Mathematica modules: one involving the standard numerical integration routine called NIntegrate, and another, where NIntegrate is adapted to evaluate only the Cauchy principal value.
When θ > 0, the Stokes discontinuity terms can be combined into one expression, denoted by SD + (z). This is given by where the Stokes multiplier, S + , is written as Similarly, the Stokes discontinuity terms in the lower half of the principal branch, SD − (z), can be written in terms of another Stokes multiplier, S − , as follows: where S − is given by From the above, we see that the Stokes multipliers are discontinuous, which is known as the conventional view of the Stokes phenomenon. However, an alternative view of the Stokes phenomenon arose in the late 1980s where they were no longer regarded as step-functions. Instead, it was proposed that they undergo a smooth, but rapid, transition from zero to unity, equalling 1/2 at the Stokes line [18]. Today, this is known as Stokes smoothing, despite the fact that Stokes never regarded the multipliers as being smooth [19]. According to this approach, first put forward by Berry and then made more "rigorous" by Olver [20], the Stokes multiplier reduces to the error function, erf(z). Later, Berry [21] and Paris and Wood [22] found an approximate form for the Stokes multipliers of ln Γ(z), which were given as A graph of (34) for |z| = 3 versus θ is displayed in Figure 3 together with the conventional view or (31). For θ < 1, (34) is virtually zero, while for θ > 2, it is almost equal to unity. In between, however, the rapid smoothing occurs with the greatest deviation from the step-function occurring in the vicinity of the Stokes line where both views possess a common (green) point at (π/2, 1/2). If smoothing occurs, then Theorem 1 cannot possibly yield exact values of ln Γ(z), especially for θ between 13π/32 and 17π/32 excluding π/2.
We can establish the correct view by calculating ln Γ(z) for θ between 13π/32 and 17π/32 using (30) since smoothing implies that (30) cannot possibly yield exact values of ln Γ(z). However, if we obtain exact values of ln Γ(z), then we know that the conventional view holds and smoothing is a fallacy. The problem with testing (34) directly is that it applies to much larger values of |z| than 3. The proponents of smoothing have not provided the form for smaller values of |z|. For very large values of |z|, truncating the asymptotic expansion at a few terms will yield very accurate values for ln Γ(z), which can obscure both views unless an extremely high precision and time-consuming analysis is undertaken. Hence much smaller values of |z| will be considered in (30), so that the Stokes discontinuity term can no longer be neglected. given as A graph of (34) for |z| = 3 versus θ is displayed in Figure 3 together with the conven- Before Stokes smoothing can be investigated, we must show that (24) behaves as a typical asymptotic expansion. That is, we must show that for large values of |z|, the remainder can be neglected to yield accurate, but nevertheless approximate, values of ln Γ(z) up to and not very far from the optimal point of truncation, while for small values of |z|, it is simply invalid to neglect the remainder. For this demonstration we do not require the Stokes discontinuity terms. Thus, we shall study the asymptotic series for |θ| < π/2, in particular θ = 0, because it does not require complex arithmetic.
From (26) we see that the evaluation of the remainder involves two computationally intensive tasks. The first is the infinite sum over n, which arose due to an infinite number of singularities lying on each Stokes line. The second issue is the numerical integration of the exponential integral. The latter can be avoided by decomposing the denominator into partial fractions and using No. 3.383(10) from [10]. For |θ| < π/2, one then obtains The above result can also be obtained by combining (4.3), (4.10) and (4.11) in [22]. A module was written to evaluate ln Γ(z) in Mathematica with the remainder given by (35) and n set to an upper limit of 10 5 to ensure 50 figure accuracy. Table 1 displays a small sample of the results obtained from the code. For more details about the code including its performance and listing as well as other results, the reader should consult [11]. Note that all the results are real, which is to be expected since ln Γ(3) = ln 2. In actual fact, Mathematica printed out a tiny imaginary part with each value, but it was often zero to the first 50+ decimal places and thus was discarded. The appearance of these tiny imaginary values indicates the size of the numerical error. The few cases where the errors were less than 50 decimal places will be discussed shortly. The first column displays the values of the truncation parameter, N for each calculation. The second row in the table gives the value of Stirling's formula for z = 3, which only agrees with the actual value of ln Γ(3) at the bottom of the table to the first decimal place. For each value of N there are three rows. The first row labelled TS displays the value of the truncated sum in (25), while the row labelled R SS N (3) presents the value of the remainder given by (35) with the upper limit set to 10 5 . The third row labelled Sum is the sum of Stirling's formula, the truncated sum and the remainder. It yields the same value of ln 2 as at the bottom of the table except for N = 2.
For N = 2, the truncated sum and remainder equal 0.027 777 · · · and −9.98 529 · · · × 10 −5 , respectively. When they are summed with F(3), they yield a value that agrees with ln Γ(3) to 19 decimal places, which is well-below the 50 decimal figure accuracy mentioned above and nowhere near as accurate as other results such as N = 50. The reason this has occurred is that the factor of n 2N−2 in the denominator of (26) affects the calculation of the remainder for the small values of N such as 1 or 2. In these cases the upper limit of 10 5 needs to be increased substantially to improve the accuracy, which does not apply for higher values of N.
The remainder is smallest in magnitude when N = 11, which agrees with our estimate below (23) for the optimal point of truncation, N OP . For N = N OP , the sum of the values only differs from the actual value of ln Γ(3) at the fifty-third decimal place. Moreover, for N close to N OP , there is little deterioration in the accuracy, but for N = 30 and 50, well past N OP , the remainder dominates, whereas in the other calculations, it is small. This is consistent with standard Poincaré asymptotics, where the remainder is neglected. Therefore, for all but the last two calculations, Stirling's formula yields the main contribution to ln Γ(3). For the last two values of N, the truncated sum and remainder dominate, but their divergence is cancelled out. For example, when N = 50, the remainder and truncated sum are O(10 25 ). Hence the first 26 decimal places of both quantities cancel each other, thereby enabling Stirling's formula to become the main contribution. Unfortunately, losing these decimal places produces an imaginary term that is zero to a reduced number of decimal places, 23 instead of 50+ as mentioned above. Now consider z = 1/10, which is unheard of in standard Poincaré asymptotics and also in the hyperasymptotic calculations of [12,18,21,23,24]. Furthermore, Paris [13] has specifically carried out a hyperasymptotic calculation of ln Γ(z) using Hadamard expansions for Ω(z). Depending on the number of chosen levels, his results are accurate at best to 10 −45 for z > 8 (N OP > 25). Hence Table 1 displays far more accurate results, but with z = 3. Table 2 presents a sample of results for z = 1/10 in the third asymptotic form of (25) with R SS N (z) given by (35). In this case Stirling's formula is nowhere near as accurate as in Table 1. Except for N = 2, adding the truncated series to Stirling's formula worsens the accuracy. This has arisen because there is no optimal point of truncation. Therefore, the remainder must be evaluated. As a result that the remainder diverges far more rapidly in this case, there is a greater cancellation of decimal places than in Table 1. Thus, the total values in Table 2 are generally not as accurate, the exception being very low values of N. Despite this, these results could not have been achieved without regularization. Now we assume that the routine, Gamma[N, z], does not exist in Mathematica. Then a new program implementing the first, third and fifth asymptotic forms in (25) with the remainder given by (26) is required. As before, the upper limit in the sum will be set to 10 5 . To calculate each term in the remainder, the program, which appears as the second program in the appendix of [11], employs NIntegrate inside a Do loop. Since it is a different approach for calculating ln Γ(z), it can be used to check the results in Table 1. The version in [11] has the precision and accuracy goals set to 30 for thirty figure accuracy, which means, in turn, that the working precision must be set to a much higher level, e.g., 60. Higher values for these options can be set, but it comes at the expense of computing time. The integrand employed in NIntegrate is called Intgrd and is basically the integrand in (26). Due to lack of space, the calculated quantities are displayed here to 25 decimal places, although they were frequently far more accurate. In addition, unlike the previous calculations, we consider complex values of z, i.e., θ takes on values within the principal branch of the complex plane except at ±π/2. For brevity, only |z| = 1/10 is presented here. The results for |z| = 3 appear in Table 3 of [11]. Table 3 presents a very small sample of the results obtained by running the second program in the appendix of [11] with |z| = 1/10. Although positive values of θ were considered, only negative values are displayed here. In the table, there are six results for each value of N and θ. Stirling's formula is represented by the first value. The second value, denoted by TS, represents the value of the truncated sum in (24), while the third value is the regularized remainder, (26), as evaluated via NIntegrate. The fourth value for each calculation of ln Γ(z) is the Stokes discontinuity term, which according to (32) is zero for |θ| < π/2 and is purely logarithmic for θ over (−π, −π/2). The fifth value, denoted by Total, represents the sum of the four preceding values, while the final value is the actual value of ln Γ(z) using LogGamma[z] in Mathematica.
Since there is no optimal point of truncation, the results in Table 3 for N > 3 are mainly dominated by the truncated sum and its regularized remainder. In fact, both values dominate so much that many decimal places are cancelled as observed for N = 30 and 50 in Table 1. Once again, pressure is being put on the accuracy of the final total. For example, for N = 9 and θ = −6π/13, both the truncated sum and the regularized remainder are O(10 13 ), which means a loss of thirteen decimal places when they are summed. Since the accuracy and precision goals were set to 30, this implies that the sum of the truncated series and the regularized remainder should only be accurate to 17 decimal places. Fortunately, the total value agrees with the value of ln Γ(z) to 28 decimal places because the working precision was set much higher (to 60) than the precision and accuracy goals. Table 3. ln Γ(z) via (25) with |z| = 1/10 for various values of the truncation parameter, N, and argz. Although F(exp(iθ)/10) provides a substantial contribution to ln Γ(exp(iθ)/10), it is no longer accurate. The truncated sum is capable of improving the accuracy slightly for small values of the truncation parameter. For example, when the truncated sum is added to F(z) for N = 3 and θ = −π/6, the real part is closer to the real part of ln Γ(exp(−iπ/6)/10), but not so the imaginary part. In fact, all the results are dominated by the truncated sum and its regularized remainder, but since they act against each other, their sum is not as large as Stirling's formula. Nevertheless, one cannot neglect the remainder as in standard Poincaré asymptotics. In order to obtain the exact value of ln Γ(exp(−iπ/6)/10) via (25), the remainder must counterbalance the truncated sum, which will only occur if the regularization has been performed correctly. When the regularized remainder is included in the total, exact values of ln Γ(exp(iθ)/10) are obtained. For θ < −π/2, however, the Stokes discontinuity term must be included. In fact, SD SS,L 1 (z) is greater than the sum of the truncated series and the regularized remainder, which highlights its importance outside the primary Stokes sector.
So far, we have managed to verify the asymptotic forms in (25) connected with Stokes sectors. Now we consider the asymptotic forms for the two Stokes lines. As θ is fixed in both asymptotic forms, the Stokes discontinuity term will only depend upon |z|. In other words, it is solely real. Furthermore, since TS N (z) depends only on odd powers of z in (24), TS N (z) and R SL, N (z) must be imaginary along both Stokes lines. This is consistent with Rule D in ( [15], Chapter 1), which states that an asymptotic series crossing a Stokes line generates a discontinuity that is π/2 out of phase with the series on the line.
The third code in the appendix of [11] implements the second and fourth asymptotic forms of (25) in Mathematica. This program is very different from the previous program because it includes a Which statement in the Do loop. This is necessary because the singularity in the Cauchy principal value integral in (27) alters with each value of n. Moreover, the integral has been divided into several smaller intervals in order to achieve the best possible accuracy. The interval in which the singularity is situated is then determined via the Which statement. This interval is, in turn, divided into two intervals to avoid the singularity in accordance with the definition of the principal value. To ensure that the principal value is evaluated without encountering convergence problems, the option Method->PrincipalValue must also be introduced into NIntegrate. Finally, in order to achieve the same accuracy as in Table 3, WorkingPrecision has been increased to 80. Hence the program takes much longer to execute. Table 4 presents a sample of the results generated by running the third program in [11] with the variable modz set equal to 3. A similar set of calculations was performed for modz equal to 1/10, whose results appear in Table 6 of [11], but for brevity, they are not presented here. Although both Stokes lines were considered by putting the variable theta in the program equal to ±Pi/2, only the results for positive values of theta are presented here, again for the sake of brevity. The calculations took much longer for larger values of the truncation parameter, ranging from 26 hrs for N = 1 to 47.5 hrs for N = 50. Because the values of F(3 exp(iπ/2)) and SD SL 0 (3 exp(iπ/2)) are independent of the truncation parameter, they only appear once at the top of the table, while their sum appears immediately below them in the row labelled Combined. As stated above, the Stokes discontinuity term is purely real, whereas the truncated sum and regularized value of the remainder are purely imaginary. Therefore, the real part of the value in the Combined row represents the real part of ln Γ(3 exp(iπ/2)), which can be checked by comparing it with the real part of ln Γ(3 exp(3iπ/2)) at the bottom of the table. Thus, the Stokes discontinuity term only corrects the real part of Stirling's formula on a Stokes line. On the other hand, the imaginary part of ln Γ(3 exp(iπ/2)) can only be calculated exactly if the regularization of (25) has been performed correctly. The last decimal figure of the imaginary part of ln Γ(3 exp(iπ/2)) was printed out as a 6 instead of a 5, because the accuracy was set to 25 decimal places in the output stage. Since more than 25 figures appear in the table, this statement should have been modified to consider a higher level of accuracy. Therefore, we should only be worried when the results agree for less than 25 decimal places. The redundant places have been introduced here to indicate that the results in the Total column have been computed via a different approach from the LogGamma routine in Mathematica at the bottom of the table. That is, we should expect differences to occur at some stage, but only outside the specified level of accuracy.
In the table we see that the regularized value of the remainder decreases steadily until the truncation parameter reaches N OP around 11, before it begins to diverge. Note that the imaginary part of the Total value for N = 1 is only accurate to 6 decimal places compared with the imaginary part of ln Γ(3 exp(iπ/2)). As discussed previously, this arises because the power of n in the denominator of R SL 1 (z) is zero when N is equal to unity. Though not displayed in the table, the remainder at the optimal point of truncation, R 11 (3 exp(iπ/2)), has a minimum magnitude of O(10 −11 ). Beyond this point, the magnitude of the regularized value of the remainder increases so that its magnitude is O(10 −6 ) for N = 20. By the time N = 30, both the truncated series and regularized value of the remainder dominate the calculation, but since they act against each other, they combine to yield the extra imaginary value enabling the imaginary part in the Combined row to agree with ln Γ(3 exp(iπ/2)). In fact, the most surprising result in the table is the last result for N = 50 because at least 25 decimal places cancel before we obtain the regularized value for the entire asymptotic series. As mentioned previously, the cancellation of these decimal places puts pressure on the accuracy and precision goals, which have been set to 30, as stated above. Fortunately, because WorkingPrecision was set to 80, it appears that the neglected terms in setting a limit of 10 5 in the summation are negligible. Thus, the remainder has been evaluated to a much greater accuracy than specified by the accuracy and precision goals in the program. Consequently, the Total value for N = 50 agrees with the actual value of ln Γ(3 exp(iπ/2)).  So far, we have not seen any evidence of Stokes smoothing as espoused by Berry [18], Olver [20] and Paris, Kaminski and Wood [12,13,25]. As indicated earlier, smoothing implies that there is no discontinuity in the vicinity of a Stokes line, whereas we have been able to obtain exact values of ln Γ(z) near Stokes lines assuming the existence of a discontinuity. Because such smoothing occurs rapidly in the vicinity of Stokes lines, it could perhaps be argued that we have not investigated the asymptotic behaviour of ln Γ(z) sufficiently close to the Stokes lines. If a rapid transition does occur, then it means that we have still not exactified the Stokes approximation in the vicinity of the Stokes lines. From Figure 3, which represents the situation for |z| = 3, Stokes smoothing is expected to be most pronounced for θ lying between 13π/32 and 19π/32. Alternatively, the Stokes multiplier is expected to be quite close to 1/2 for small values of δ, where θ = π(1/2 + δ) and |δ| < 3/32. On the other hand, if the conventional view of the Stokes phenomenon is valid, then the Stokes multiplier S + will equal unity for 0 < δ < 1 and zero for −1 < δ < 0 according to (31). Thus, a narrow region of positive and negative values of δ exists, where one of the views can be disproved. In summary, introducing very small values of δ into the respective asymptotic forms of (24) should not yield exact values of ln Γ(z) if smoothing occurs since the Stokes multiplier should be close to 1/2 and not toggle between zero and unity according to the sign of δ. Table 5 presents a small sample of the results obtained by running the second program in [11] for |z| = 3 and various values of δ, where θ = (1/2 + δ)π. The code was run for different values of N except those close to unity for the reason given above. For each positive value of δ, there are three rows of values, while for each negative value there are only two rows because the Stokes discontinuity term is zero. The first row for each value of δ, labelled LogGamma[z] in the Method column, represents the value obtained from the LogGamma routine in Mathematica. Depending upon the sign of δ, the second row displays the Stokes discontinuity term. In general, this term was found to possess real and imaginary parts of O(10 −8 ) or even a couple of orders lower. The next value for each value of δ is labelled either 1st AF or 3rd AF in the Method column according to whether the first or third asymptotic form in (25) was used to calculate the value of ln Γ(z). For brevity, the values of the truncated sum, the regularized value of the remainder and Stirling's formula do not appear in the table. It should be noted that when |δ| is extremely small, e.g., O(10 −5 ), NIntegrate experiences convergence problems because the integration is now too close to the singularities on the Stokes line. For example, when δ = 10 −5 , the program printed out a value that agreed with the actual value to 25 decimal places for the real part, but the imaginary part only agreed to 18 decimal places. Although this calculation is not presented in the table, it does represent a degree of success since the imaginary part of the Stokes discontinuity term is O(10 −12 ). That is, the Stokes discontinuity term still had to be correct to the first six decimal places for the agreement to occur at 18-th decimal place.
For δ > 0 in the table, the first asymptotic form in (25) yields the exact value of ln Γ(z) even though the Stokes discontinuity term is very small. Nevertheless, in the case of Stokes smoothing, this term should be almost half the values appearing in the table. For δ < 0, if smoothing occurs, then the third asymptotic form in (25) should also not yield exact values of ln Γ(z) because it is missing almost half the Stokes discontinuity term. Yet, we observe the opposite; the third asymptotic form yields exact values of ln Γ(z) for δ < 0. Therefore, Stokes smoothing does not occur. These results are discussed in more detail in [26].
An explanation why Stokes smoothing is fallacious appears in ([6], Section 6.1), where it is shown that the form for the Stokes multiplier given by Berry and Olver is based on applying standard asymptotic techniques. Olver's "rigorous proof" [20] involves truncating an asymptotic series via Laplace's method. Since only the lowest order terms are retained in this approach, Olver arrives at the error function result for the Stokes multiplier. The neglected higher order terms are not only divergent, but are also extremely difficult to regularize. If they could be regularized, then they would produce the necessary corrections to turn the smooth function in Figure 3 into a step-function, thereby confirming the conventional view of the Stokes phenomenon.

Mellin-Barnes Regularization
In the preceding section we were able to exactify Stirling's formula by carrying out hyperasymptotic calculations of the asymptotic forms in (25). However, there were two drawbacks with the numerical analysis. The first is that an upper limit was applied to the infinite sums appearing in the expressions for the regularized value of the remainder. Despite this, the regularized values were extremely accurate for an upper limit of 10 5 in (26) and (27). This results in the second drawback, the considerable effort required to calculate the remainder. Ideally, we do not want to truncate any result here so that we can dispel any doubt that we are evaluating an approximation. If the infinite sum over n can be replaced by a single result, then there will be a huge reduction in the execution time since there would be only one call to NIntegrate. Such an expression emerges when we consider Mellin-Barnes regularization of ln Γ(z) in the following theorem.

Theorem 2.
Via the Mellin-Barnes (MB) regularization of the asymptotic series S(z) given by either (9) or (11), the logarithm of the gamma function can be expressed as where for (±M − 1)π < θ = arg z < (±M + 1)π, and M ≥ 0, but excluding θ equal to half-integer values of π. The strips involving θ represent domains of convergence for the MB integral in (36) with the upper-signed forms applying to positive θ and the lower-signed ones to negative θ. For θ = ±(M − 1/2)π, S MB (M, z) reduces to while for θ = ±(M + 1/2)π, it is given by Proof. For the sake of brevity, the proof is omitted as it appears in ( [11], Section 4).
Comparing the above results with those in Theorem 1, we see that not only is the remainder of the asymptotic series in (11) expressed as an MB integral, but there are also no discontinuities from crossing Stokes lines. Instead, the MB integral is valid over a strip or domain of convergence with the Stokes lines situated inside the domains of convergence. Although (38) and (39) apply at half integer values of π, they no longer represent Stokes lines as in Theorem 1. They have been isolated here as a result of the MB regularization of S(z) since ln Γ(z) itself possesses jump discontinuities at θ = (l + 1/2)π, for l, an integer not equal to 0 or −1. Thus, MB regularization produces a totally different representation of the original function from its asymptotic forms, and relies on the continuity of the function. If the original function possesses discontinuities as ln Γ(z) does, then the MB-regularized value will not yield the value of the original function unless the analysis is adapted as explained in the proof.
Since Stokes multipliers do not appear in the MB regularization of ln Γ(z) for θ = ±π/2, this implies that the Stokes discontinuities obtained by Borel summation can be fictitious. That is, although we observed jumps in the Stokes multipliers at θ = ±π/2, it does not mean that ln Γ(z) is necessarily discontinuous there. In fact, discontinuities will only occur at Stokes lines if the original function possesses singularities on them. In the case of ln Γ(z) singularities only occur when θ = ±(l + 1/2)π and l > 0.
Another feature of the above results is that the sum over n has vanished. It has effectively been replaced by the Riemann zeta function. As a consequence, we now only have one integral to evaluate the remainder in (11). This will save much computational effort provided that the software package is able to evaluate the zeta function extremely accurately. Fortunately, this is accomplished using the Zeta routine in Mathematica [17].
Although the results in Theorem 2 have been proven, as in the case of Theorem 1, we cannot be certain that they are indeed valid because we have observed in the case of "Stokes smoothing" that proofs in asymptotics are not reliable unless they are verified by numerical analysis. Since the results in Theorem 1 have already been validated, we can use them to establish the validity of the MB-regularized forms in Theorem 2. Therefore, the next section presents a numerical analysis where the MB-regularized forms for ln Γ(z 3 ) are matched with the corresponding Borel-summed forms in Theorem 1.

Further Numerical Analysis
According to the definition of the regularized value [4][5][6][7], it must be invariant irrespective of how it is obtained. Therefore, we need to demonstrate that the MB-regularized forms in Theorem 2 yield identical values to the Borel-summed forms in Theorem 1, especially for the higher Stokes sectors and lines not studied previously. To access the higher/lower sectors or lines, higher powers of the variable z need to considered such as z 3 in ln Γ(z). This is tantamount to finding an asymptotic solution to a problem, which happens to yield the asymptotic forms of ln Γ(z 3 ). In this case the principal branch is still (−π, π], but Mathematica is only able to evaluate ln Γ(z 3 ) for θ over (−π/3, π/3]. From Theorem 2, two different representations exist for the regularized value of ln Γ(z) since replacing M by either M − 1 or M + 1 in (36) produces a different asymptotic form, where each is valid over one half of the domain of convergence for M = M. For example, the upper-signed version of (36) is valid for π < θ < 3π when M = 2, while for M = 1 and M = 3, it is only valid over 0 < θ < 2π and 2π < θ < 4π, respectively. Thus, the M = 1 result is valid for the bottom half of the domain of convergence for M = 2, while the M = 3 result applies to the top half of the domain of convergence for M = 2. This means that we are not only able to evaluate ln Γ(z) for higher/lower values of θ or arg z, but we can check the results against the asymptotic forms from overlapping domains of convergence. In addition, the M = 0 results can be checked with the values of ln Γ(z 3 ) evaluated by Mathematica. Finally, we can check to see whether the MB-regularized forms of ln Γ(z 3 ) yield identical values to the corresponding Borel-summed asymptotic forms in Theorem 1. Previously, we had no method of checking whether the Borel-summed asymptotic forms for ln Γ(z) outside the principal branch were correct. Now this problem can be tackled by comparing the resulting Borel-summed asymptotic forms when z is replaced by a power of itself with the corresponding MB-regularized forms.
If z is replaced by z 3 , then for M = 0 or −π/3 < θ < π/3, (36) becomes where and In (40), TS N (z) represents the truncated part of the asymptotic series, S(z) at N, as in (25), while the subscript U or L in (42) denotes whether the upper-signed or lower-signed version has been used. For M = 0, the subscript is dropped. Thus, ln Γ(z 3 ) is composed of Stirling's formula, the truncated series and an MB integral as the regularized value of the remainder. On the other hand, for M = 1, the upper-signed version of (36) yields The domain of convergence for this integral is 0 < θ < 2π/3, but it is not valid when θ = π/2 since S MB (M, z 3 ) is discontinuous whenever θ = ±(M ± 1/2)π/3 excluding M = 0. For θ = π/6, (38) can be used, but all that happens is the logarithmic term on the right-hand side of (43) is replaced by ln 1 − e −2π|z| 3 , which indicates that there is no discontinuity in ln Γ(z 3 ) at θ = π/6. For M = 1, when θ = ±(M + 1/2)π/3, θ = ±π/2. The upper value of θ lies in the domain of convergence for (43). In (36), we substitute (39) with z equal to z 3 for S MB (M, z). Then we arrive at As a result of the penultimate term, we expect a discontinuity when (44) is evaluated later. In addition, we can replace F(z 3 ) and TS N (z 3 ) in (40) by F(−i|z| 3 ) and TS N (−i|z| 3 ), respectively, while z 3 in (44) can be replaced by −i|z| 3 . When compared with (40), we see that (43) and (44) possess extra terms, which are similar to the Stokes discontinuity term in the Borel-summed asymptotic forms of Theorem 1. The difference here is that the lines of discontinuity are located in the domains of convergence. Thus, the asymptotic form is only different on the lines, whereas with Stokes lines, the regularized value is different before, on and after them. Moreover, we expect both forms for ln Γ(z 3 ) to yield identical values when the domains of convergence overlap, i.e., over (0, π/3). This does not occur with the Stokes phenomenon, indicating again that MB regularization is different from Borel summation.
For M = 2 and 3, the upper-signed version of (36) with z replaced by z 3 yields These results, which are similar to (43) except for the logarithmic terms, are not valid for θ = π/2 and θ = 5π/6.
Two separate numerical analyses will be presented here: the first aims to show the agreement between the MB-regularized asymptotic forms for ln Γ(z 3 ) and their Borel-summed counterparts, and the second deals with the behaviour of ln Γ(z 3 ) at the Stokes lines/rays. The first one includes an explanation of how to evaluate ln Γ(z 3 ) from the MB-regularized asymptotic forms. Then the results are compared with the Borel-summed asymptotic forms in Section 3 with z replaced by z 3 . We shall observe that although both MB-regularized asymptotic forms are defined at each Stokes line, they give incorrect values of ln Γ(z 3 ) with the difference being discontinuous jumps of 2πi. The second study at the Stokes lines/rays will be concerned with obtaining the correct values of ln Γ(z 3 ) via both the Borel-summed and MB-regularized asymptotic forms by applying the Zwaan-Dingle principle [6,15], which states that an initially real function cannot suddenly become imaginary.
Since there are no Stokes lines of discontinuity in the above results, there are always two MB-regularized asymptotic forms that yield the values of ln Γ(z 3 ) for all values of θ or arg z, except when θ = kπ/3 and k is an integer. Thus, the values from two different asymptotic forms for the regularized value of ln Γ(z 3 ) can be checked against each other, which is simply not possible with Borel-summed results.
Because it represents a value where standard Poincaré asymptotics breaks down, we shall carry out the numerical study of the above results with |z| set equal to 1/10 as before. Note that the actual variable in the above asymptotic forms is 2πz 3 . Therefore, we are dealing with a very small value, which means that both the truncated series, TS N (z), and the MB integral in the above results begin to diverge very rapidly for relatively small values of the truncation parameter, e.g., N = 4. Consequently, a cancellation of many decimal places will occur when adding TS N (z) to the MB integral. Despite the accuracy and precision goals being set to 30, one may not necessarily obtain a final value that is accurate at this level even though WorkingPrecision is now set higher to 80, not 60 as in Section 3. As stated earlier, the problem can be overcome by specifying much larger values of AccuracyGoal, PrecisionGoal and WorkingPrecision in NIntegrate, but it will come at the expense of computing time. Table 6 presents a very small sample of the results from the fourth program in the appendix of [11] for various values of N and θ or arg z. There are five sets of results, four with θ positive, and one where it is negative. The first row of each calculation gives the value of Stirling's formula, while the next row displays the value of TS N (z 3 ). Then the remainder denoted by MB Int. appears. As mentioned earlier, because the domains of convergence of the MB integrals overlap one another, two different MB integrals are computed for the remainder. The first MB integral is represented by M1, while the second is represented by M2. The second MB integral is not evaluated when θ = lπ/3 and l, an integer, as demonstrated by the third calculation. The values of N and θ appear together with the value of the first MB integral in each set. The values of S MB (M, z 3 ) are displayed in the rows immediately after the MB integrals. Then the results for the entire asymptotic form appear, which can be compared with the value of LogGamma from Mathematica. Table 6.
Values of ln Γ(z 3 ) with |z| = 1/10 and varying N and θ in the Mellin-Barnes (MB)-regularized forms. The first calculation in Table 6 lists the results for θ = −π/12 and N = 3. Then (40) and the complex conjugate of (43) corresponding to M1 = 0 and M2 = -1, respectively, yield the value of ln Γ(exp(−iπ/4)/1000). Stirling's formula on the first row is substantial, but not accurate, compared with the actual value from the LogGamma routine in the bottom row of the calculation. The second row of the calculation displays the value of TS 3 (exp(−iπ/4)/1000), which is O(10 6 ). Thus, at least six decimal figures need to be cancelled by the remainder or MB integral, which occurs when the value on the next row is included in (40). The value of S MB (0, exp(−iπ/4)/1000) (zero since M1 = 0) appears on the fourth row of the calculation, while the sum of all the preceding quantities appears in the fifth row labelled as 'Total via M1'. The total value agrees with the actual value of ln Γ(exp(−iπ/4)/1000) to 30 decimal places, well within the accuracy and precision limits despite the cancellation of six decimal figures. The sixth row of the first calculation displays the value of the MB integral for M2 = −1. As expected, it agrees with the first six decimal figures of the values for both the truncated sum and the MB integral in (40). However, S MB (1, z 3 ), which is now non-vanishing, appears on the seventh row. There it can be seen that the real and imaginary parts of this value are much greater in magnitude than those from Stirling's formula. If this value is summed only with Stirling's formula, then the resulting value deviates from the value of ln Γ(exp(−iπ/4)/1000) far more than either value on its own, but when it is summed with the truncated sum and MB-regularized remainder, it yields ln Γ(exp(−iπ/4)/1000) to 29 decimal places despite the cancellation of six decimal figures.
The other calculations in Table 6 are similar to the first set of results except the MB-integrals and S MB (M, z 3 ) are evaluated according to the relevant domain of convergence. The third calculation presents less results because it has already been stated that there is only one MB-regularized form, viz. (44), which is applicable. Nevertheless, the final result agrees with the value obtained from Mathematica. An interesting result in this calculation is that (ln Γ(z 3 )) = −π for θ = π/3 because the asymptotic series is composed of purely real terms when θ = kπ/3 and k is an integer. Hence the imaginary part of TS N (z 3 ) vanishes for all these values. In addition, the imaginary part of the MB integral can be shown to vanish by splitting the integral into two integrals and making the substitutions, s = c + it in the upper half of the complex plane and s = c − it in the lower half. Then all the terms become complex conjugates of each other. Expanding out all the terms, one is left with a real integral, while the imaginary part reduces to From Stirling's formula we obtain while the second term in (48) becomes ln 1 − e −2iπ|z| 3 = ln e −iπ|z| 3 + ln 2i sin(π|z| 3 ) .
Introducing these results into (48) yields In the last two calculations of Table 6, θ > π/3, which means that the LogGamma routine can no longer be used. We are now on our own, a new frontier in mathematics, where only the totals via the M1 and M2 asymptotic forms can yield the value of ln Γ(z 3 ). Moreover, when θ equals 2π/3 or π, there will only be one MB-regularized form that yields the regularized value. For these cases we require the Borel-summed regularized values as a check.
In the fifth calculation, N is set equal to 5, which yields a value of O(10 17 ) for the truncated sum. Hence at least 16 decimal figures need to be cancelled in order to obtain ln Γ(e 12iπ/7 /1000). Since θ = 4π/7, the domains of convergence are (0, 2π/3) and (π/3, π) corresponding to M1 = 1 and M2 = 2. Thus, (43) and (45) apply, which is interesting because S MB (M, z 3 ) is very different in these asymptotic forms, particularly the imaginary parts. As expected, the MB integrals for both asymptotic forms yield the 17 decimal figures in the real parts needed to cancel the real part of the truncated sum, TS 5 (e 12iπ/7 /1000). On the other hand, only 11 decimal figures are cancelled in the imaginary parts. As a result of the cancellation, the real parts in the totals only agree to 17 decimal figures. The same applies to the imaginary parts, which is surprising since there were less cancelled figures.
Because 4π/7 is closer to the upper limit of 2π/3 of the domain of convergence for (43), one expects the total obtained via M1 in the table to be the less accurate of the two forms. In actual fact, it turns out that this value is more accurate than the total via (45) by a few extra decimal places.
Nevertheless, if WorkingPrecision is set to 100 and AccuracyGoal and PrecisionGoal to 40, then both totals are found to agree to 32 decimal places, although the computation time is more than doubled. Another method of avoiding long computation times is to keep N as low as possible.
The final calculation in Table 6 is similar to the previous one except that (45) is introduced into (40) to yield the MB-regularized asymptotic forms for θ = 8π/9. For N = 6, the truncated sum is O(10 23 ). Since the highest degree of cancellation between the truncated sum and remainder occurs here, we find that this calculation yields the least accurate results of all those in the table. Despite this fact, the final results still agree with each other to 10 decimal places. Hence the results in Table 6 confirm the validity of the MB-regularized asymptotic forms for ln Γ(z 3 ).
We now consider the MB-regularized asymptotic forms near Stokes lines. Although the code should not be run when θ corresponds directly to a Stokes line, one can do so since the MB integrals are defined. Table 7 displays some of the results obtained by running the fourth program in [11] near the Stokes lines at θ = π/2, θ = 5π/6 and θ = −π/6 with |z| = 1/10 and N = 5. When θ = π/2, the code evaluates ln Γ(z 3 ) via (43) and (45) with M1 = 1 and M2 = 2, respectively. The first two results in the table display the values of (43) and (45) near the discontinuity at π/2 with θ = 19π/40. As expected, both forms of ln Γ(z 3 ) yield identical values. At θ = π/2, however, both forms yield different results, but only for the imaginary parts. In fact, there is a jump discontinuity of 2πi between the results with the first form yielding −iπ/2 and the second, 3iπ/2. Note, however, that the discontinuities arise only from taking the logarithm of the gamma function. The gamma function itself is not discontinuous. As expected, neither result for θ = π/2 is correct. The correct result is the midway between −π/2 and 3π/2. That is, ln Γ(z 3 ) θ=π/2 = π/2. Table 7. ln Γ(z 3 ) via the MB-regularized forms in the vicinity of the lines of discontinuity given by θ = −π/6, θ = π/2 and θ = 5π/6 with |z| = 1/10 and N = 5. The next set of six results display the case where θ is very close to 5π/6, viz. ±π/150 away. In this case both forms in (45) are used to calculate ln Γ(z 3 ). Once again, both forms yield identical results below and above θ = 5π/6. However, for θ = 5π/6, they yield identical values for both the real and imaginary parts. In fact, although the imaginary parts have the same value of iπ/2, it is incorrect because ln Γ(z 3 ) experiences a jump discontinuity of −2πi. Mathematica has simply chosen the wrong value for the logarithmic terms in (45), as explained on p. 564 of [17]. Noting that there is a jump of −2π means that ln Γ(z 3 ) θ=5π/6 = −π/2, which corresponds to midway for the results before and after the Stokes line.
The final set of results in Table 7 have been obtained for θ very close to −π/6. Because |θ| < π/3, we can evaluate ln Γ(z 3 ) via the LogGamma[z] routine in Mathematica. Hence there are more results for this calculation. This calculation employs (40) (M1 = 0) and the complex conjugate of (43) (M2 = 1). As before, the two versions of ln Γ(z 3 ) give identical values above and below the Stokes line at θ = −π/6. Moreover, they agree with the values obtained via LogGamma [z]. The interesting point about this calculation, however, is that all three values at the Stokes line θ = −π/6 also agree. This is expected since there is no extra logarithmic term in (42), while in the other asymptotic form the logarithmic term is purely real for θ = ±π/6. Thus, there is no discontinuity in ln Γ(z 3 ) at θ = ±π/6, which shows that Stokes discontinuities in Borel-summed regularized values can be fictitious.
The final calculation is the verification of the Borel-summed asymptotic forms for ln Γ(z 3 ). It was not possible to check these results previously because their regions of validity do not overlap. Now we use the MB-regularized asymptotic forms to verify their Borel-summed counterparts. In addition, we can confirm that the MB-regularized asymptotic forms for θ = kπ/3, where k equals ±1, ±2 and 3, are correct, since only one MB-regularized asymptotic form is valid for these values.
The Borel-summed asymptotic forms that are valid for the Stokes sectors can be expressed as The main difference between these results and the earlier MB-regularized values is that though they possess similar logarithmic terms, they emerge in different sectors within the principal branch. Table 8 presents a very small sample of the results obtained by running the fifth program in the appendix of [11] with |z| = 5/2 and the upper limit in R + N (z 3 ) and R − N (z 3 ) set to 10 5 as in Section 3. The first calculation displays the results obtained for θ = −π/7 and N = 4. Since N OP = 8 according to (23), Stirling's formula or F(z 3 ) yields a reasonable approximation to the actual value of ln Γ((5/2) 3 e −3iπ/7 ), which appears at the bottom of the calculation. Consequently, the truncated sum is small, only contributing at the third decimal place. Two MB-regularized asymptotic forms apply: (1) (40) denoted by M1 = 0, and (2) the complex conjugate of (43) denoted by M2 = −1. The MB-Integrals in the remainder are O(10 −12 ). For M1 = 0, there is no logarithmic term, while for M2 = −1, there is a contribution, but it is almost negligible, O(10 −42 ). That is, the M1 = 0 and M2 = −1 calculations are virtually identical to one another, well within the accuracy and precision goals set in NIntegrate. Therefore, the totals representing the sum of F(z 3 ), the MB integrals and the logarithmic terms, are not only identical to one another, but they also agree with the value obtained from the LogGamma routine in Mathematica.
The result labelled Borel Rem represents the Borel-summed remainder or R + N (z 3 ) in the fourth asymptotic form of (57), where the upper limit in the sum has been set to 10 5 . Despite this truncation, it is identical to the values obtained from the MB regularized asymptotic forms. In actual fact, the Borel Rem value is identical to the first 34 decimal figures of the MB integrals, well within the accuracy and precision goals. Bearing in mind that the remainder is very small, this means that only the first 13 or so decimal figures of each remainder calculation will contribute to the totals. That is, the remainder is truly subdominant.
The second calculation displays the results for θ = 2π/3 and N = 2, which has only one valid MB-regularized asymptotic form. In addition, Stirling's formula, the truncated sum and the MB integral are all real, while the logarithmic term yields the imaginary contribution of −π/4. Hence we see that ln Γ |z| 3 e 2iπ = −π/4. As expected, the value of the MB integral is very small, O(10 −7 ), while Stirling's formula provides an accurate value for ln Γ (125 exp(2iπ)/8). Appearing below the Total is the remainder of the Borel-summed version for ln Γ |z| 3 exp(2iπ) or R + N (z 3 ) in the second result of (57), which in turn has the same logarithmic term as (45). Hence both calculations are expected to be identical. However, a closer inspection reveals that they agree to 23 decimal figures, but not the expected 30 specified by the accuracy and precision goals. This discrepancy, which arises from the truncation of the Borel-summed remainder, is an example where the upper limit of the sum over n has to be set much higher in order to achieve the desired accuracy.
The final set of values have been obtained by setting θ equal to 11π/12 and N to 4. Once again, there are two MB-regularized asymptotic forms, both obtained from (45). The Borel-summed asymptotic form in this case is given by the first form in (57). All the remainder terms are tiny, O(10 −12 ). If only the logarithmic term for all three forms is added to Stirling's formula, then a good approximation is obtained. In this instance the logarithmic term for the Borel-summed form is identical to the second form in (45), but by comparing it with the value obtained via the M1=2 form, the extra term is very small indeed, only differing at the 20-th decimal place. Nevertheless, all three totals agree with each other as in the other cases in the table. Before we can be assured that there is complete agreement between both sets of asymptotic forms, we need to carry out a final numerical analysis at the Stokes lines. The Borel-summed asymptotic forms at these lines are given by (52), but now with R − N (z 3 ) or (54) and SD − M (z 3 ) or (56). Putting M equal to 0, 1 and 2, yields the specific forms at the Stokes lines, which are Note the similarity of the Stokes discontinuity terms with the corresponding terms or S MB (z 3 ) in the MB-regularized asymptotic forms. The major difference occurs with the logarithmic term, which is represented by either a zero or full residue contribution in the MB-regularized asymptotic forms, while it is always represented by a semi-residue or half the contribution in the Borel-summed asymptotic forms. Table 9 presents a small sample of the results obtained by running the final program in the appendix of [11]. Since the MB integrals yielded values of O(10 −3 ), there was no significant cancellation of decimal figures as in Table 8. The first column of Table 9 displays the value of θ for the respective Stokes line. Here they are presented for the Stokes lines at: (1) θ = π/6, (2) θ = −π/2 and (3) θ = 5π/6. As stated before, ln Γ(z 3 ) cannot be evaluated by Mathematica for the last two cases. Thus, LogGamma[z] appears as an extra result for θ = π/6. The second column of Table 9 displays the equation that was used to calculate the value of ln Γ(z 3 ). The label 'c.c.' denotes that the complex conjugate of the equation was used, which applies here because θ is negative. The third column displays the actual values to 27 decimal places. We see that not only do the two different MB-regularized asymptotic forms agree with one another at each Stokes line, they also agree with the results obtained from the the Borel-summed asymptotic forms in (58) and where possible, with the LogGamma routine in Mathematica. Table 9. ln Γ z 3 for |z| = 9/10 at the Stokes lines within the principal branch.
θ Method Value

Conclusions
In [16] it was stated that a fully-fledged theory of divergent series could only be realized if more complicated problems were studied than those presented in [6]. Amongst these was the extension of the asymptotics of the gamma function to the entire complex plane since the Stokes lines possess an infinite number of singularities rather than one as studied in [6]. This has been achieved here, which leaves the development of the complete asymptotic expansion for the confluent hypergeometric function over the entire complex plane as the next problem. In this instance it will be necessary to develop and regularize infinite subdominant series throughout the complex plane.
Funding: This research received no external funding.