Recursive computation of finite difference of associated ... - Springer Link

4 downloads 79 Views 439KB Size Report
Mar 20, 2012 - of Gleason's method for a low degree as functions of inte- gration interval. We omit the results of Paul's and Gerstl's methods since the ...
J Geod (2012) 86:745–754 DOI 10.1007/s00190-012-0553-8

ORIGINAL ARTICLE

Recursive computation of finite difference of associated Legendre functions Toshio Fukushima

Received: 11 November 2011 / Accepted: 8 March 2012 / Published online: 20 March 2012 © Springer-Verlag 2012

Abstract The existing methods to compute the definite integral of associated Legendre function (ALF) with respect to the argument suffer from a loss of significant figures independently of the latitude. This is caused by the subtraction of similar quantities in the additional term of their recurrence formulas, especially the finite difference of their values between two endpoints of the integration interval. In order to resolve the problem, we develop a recursive algorithm to compute their finite difference. Also, we modify the algorithm to evaluate their definite integrals assuming that their values at one endpoint are known. We numerically confirm a significant increase in computing precision of the integral by the new method. When the interval is one arc minute, for example, the gain amounts to 2–4 digits for the degree of harmonics in the range 2 ≤ n ≤ 2,048. This improvement in precision is achieved at a negligible increase in CPU time, say less than 5 %. Keywords Associated Legendre function · Finite difference · Recursion · Rounding errors

esy and geophysics as well as many other sciences (Hwang and Kao 2006). An arbitrary bivariate function defined on a unit sphere, f (θ, λ), can be expanded in terms of spherical harmonics (Heiskanen and Moritz 1967) as f (θ, λ) =

∞ 

C n0 P n (cos θ ) +

n=0

+ S nm sin mλ

n ∞    C nm cos mλ n=0 m=1



m P n (cos θ ),

(1)

where θ and λ are the co-latitude and longitude of a point on a unit sphere, C nm and S nm are the coefficients of the m harmonic expansion, P n (t) is the 4π fully normalized ALF 0 (fnALF), and P n (t) ≡ P n (t). Once the coefficients are given, it is straightforward to evaluate the function. This is the spherical harmonic synthesis (Holmes and Featherstone 2002; Fantino and Casotto 2009). Its main computational problem is the precise and fast evaluation of fnALF of arbitrary degree and order as well as its derivatives (Bosch 2000; Fukushima 2011, 2012).

1 Introduction

1.2 Integral of associated Legendre functions

1.1 Associated Legendre functions

Let us consider the inverse problem, which is termed the spherical harmonic analysis (Rapp 1989). Assume that, except for the polar caps, the function values are known at blocks of θ and λ as f (θ, λ) ≈ f k when θk−1 ≤ θ < θk and λ−1 ≤ λ < λ . Also, we assume that the nodal values in co-latitude and longitude, θk and λ , are evenly spaced in their domain, 0 ≤ θ < π and 0 ≤ λ < 2π . Namely, we set that θk = kθ and λ = λ for k = 1, 2, . . . , K − 1 and  = 1, 2, . . . , L where θ ≡ π/K and λ ≡ 2π/L are constant.

The computation of definite integral of associated Legendre functions (ALF) is the basis of harmonic analysis on a sphere (Olver et al. 2010, Chapter 14). It is frequently used in geodT. Fukushima (B) National Astronomical Observatory, Ohsawa, Mitaka, Tokyo 181-8588, Japan e-mail: [email protected]

123

746

T. Fukushima

Then, except for the contribution from the polar caps, the harmonic coefficients are computed approximately (Hwang and Kao 2006) as C n0 

K −1 L  λ  ≈ In0 (tk−1 , tk ) f k , 4πqn

C nm S nm ×



1 ≈ 4πqn

L 

 f k

=1

(2)

=1

k=2

K −1 

cm (λ−1 , λ ) sm (λ−1 , λ )

 (3)

tk pnm dt,

(4)

tk−1



cm (λ−1 , λ ) sm (λ−1 , λ )

λ 

 ≡

λ−1

 cos mλ dλ, sin mλ

(5)

m

and we abbreviate P n (t) to pnm hereafter. The computation of cm and sm are straightforward:     1 cm (λ−1 , λ ) sin mλ − sin mλ−1 = sm (λ−1 , λ ) m − cos mλ + cos mλ−1 2 sin(mλ/2) = m   cos [(2 − 1)mλ/2] × . sin [(2 − 1)mλ/2]

