Skip to main content
Log in

A fast and accurate DE-formula algorithm to evaluate Ambartsumian-Chandrarasekhar \(H\)-function for isotropic scattering

  • Research
  • Published:
Astrophysics and Space Science Aims and scope Submit manuscript

Abstract

In the present work, a compact, fast, and yet accurate algorithm is developed to calculate the numerical values of the Ambartsumian-Chandrasekhar’s \(H\)-function for isotropic scattering and its moments on the basis of the double exponential (DE) formula of Takahashi and Mori (RIMS, Kyoto Univ., 9:721, 1974). The main improvement made in the new method is an elimination of the iterative procedure for automatic adjustment of the step-size of integrations carried out with the DE-formula. Instead, a set of optimal values for the upper limit of integration \(T_{\text{max}}\) and the number of division points \(N_{\text{T}}\) to specify the step-size of the quadrature is predetermined for calculations of the \(H\)-function with a 15-digit accuracy, and also another for the evaluations of the moments with an accuracy of 14-digits or better. FORTRAN90 subroutines HFISCA for the \(H\)-function and HFMOMENT for the moments of arbitrary degrees are subsequently constructed (their source codes and a driver together with a sample set of output are shown in Appendix of this paper). Tables of sample calculations of the \(H\)-function and its moments of degree −1 through 6 carried out by these programs are also presented. The routines HFISCA and HFMOMENT should prove useful not only in astrophysical applications but also in other disciplines of science such as the electron transports in condensed matter and remote-sensing data analyses. A request for a copy of the Fortran 90 source code of the program can be made by writing to kawabata@rs.kagu.tus.ac.jp.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6

Similar content being viewed by others

Data Availability

No particular kinds of data nor materials are employed in the present work.

Code Availability

Code availability: The FORTRAN90 source codes used to generate the numerical results presented in the present work are shown in Appendix of this manuscript. The source codes in text-form are also available from the author by writing to kawabata@rs.kagu.tus.ac.jp.

Notes

  1. The 64-bit Gfortran90 compiler employed in the present work, for instance, gives \(1-(x/\tan x)=0\) for \(x=1.698243652461743\times 10^{-8}\), while the true value is \(9.613438343755337990\times 10^{-17}\).

  2. Domain B will be defined shortly for Table 2, and Domain C will be introduced in Sect. 4.

References

Download references

Acknowledgements

The author is grateful to the anonymous referee for his or her valuable comments and suggestions to improve the original manuscript of this paper.

Funding

No funding was received for conducting this study.

Author information

Authors and Affiliations

Authors

Contributions

Kiyoshi Kawabata contributed to the study conception and design, the data collection and analyses, writing programs and numerical calculations, and preparations of Figs. 1-6 and Tables 1-4. Furthermore, Kiyoshi Kawabata solely wrote and reviewed the first draft and subsequent manuscripts including the final one.

Corresponding author

Correspondence to Kiyoshi Kawabata.

Ethics declarations

Competing interests

The authors declare no competing interests.

Ethics approval

The submitted work is original and has not been published anywhere else in any form or language.

Consent to participate

Not applicable because of the single authorship.

Consent for publication

The present author consents to give the publisher irrevocable and exclusive authorization to collect any sums or considerations for copying or reproduction payable by third parties.

Permission for a quotation from unpublished material

Not applicable due to the fact that no such quotation is made from any unpublished material.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendix: a program to calculate \(H(\varpi _{0}, \mu )\) and its moments

Appendix: a program to calculate \(H(\varpi _{0}, \mu )\) and its moments

Given below is a Fortran90 program set consisted of a main program MAIN and three function subprograms CALRSPI0, HFISCA, and HFMOMENTS.

The function subprogram HFISCA enables us to evaluate, by means of the double-exponential (DE) formula developed by Takahashi and Mori (1974), the numerical values of the Ambartsumian-Chandrasekhar’s \(H\)-function \(H(\varpi _{0}, \mu )\) for isotropic scattering, with a 15-digit accuracy, for a given set of values for \(\varpi _{0}\), \(1-\varpi _{0}\), and \(\mu \). The value of \(1-\varpi _{0}\) may better be calculated as shown in MAIN by using the function subprogram CALRSPI0, which should help minimize the effect of the loss of significant digits in the case the value of \(\varpi _{0}\) is close to unity.

