diff --git a/README.md b/README.md index c6aec7710a409c376389ea457c7efa9175708754..a065847f1d02ab6f160aecc47802ec3a7fab66d9 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,17 @@ The compilation process creates the following results difference between two successive terms at which the series expansion (6) is truncated. - * integer LiInf = 1000 + * real(kind=prec) :: Lidel = 1e-15 + + difference $|\delta_i|$ between two successive terms at which the + series expansion for + + math + {\rm Li}_n(x) = \sum_{i=1}^\infty \frac{x^i}{i^n} + = \sum_{i=1}^\infty \delta_i +  + is truncated. - number of terms in the expansion of classical polylogarithms. * real(kind=prec) :: hCircle = 1.1 diff --git a/checks/test.f90 b/checks/test.f90 index d5ea34b87fdd84744217bd5d3030023ade95135d..0a8a9b9be4ae25c63a382352892d91d70ba70d7e 100644 --- a/checks/test.f90 +++ b/checks/test.f90 @@ -456,6 +456,14 @@ CONTAINS call test_one_flat( (/ (0._prec,0.), (1._prec,0.), (0.1_prec,-0.1_prec), (-1.3_prec,10.2_prec), (0.4_prec,0._prec) /) , ref, 'F.19') + ref = (0.6492441149301267712849185177612894261440132_prec,2.76692869057070821067245201199781913943_prec) + call iprint(' testing GPL G.1 ...',-1) + res = G([ toinum( (-1641._prec,4682._prec)/5000. ),& + toinum( (-1187._prec,4827._prec)/5000. ),& + toinum( 1069._prec/5000., +1_1 ), toinum( 787._prec / 5000., -1_1)], toinum(1._prec) ) + call check(res,ref, ttol=5.e-9_prec) + + end subroutine do_GPL_tests diff --git a/src/globals.f90 b/src/globals.f90 index 0100627ae4a4d135e6c1c667c3aa79e4dbc06920..b4b571ac43e97137e3d50c80c6c8ecd2b352a132 100644 --- a/src/globals.f90 +++ b/src/globals.f90 @@ -16,7 +16,7 @@ MODULE globals ! The following parameters control the accuracy of the evaluation real(kind=prec), protected :: MPLdelta = zero ! if the MPL sum changes less then del it is truncated. - integer, protected :: PolylogInfinity = 1000 ! expansion order for Polylogs + real(kind=prec), protected :: Lidelta = zero ! like MPLdelta but for polylogs real(kind=prec), protected :: HoelderCircle = 1.1_prec ! when to apply Hoelder convolution? integer, parameter :: PolyLogCacheSize(2) = (/ 5, 100 /) ! = (/ mmax, n /). At most n polylogs with weight mmax will be cached @@ -46,11 +46,10 @@ CONTAINS END SUBROUTINE parse_cmd_args #endif - SUBROUTINE SET_OPTIONS(mpldel, liinf, hcircle) - real(kind=prec), optional :: hcircle, mpldel - integer, optional :: liinf + SUBROUTINE SET_OPTIONS(mpldel, lidel, hcircle) + real(kind=prec), optional :: hcircle, mpldel, lidel if (present(MPLdel)) MPLdelta = mpldel - if (present(liinf)) PolyLogInfinity = liinf + if (present( Lidel)) LiDelta = lidel if (present(hcircle)) HoelderCircle = hcircle END SUBROUTINE diff --git a/src/maths_functions.f90 b/src/maths_functions.f90 index 3ff3246078e833de9df599413ff338c644d17e58..92f9471a8fe8c0ec267fee16b12a30c1b06f12f6 100644 --- a/src/maths_functions.f90 +++ b/src/maths_functions.f90 @@ -31,14 +31,19 @@ CONTAINS FUNCTION naive_polylog(m,x) result(res) ! Computes the classical polylogarithm Li_m(x) using series representation up to order n integer :: m - complex(kind=prec) :: x, res + complex(kind=prec) :: x, res, del integer(kind=ikin) :: i res=0._prec - do i=1,PolylogInfinity + + i = 1 + del = 1._prec + do while (abs(del) > zero) if(i**m.lt.0) return ! roll over if(abs(x**i).lt.1.e-250_prec) return - res = res+x**i/i**m - enddo + del = x**i/i**m + res = res+del + i = i+1 + end do END FUNCTION naive_polylog FUNCTION Li2(x)