(6)

The last expression is free from the cancellation problems and, as a result, robust against the smallness of λ. 1.3 Densified integration grids In the above, we assumed that the function value is constant in each integration block. This would be too crude if the block size is the same as that of data points. A natural way to improve this treatment is to integrate not the step functions representing data values, but smooth functions interpolating them such as the bicubic interpolation (Press et al. 2007, Section 3.6.3) of the form f (θ, λ) ≈

3  3 

f ki j (θ − θk−1 )i (λ − λ−1 ) j ,

i=0 j=0

in the block θk−1 ≤ θ < θk and λ−1 ≤ λ < λ .

123

(θ − θk−1 ) j pnm dt,

(8)

tk−1



where t ≡ cos θ is the argument of ALF and qn is a quantity to make the approximation as realistic as possible (Rapp 1989), which is usually set as a switch of low order monomials of the Pellinen smoothing factor (Colombo 1981). Here Inm , cm , and sm are the definite integrals of ALF and trigonometric functions as Inm (tk−1 , tk ) ≡

tk Inm j (tk−1 , tk ) ≡

Inm (tk−1 , tk )

k=2

Except for the computation of interpolation coefficients, f ki j , from the function values at given grid points, which itself is fairly complicated computational issue, this requires the evaluation of the moment integrals up to the third-order:

(7)

cm j (λ−1 , λ ) sm j (λ−1 , λ )

λ 

 ≡

λ−1

 cos mλ (λ − λ−1 ) j dλ, sin mλ

(9)

for j = 1, 2, 3. This makes the problem significantly complicated. Another approach is the densification of the integration blocks. Namely, we (1) subdivide the integration interval by a certain integer, (2) assign, to the grid points of each subdivision, pseudo data values interpolated by means of a certain procedure like the bicubic interpolation, and (3) conduct the same approach described in the previous subsection. Although this is a brute force method, it can enable us to employ the existing procedure to compute the integrals. A question in this case is the number of subdivisions. When we use the bilinear approximation, the factor 2 or 3 is enough. However, it will be 6 or 8 in case of the cubic interpolation, For example, consider to interpolate altimeter data with a ground surface footprint of 1.7 km, which corresponds to 1 resolution (Sandwelland Smith 2009). Then, 10 will be a suitable size of such densified integration interval. At any rate, the summation along the parallel, i.e. that with respect to λ for constant θ , can be efficiently conducted by FFT (Hwang and Kao 2006). Therefore, the main computational problem of the spherical harmonic analysis reduces to the precise and fast evaluation of the definite integrals of ALF (Paul 1978).

1.4 Existing methods of integral computation Paul (1978) provides a recursive algorithm for simultaneous evaluation of the integrals of fnALF of various degree and order for the given interval of integration. When at least one endpoint of the interval lies in the polar region, the forward recurrence formula of the sectorial integrals for increasing degree and order faces a severe loss of significant figures. In that case, Paul (1978, Eqs. (25) and (25a)) suggested to evaluate the sectorial integrals directly by their Maclaurin series expansion with respect to u ≡ sin θ . Gerstl (1980) noticed that the sectorial integrals in such cases are effectively computed by the backward recursion for decreasing degree and order. The backward recursion requires a couple of integral values of certain high orders as the initial values, which are computed directly from the

Recursive computation of finite difference of associated Legendre functions

log10 (maxnm| δInm|)

-2

θ1=45o, n=4, 0 ≤ m ≤ n

-4

0

Taylor: k=1 k=2

-6

k=3

-8 -10

Gleason

-12 -14

New

-4

Taylor: k=1 k=2

-6 -8 -10

k=3 Gleason

-12 -14

New

θ1=45o, Δθ=1’, 0 ≤ m ≤ n

-16

-16 -18 -1

-2

log10 (maxnm| δInm| )

0

747

0

1

-18

10

log10 (Δθ/1’) Fig. 1 Interval length dependence of relative error of integral of fnALF. The maximum of the relative error of Inm computed by several methods for n = 4 and m in the range 0 ≤ m ≤ 4 are plotted as a function of the base-10 logarithm of θ scaled by 1 arc minute, while the southern endpoint of the interval is fixed as 45◦