The function subprogram HFMOMENT produces again by employing the DE-formula the numerical values of the \(n\)-th degree moment of the \(H\)-function (\(n\ge -1\)) defined by Eqs. (28a)-(28d) for given values of \(\varpi _{0}\), \(1-\varpi _{0}\), and \(n\). It should be reminded that, for \(n\ge 1\), we use the integral expression Eq. (28b) to improve numerical accuracy of integration:

$$ \alpha _{n}(\varpi _{0})=\frac{1}{n}\int _{0}^{1}\!\! \! H(\varpi _{0}, s^{1/n}) s^{1/n}ds \quad (n\ge 1), $$
(32)

although the usual forms of defining equations are employed for \(n=-1\) and \(n=0\):

$$ \alpha _{-1}^{\ast}(\varpi _{0})=\int _{0}^{1}\!\!\! \left [H(\varpi _{0}, \mu ^{\prime})-1\right ]\frac{1}{\mu ^{\prime}} d \mu ^{\prime}=2\ln H(\varpi _{0}, 1), $$
(33)
$$ \alpha _{0}(\varpi _{0})=\int _{0}^{1}\!\!\!H(\varpi _{0}, \mu ^{\prime}) d\mu ^{\prime}, $$
(34)

(Ivanov 1973: van de Hulst 1980). The source code of the program is as shown below:

PROGRAM MAIN; ! driver for routines HFISCA and HFMOMENTS IMPLICIT REAL*8 (A-H,O-Z) PARAMETER(NPI0=6, NAMU=6, NALPHA=4) REAL*8 PI0S(NPI0), RSPI0S(NPI0), AMUS(NAMU),HFS(NAMU,NPI0),ALPHAS(-1:NALPHA) CHARACTER*6 CHAR; DATA CHAR/'Alpha_'/ !!!!EXTERNAL HFISCA DATA PI0S/0.1D0, 0.3D0, 0.5D0, 0.7D0, 0.9D0, 1.D0/ DATA AMUS/0.1D0, 0.3D0, 0.5D0, 0.7D0, 0.9D0, 1.D0/ ! PI0=the single scattering albedo; RSPI0=1-PI0; AMU=cos(zenith angle)   WRITE(*,*) '(1) Sample Numerical Calculations of the H-function'   WRITE(*,'(1X,A,20(7X,F3.1,12X))') 'PI0 RSPI0/ AMU=',(AMUS(J),J=1,NAMU)   DO 100 I=1,NPI0      PI0=PI0S(I)      RSPI0=CALRSPI0(PI0)      RSPI0S(I)=RSPI0    DO J=1,NAMU      HFS(J,I)=HFISCA(PI0,RSPI0,AMUS(J))    END DO      WRITE(*,'(1X,F3.1,2X,F3.1,7X,10(F17.15,5X))') PI0,RSPI0,(HFS(J,I),J=1,NAMU) 100 END DO    WRITE(*,'(/1X,A)') '(2)The Moments of the H-function'    WRITE(*,'(1X,''PI0 RSPI0'',6X,6(4X,A,I2,10X))') (CHAR,J,J=-1,NALPHA)   DO I=1,NPI0      PI0=PI0S(I)      RSPI0=CALRSPI0(PI0)     DO N=-1,NALPHA       ALPHAS(N)=HFMOMENT(PI0,RSPI0,N)     END DO     WRITE(*,'(1X,F3.1,2X,F3.1,7X,10(F17.15,5X))') PI0,RSPI0,(ALPHAS(N),N=-1,NALPHA)   END DO    STOP    END DOUBLE PRECISION FUNCTION CALRSPI0(PI0) ! << Calculates 1-PI0 >> CHARACTER*20 SINTER; REAL*8 PI0       IF(PI0<0.99D0) THEN            CALRSPI0=1.D0-PI0       ELSE          WRITE(SINTER,'(F18.15)') 1.D0-PI0          READ(SINTER, '(F18.15)') CALRSPI0       END IF       RETURN       END FUNCTION HFISCA(PI0,RSPI0,AMU);  IMPLICIT REAL*8 (A-H,O-Z) !  <<Ambartsumian-Chandrasekhar H-Function for Isotropic Scattering>> ! [PI0=the single scattering albedo,RSPI0=1.D0-PI0,AMU=cos(zenith angle)] SAVE XIS,TANXQS,UIS,VIS,WIS,IFIRST PARAMETER(PI=3.141592653589793D0, PIHF=PI/2.D0, XTRANS=1.238798627279953D-1) PARAMETER(NT=111,TMAX=3.2215D0,H=TMAX/NT, A=0.D0, B=PIHF,BMA2=(B-A)/2.D0,COEF=PI*H/8.D0) REAL*8 WIS(0:NT),XIS(-NT:NT),TANXQS(-NT:NT),UIS(-NT:NT),VIS(-NT:NT) INTEGER :: IFIRST=0 !====================================================================================  FFN(TANXSQ,U,V)=DLOG(RSPI0+PI0*V)*U/(1.D0+AMUSQ*TANXSQ)  VFN(S)=S*(3.3333333333333333D-1+S*(2.2222222222222223D-2+S*(2.1164021164021165D-3    & &      +S*(2.1164021164021165D-4+S*(2.1377799155576935D-5+2.1644042808063972D-6*S))))) !==================================================================================== IF(IFIRST==0) THEN    ! === The Section for the DE-formula preparation ===   DO  I=NT,0,-1     T=H*I; SINHT=DSINH(T); SINHPHT=PIHF*SINHT; COSHPHT=DCOSH(SINHPHT)     WIS(I)=DCOSH(T)/COSHPHT**2; AIPRP=BMA2*DEXP(-SINHPHT)/COSHPHT     X=B-AIPRP; XIS(I)=X; TANX=DTAN(X); TANXQS(I)=TANX*TANX; UIS(I)=1.D0+TANXQS(I)     VIS(I)=1.D0-X/TANX J=-I; X=AIPRP; XIS(J)=X; TANX=DTAN(X); TANXQS(J)=TANX*TANX; UIS(J)=1.D0+TANXQS(J)       IF(X<XTRANS)THEN; VIS(J)=VFN(X*X); ELSE; VIS(J)=1.D0-X/TANX; ENDIF     END DO;  IFIRST=1   END IF              ! End of the DE-formula preparation ! ---<<  Calculations of H(PI0,AMU)  >>---   IF(PI0==0.D0.OR.AMU==0.D0) THEN;  ! == Return H(0,AMU)=1 or H(PI0,0)=1     HFISCA=1.D0; RETURN ;   ELSE                              !  Evaluate H(PI0, AMU) for PI0*AMU>0     AMUSQ=AMU*AMU     SUM=(FFN(TANXQS(NT),UIS(NT),VIS(NT))+FFN(TANXQS(-NT),UIS(-NT),VIS(-NT)))*WIS(NT)     DO I=NT-1,1,-1       J=-I       SUM=SUM+(FFN(TANXQS(I),UIS(I),VIS(I))+FFN(TANXQS(J),UIS(J),VIS(J)))*WIS(I)     END DO       HFISCA=DEXP(-AMU*COEF*(SUM+FFN(TANXQS(0),UIS(0),VIS(0))))   END IF RETURN END FUNCTION HFMOMENT(PI0,RSPI0,N);  IMPLICIT REAL*8 (A-H,O-Z) !  <<The N-th degree moment HFMOMENT of the H-function for a given albedo value  PI0>> SAVE XIS, WIS, IFIRST;  PARAMETER(PI=3.141592653589793D0,PIHF=PI/2.D0) PARAMETER(NT=109,TMAX=3.3834D0,H=TMAX/NT,A=0.D0, B=1.D0,BMA2=(B-A)/2.D0,COEF=H*BMA2*PIHF) REAL*8 WIS(0:NT), XIS(-NT: NT); INTEGER:: IFIRST=0 IF(N.EQ.-1) THEN;  HFMOMENT=2.D0*DLOG(HFISCA(PI0,RSPI0,1.D0)); RETURN; END IF IF(IFIRST.EQ.0) THEN       ! *** Section for the DE-formula preparation ***   DO  I=NT,0,-1     T=H*I; SINHT=DSINH(T); SINHPHT=PIHF*SINHT; COSHPHT=DCOSH(SINHPHT);     WIS(I)=DCOSH(T)/COSHPHT**2;     AIPRP=BMA2*DEXP(-SINHPHT)/COSHPHT;  XIS(I)=B-AIPRP; XIS(-I)=AIPRP;   END DO ;   IFIRST=1 END IF                     ! *** End of the DE-formula preparation      *** ! ===<<  Calculations of the H-function moments of the degree -1 through n  >>===    HFMOMENT=0.D0 DO 10 I=NT,1,-1    XI=XIS(I); XJ=XIS(-I); WI=WIS(I)    SELECT CASE(N)      CASE(0) ; HFMOMENT=HFMOMENT+(HFISCA(PI0,RSPI0,XI)+HFISCA(PI0,RSPI0,XJ))*WI      CASE DEFAULT         AN=1.D0/N; AMUI=XI**AN; AMUJ=XJ**AN         HFMOMENT=HFMOMENT+(AMUI*HFISCA(PI0,RSPI0,AMUI)+AMUJ*HFISCA(PI0,RSPI0,AMUJ))*WI    END SELECT 10 END DO    X0=XIS(0)    SELECT CASE(N)      CASE(0) ;        HFMOMENT=COEF*(HFMOMENT+HFISCA(PI0,RSPI0,X0))      CASE DEFAULT         AMU0=X0**AN;  HFMOMENT=COEF*(HFMOMENT+AMU0*HFISCA(PI0,RSPI0,AMU0))/N    END SELECT RETURN END