Maclaurin series expansion; also see Gleason (1985). As a starting point for the new method we shall develop below, we summarized the existing methods in Appendix A.

1.5 Cancellation problems There are two types of problem resulting the loss of significant figures in computing the integrals of fnALF. One is due to the smallness of fnALF values near the poles. It depends strongly on the latitude and becomes more problematic when the maximum degree and order is higher. However, this problem is overcome using the backward recursion as described above. Meanwhile, when the interval length is small, another type of problem emerges independently of the latitude. This is more eminent at the harmonics of lower degree than those of higher degree. The increase of maximum degree to be considered inevitably leads to the decrease of integration interval. Indeed, the integration interval is inversely proportional to the maximum degree. Therefore, this issue also becomes important when the maximum degree becomes higher. Let us take an example. Figure 1 plots the relative error of Gleason’s method for a low degree as functions of integration interval. We omit the results of Paul’s and Gerstl’s methods since the difference among these three methods is not visible at this scale. The errors are those when the interval is in the middle latitude area for the degree n = 4 and the order in the range 0 ≤ m ≤ n. More specifically speaking, we (1) measured the errors as the difference from the quadruple precision computation using the same Gleason’s method, (2) normalized them by the magnitude of integral itself, (3) selected their maximum among the results for the order of harmonics in the range, 0 ≤ m ≤ n, while the degree

100

1000

n Fig. 2 Degree dependence of relative error of integral of fnALF. Same as Fig. 1 but plotted for the case θ = 1 as functions of the degree, n, logarithmically

is fixed as n = 4, and (4) plotted them as a function of the base-10 logarithm of the interval length in the unit of 1 . We confirmed the correctness of the quadruple precision computation by random comparison with 40 digits computation using Mathematica (Wolfram 2003). Figure 2 illustrates the dependence of the same integral errors as functions of the degree in the range, 2 ≤ n ≤ 2,048. This time, we fixed θ as 1 . In computing fnALF and other quantities properly when n is large, say when n ≥ 512, we introduced a global scaling constant of 2830 ≈ 7.16 × 10249 in order to avoid the underflow problem without usage of extended exponent arithmetics (Holmes and Featherstone 2002). These figures show that the loss of significant figures in the existing methods is eminent in low degree and order. Since the integration interval must be reduced according to the maximum degree, this phenomenon becomes serious when increasing the maximum degree of harmonics.

1.6 Taylor series approximation One remedy to the loss of significant figures observed in the previous subsection is to use the Taylor series approximation of integrals (Appendix B). Although this requires the computation of derivatives of fnALF, they can be obtained without cancellation problems once the values of fnALF are provided (Bosch 2000). Figures 1 and 2 have already shown the results of the first-, second-, and third-order Taylor series approximation of the integral. For a low degree such as n = 4, the Taylor series expansions are effective when θ is sufficiently small, say less than 10 for the third-order method. However, this effectiveness significantly degrades when n increases. This is because the magnitude of the derivatives, especially those of high order ones, increases dramatically with respect to n (Fukushima 2012).

123

748

In conclusion, the Taylor series expansion cannot be used as a replacement of the existing methods (Figs. 1, 2).

T. Fukushima

2 Method 2.1 Recursive computation of finite difference of fnALF

1.7 Finite difference of associated Legendre functions Of course, the relative errors of Inm computed by the existing methods are as small as less than 10−10 when θ > 1 . However, the situation drastically worsens when n increases. Firstly, even when θ is fixed, the errors of each integral increases when n increases. This cannot be avoided since it is a natural result of the increase in the errors of fnALF themselves (Fukushima 2011). Also, the increase in n is usually driven by the densification of observational data or model computation, which inevitably results the decrease in θ inversely proportional to the maximum value of n. Further, the number of terms of the summation to determine the harmonic coefficients increases with respect to n. Combining these effects, we estimate that the final errors of spherical harmonic analysis increase significantly with respect to n. Therefore, we must try to reduce the computational errors of each Inm as much as possible. Of course, it is preferable if the reduction is realized at a negligible increase in the computational labor. Replacing each part of the double precision computing process of the existing methods by their quadruple precision extension one by one, we find that the defect is due to the cancellation in the computation of an additional term in the main recurrence formula of integral computation. The additional term is the difference of a quantity between two endpoints of the integration. This problematic quantity is a product of u 2 and pnm . We notice that its difference is rewritten as a linear sum of the differences of u and of pnm . The finite difference of u itself is easily rewritten in a cancellation error-free form using the addition theorem of trigonometric functions as will be shown in Appendix C. Therefore, the problem is finally reduced to obtain a finite difference of pnm precisely.

Let us precisely compute a finite difference of fnALF, pnm ≡ pnm (θ2 ) − pnm (θ1 ) .

(10)

Refer to Appendix C for the basic properties of the finite difference operator, . Taking the finite difference of the recurrence formulas given in Appendix D, we obtain the fixed-order recurrence formulas of pnm as   pmm = dm u 2 pm−1,m−1 + pm−1,m−1 u , (11) (12) pm+1,m = am+1,m (t2 pmm + pmm t) ,   pnm = anm t2 pn−1,m + pn−1,m t −bnm pn−2,m , (13) where pnm without specification is that at the angle θ1 , and the numerical coefficients, dm , anm , and bnm , are defined as  2m + 1 , (14) dm ≡ 2m (2n + 1)(2n − 1) anm ≡ , (15) (n + m)(n − m) (2n + 1)(n + m − 1)(n − m − 1) . (16) bnm ≡ (2n − 3)(n + m)(n − m) Meanwhile, the starting values are explicitly given as √ √ p00 = 0, p10 = 3t, p11 = 3u. (17) Also, t and u are computed from θ ≡ θ2 − θ1 as θ , 2 θ u = 2 cos θ sin , 2 t = −2 sin θ sin

(18) (19)

while 1.8 Outline of this work θ≡ In order to resolve the problem observed in the above subsections, we propose to obtain the finite difference of pnm by recursion. The resulting method calculates the integral value more precisely than the existing methods as illustrated in Figs. 1 and 2. In Sect. 2, we describe the new method including the recurrence formulas to compute the finite difference of pnm . The formulas are derived from those to obtain the values of pnm summarized in Appendix D by means of the finite difference operation explained in Appendix C. In Sect. 3, we numerically examine the cost and performance of the new method.

123

θ2 + θ1 θ = θ1 + , 2 2

(20)

is the mean value of the two angles, 2.2 Modification of integral recursion Next, we modify the recursive computation of integrals. Some of the formulas to compute the integrals of fnALF provided in Appendix A contain the finite difference of quantities between two angles. One example is Jnm ≡ (u 2 pnm ),

(21)

Recursive computation of finite difference of associated Legendre functions

introduced in Eq. (46) in Appendix A. In order to avoid cancellation, we rewrite it as Jnm = u 22 pnm + pnm (u 2 ),

(22)

where pnm is prepared by the recursion described in the previous subsection, pnm is understood to be that at θ1 , and (u 2 ) is computed from u given in Eq. (19) as (u 2 ) = (u 2 + u 1 )u.

where we used the Maclaurin series expansion of sin θ . The series expansion converges rapidly for almost all cases of |θ |, say when it is less than 6◦ . 2.4 Modification of sectorial integral computation Yet another example of the finite difference to be modified is the series expansion of the sectorial integral,

(23) Imm ≡ − (qm pmm ) ,

Another example is K nm ≡ (t pnm ),

749

(24)

(32)

where  ∞   (2 j − 1)!! u 2 j+2 , (2 j)!! m + 2j + 2

introduced in Eq. (63) in Appendix A, which appears in the recursion given in Gleason (1985). It is similarly rewritten as

qm (u) ≡

K nm = t2 pnm + pnm t,

is an auxiliary function defined by an infinite series; also see Paul (1978, Eq. (25a)). We rewrite it in a cancellation error-free form as

(25)

where t is calculated from θ without cancellation problem as already described in Eq. (18). 2.3 Modification of starting values Also, we express the initial values of integral recursion in cancellation error-free forms as I00 = t, √ 3 I10 = (t1 + t2 ) t, √2 3 I11 = (t2 u + u 1 t − θ ) , 2

√ 2t 2 + u2 u 15 2 I22 = t, u 21 + u 22 + 1 2 6 1 + t1 t2

(26)

(34)

where pmm is again interpreted as its value at θ1 , and qm is calculated by a series expansion as qm =