Our results are:

 (1) Sample Numerical Calculations of the H-function  PI0 RSPI0/ AMU=    0.1        0.3        0.5        0.7        0.9        1.0  0.1  0.9        1.0123781  1.0230056  1.0289223  1.0328465  1.0356742  1.0368156  0.3  0.7        1.0398749  1.0763650  1.0975591  1.1119712  1.1225365  1.1268444  0.5  0.5        1.0723688  1.1438895  1.1877351  1.2185599  1.2416937  1.2512596  0.7  0.3        1.1130318  1.2364193  1.3179451  1.3781356  1.4249566  1.4447461  0.9  0.1        1.1721431  1.3913503  1.5560338  1.6893476  1.8007874  1.8500985  1.0  0.0        1.2473504  1.6425223  2.0127788  2.3739749  2.7305877  2.9078105  (2)The Moments of the H-function  PI0 RSPI0       Alpha_-1   Alpha_ 0   Alpha_ 1   Alpha_ 2   Alpha_ 3   Alpha_ 4  0.1  0.9        0.0723082  1.0263340  0.5156106  0.3443583  0.2585057  0.2069185  0.3  0.7        0.2388423  1.0889332  0.5531211  0.3709842  0.2791061  0.2237053  0.5  0.5        0.4483014  1.1715729  0.6034843  0.4070236  0.3071195  0.2466008  0.7  0.3        0.7358672  1.2922213  0.6786678  0.4614199  0.3496751  0.2815281  0.9  0.1        1.2304778  1.5194939  0.8253157  0.5694486  0.4351136  0.3521620  1.0  0.0        2.1348008  2.0000000  1.1547005  0.8203525  0.6378183  0.5222273

It should be noted that actual output from the program MAIN shown above produces the values of \(H\)-function as well as those of its moments \(\alpha ^{\ast}_{-1}(\varpi _{0})\) and \(\alpha _{n}(\varpi _{0})\ \ (n=0, 1, \ldots , 4)\) to the 15-th decimal place, although the results displayed here are rounded to the 7-th decimal place. The header “Alpha\(\_-1\)” should be interpreted as being “\(\alpha ^{\ast}_{-1}\)”.

Rights and permissions

Springer Nature or its licensor holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Kawabata, K. A fast and accurate DE-formula algorithm to evaluate Ambartsumian-Chandrarasekhar \(H\)-function for isotropic scattering. Astrophys Space Sci 367, 102 (2022). https://doi.org/10.1007/s10509-022-04138-2

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s10509-022-04138-2

Keywords

Navigation