∞   j=0

 (2 j − 1)!! (u 2 j+2 ) (m + 2 j + 2)(2 j)!!

(35)

  while  u 2 j are recursively computed as

(28)

(u 2 j ) = u 22 (u 2 j−2 ) + u 1

(29)

starting from (u 2 ), the cancellation error-free form of which is given in Eq. (23).

(30)

This happens with an approximate chance of one third: namely when θ < 30◦ unless |θ | is large, say greater than 0.1 radian or 6 degrees. In that case, we further rewrite it as √ 3 (sin 2θ − 2θ ) I11 = 4 √ 3 = [(1 − 2 sin2 θ) sin θ − θ ] 2 ⎡⎛ ⎤ ⎞ √ ∞ j 2 j+1  3 ⎣⎝ (−1) (θ ) ⎠ −2 sin2 θ sin θ⎦ , (31) = 2 (2 j + 1)! j=1

Imm = −qm (u 2 ) pmm − pmm qm ,

(27)

where t and u are given in Eqs. (18) and (19). In deriving the above, we used the relations, Eqs. (75), (76), and (77) in Appendix C. The above expression of I11 suffers a loss of one significant bit or more when θ < 2 cos 2θ. sin θ

(33)

j=0

2 j−2

(u 2 ), ( j ≥ 2)

(36)

3 Numerical experiments 3.1 Error of finite difference of fnALF Let us begin with the computing precision of finite difference of fnALF. Figure 3 provides the co-latitude dependence of the relative error of finite difference of fnALF obtained by the direct difference method and the new method. The errors are the difference from the quadruple precision computation using the direct difference method. Plotted are the maximum of errors chosen among the results with degree n = 4 and order m satisfying 0 ≤ m ≤ n. Results are obtained for various different values of the co-latitude difference, θ ≡ θ2 − θ1 . They are set as powers of 10 in arc minutes. Then the errors are normalized by the magnitude of θ , and plotted as a function of θ1 . The errors of the new method are practically independent of both θ1 and |θ |.

123

750

T. Fukushima 1.4

n=4, 0 ≤ m ≤ n

Direct 0.1’

-10 -11 -12

1’

-13

10’

-14

100’

-15

New

New, Multiple

1.3

Relative CPU Time

log10| (maxnmδ(Δpnm))/Δθ |

-9

1.2

Gleason’s, Multiple

1.1

New, Single

1

Gleason’s, Single

-16 -17

0

15

30

45

60

75

90

0.9

2

3

θ1 (deg)

-9

log10 |maxnmδInm|

n=4, 0 ≤ m ≤ n

Gleason

-11

0.1’

-12

1’

-13

10’

-14

100’

-15

New

-16 -17

0

15

30

45

60

75

90

θ1 (deg) Fig. 4 Co-latitude dependence of relative error of integral of fnALF. Same as Fig. 3 but for the integral Inm computed by Gleason’s method and the new method

3.2 Error of integral of fnALF Figure 4 illustrates the co-latitude dependence of the relative error of integral of fnALF obtained by Gleason’s method and the new method. The errors are the maximum relative errors for n = 4 and 0 ≤ m ≤ n. The errors themselves are obtained by comparing with the quadruple precision computation using Gleason’s method. Again, the errors of the new method are practically independent on |θ |. Comparing Figs. 3 and 4, we learn that the errors of existing methods to compute integrals mainly come from those of the finite difference of fnALF. 3.3 CPU time Figure 5 shows the relative CPU time of four methods in the double precision environment: (1) Gleason’s method for a

123

5

6

7

8

9

10

11

log2M

Fig. 3 Co-latitude dependence of relative error of finite difference of fnALF. Shown are the maximum relative error of pnm obtained by the direct difference method and the new method. They are plotted as a function of the co-latitude of southern endpoint, θ1 , for various values of the interval length, θ ≡ θ2 − θ1 < 0. The maximum error is that among degree and order in the case n = 4 and 0 ≤ m ≤ n

-10

4

Fig. 5 Averaged CPU time of integral computation of fnALF. Illustrated are the relative increase in averaged CPU times in the double precision environment to compute Inm of some methods from that of Gleason’s method for a single integration interval. The results are plotted as the base-2 logarithm of the maximum degree M

single interval, (2) Gleason’s method for multiple intervals sharing endpoints, (3) the new method for a single interval, and (4) the new method for multiple intervals. Since only the ratios among the four methods are meaningful, we illustrated the results of the last three methods scaled by the first one. All the computation codes were (1) written in Fortran 90 with the double precision environment, (2) compiled by the Intel Visual Fortran Composer XE 2011 update 8 with the level 3 optimization, and (3) executed at a PC with an Intel Core i7-2675QM CPU and 16 GB main memory run at the clock 2.20 GHz under the 64 bit Windows 7 Operating System. We learn that the CPU time of the new method for a single interval is a little larger than that of Gleason’s method, say around 5% more. On the other hand, the methods for multiple intervals sharing endpoints run significantly slower than the methods for a single integral. This is because the copying time of fnALF at shared points are rather time-consuming than generating themselves by recursion.

4 Conclusion In order to resolve the cancellation problem of the recursive computation of definite integral of associated Legendre functions (ALF) caused by the relative smallness of the integration interval compared with the inverse of degree, we obtained (1) a recursive algorithm to compute their finite differences by assuming that their values at one endpoint of the interval are known, and (2) an improvement of the computing procedure in the existing methods (Paul 1978; Gerstl 1980; Gleason 1985). Since the ALF of different normalization differs only by a multiplication factor, it would be easy

Recursive computation of finite difference of associated Legendre functions

to translate the new formulation designed for the 4π fully normalized ALF into other normalizations. The resulting new method is sufficiently precise independently on the value of co-latitude. For example, when the interval is one arc minute, the precision gain amounts to 2–4 digits for degree of harmonics, n, in the range 2 ≤ n ≤ 2048. This increase in precision is realized at a negligible increase in CPU time, say less than 5%. We confirmed these results up to the case the maximum degree and order is around 2,000. Although we did not test the new method beyond that, Figs. 2 and 5 allow us to extrapolate that the observed tendency seems to keep. Therefore, we recommend the usage of the new method when the cancellation problem would occur.

751

At any rate, we only have to consider the case when the whole integration interval is in the northern hemisphere as 0 ≤ t1 < t2 ≤ 1. Consequently, we assume that 0 ≤ u 2 < u 1 ≤ 1, and 0 ≤ θ2 < θ1 ≤ π/2 in the following discussion. A.2 Non-sectorial recursion Let us begin with the non-sectorial integrals, Inm where n > m. We assume that the sectorial integrals, Imm , are all known. Then, the non-sectorial integrals are obtained by a fixed-order increasing-degree recursion (Paul 1978, Eq. (20a)) as Im+1,m = −h m+1,m Jmm , (m ≥ 1)

(42)

Inm = gnm In−2,m −h nm Jn−1,m , (n ≥ m +2, m ≥ 0) Acknowledgments The author appreciates valuable suggestions and fruitful comments by anonymous referees to improve the quality of the article.

Appendix A: Computation of integrals of fnALF Let us summarize the standard algorithm on the computation of integrals of fnALF (Paul 1978; Gerstl 1980; Gleason 1985). A.1 Reduction of integration interval

(37)

This is simply derived from the reflection formula (Olver et al. 2010, Formula 14.7.17): pnm (−t) = (−1)n−m pnm (t).

where gnm

n−2 ≡ n+1

h nm

1 ≡ n+1



(2n + 1)(2n − 1) , (n + m)(n − m)

(45)

(38)

A.3 Forward sectorial recursion Next, we consider the sectorial integrals, Imm . Near the equatorial region where u is sufficiently large, the integrals are computed by the forward recursion increasing degree and order (Paul 1978, Eq. (20a)): Imm = i m Im−2,m−2 + jm Jm−1,m−2 , (m ≥ 3) where

Inm (t1 , t2 ) = (−1)n−m Inm (0, −t1 ) + Inm (0, t2 ) .

1 jm ≡ 2(m + 1)

(39)

(40)

On the other hand, if n−m is even, we have another rewriting:

(41)

(46)

is a partial integral.

1 im ≡ 2(m + 1)

Inm (t1 , t2 )  2Inm (0, −t1 ) + Inm (−t1 , t2 ) (if − t1 < t2 ) = 2Inm (0, t2 ) + Inm (t2 , −t1 ) (otherwise)

(44)

are a pair of numerical coefficients depending on n and m only, and

Next, when the interval includes the equator, namely when −1 ≤ t1 < 0 < t2 ≤ 1, the integral is split into the sum of northern and southern parts as

If n − m is odd, this is further rewritten as  Inm (−t1 , t2 ) (if − t1 < t2 ) Inm (t1 , t2 ) = −Inm (t2 , −t1 ) (otherwise)

(2n + 1)(n + m − 1)(n − m − 1) , (2n − 3)(n + m)(n − m)

Jnm ≡ u 22 pnm (t2 ) − u 21 pnm (t1 ) ,

We reduce the integration interval so as to simplify the numerical computation of the integrals of fnALF. First, when the whole interval is in the southern hemisphere, namely when −1 ≤ t1 < t2 ≤ 0, the integral reduces to that in the northern one as Inm (t1 , t2 ) = (−1)n−m Inm (−t2 , −t1 ) .

(43)



(47)

m(2m − 1)(2m + 1) , m−1

(48)

2m + 1 , m(m − 1)

(49)

are a couple of numerical coefficients depending on m only. The starting values of the forward recursion are explicitly provided (Paul 1978, Eq. (26a)): I00 = t2 − t1 , √   3 2 t2 − t12 , I10 = √2 3 I11 = (t2 u 2 − θ2 − t1 u 1 + θ1 ) , 2

(50) (51) (52)

123

752

I22

T. Fukushima

√   15 3t2 − t23 − 3t1 + t13 . = 6



(53)

  1 u2 1 3u 2 1 + + m+2 2 m+4 4 m+6  5u 2 1 (2 j − 1)u 2 + + ··· + 6 m+8 2j    1 + ··· ··· . × m + 2j + 2

qm (u) = u 2

These are obtained analytically by the direct integration of corresponding pnm , the explicit expressions of which are given as √   √ √ 15 1−t 2 . p00 = 1, p10 = 3 t, p11 = 3 u, p22 = 2 (54) A.4 Backward sectorial recursion Except for the equatorial region, the forward recursion of the sectorial integral (Eq. 47) may face a loss of significant digits (Paul 1978). In that case, we compute them by the backward recursion decreasing degree and order (Gerstl 1980): Imm = i m∗ Im+2,m+2 − jm∗ Jm+1,m , (m ≥ 1)

(55)

where i m∗



jm∗ ≡

1 i m+2

= 2(m + 3)

m+1 , (56) (m + 2)(2m + 3)(2m + 5)

jm+2 1 , = √ i m+2 (m + 2) 2m + 1

m , m+1

(58)

A.5 Series expansion In conducting the backward recursion, we need their starting values: a pair of the integrals with large consecutive degree and order, I M M and I M−1,M−1 . They are directly evaluated by the value of fnALF and an auxiliary function at two endpoints (Gerstl 1980, Eq.(25)) as Imm = −qm (u 2 ) pmm (t2 ) + qm (u 1 ) pmm (t1 ) , (59)

where qm is already introduced in Eq. (33). Its computation is efficiently done by Horner’s method (Gerstl 1980, Eq. (26)):

123

A.6 Rewriting by Gleason (1985) Gleason (1985) presented a slightly different, but essentially the same, recursion formulas of the sectorial integrals. Actually, Eqs. (47) and (55) containing Jnm are expressed as Eqs. (4.3) and (4.23) of Gleason (1985): Imm = i m Im−2,m−2 + km K mm , (m ≥ 2) Imm =

i m∗ Im+2,m+2

∗ − km K m+2,m+2 ,

(m ≥ 0)

(61) (62)

where

and choose the forward recursion otherwise.

(m = M, M − 1)

When θ is small, and therefore u is small, the series expansion of qm converges rapidly. For example, when θ < 1◦ , the first four terms are enough to provide the integral value with the relative precision of 15 digits or more. Note that the series expansion is effective even when θ is as large as 5◦ since the relative error of the expansion up to u 14 is less than the double precision machine epsilon,  ≡ 2−53 ≈ 1.11 × 10−16 .

(57)

are another pair of numerical coefficients depending on m only. The above formula is a simple rewriting of the forward formula (Eq. 47). Based on the discussion on the growth factor of errors induced by recursion, Gerstl (1980, Eq. (13)) obtained a rule to switch the two recursions: namely to select the backward recursion if u 22