Commit cd14ec2a authored by ulrich_y's avatar ulrich_y

Dynamic loop in logz_polylog

parent dc1ee600
......@@ -154,10 +154,9 @@ CONTAINS
! R. E. Crandall, Note on fast polylogarithm computation,
! www.reed.edu/~crandall/papers/Polylog.pdf, January 2006.
! or http://functions.wolfram.com/10.08.06.0024.01
integer, parameter :: nmax = 40
real(kind=prec) :: fac, zetamn
complex(kind=prec), intent(in) :: z
complex(kind=prec) :: res, logz
complex(kind=prec) :: res, logz, del
integer, intent(in) :: n
integer m
......@@ -179,10 +178,14 @@ CONTAINS
res = res - 0.5_prec * logz**n / fac / n
! All remaining terms
do m=n+1,n+nmax-1,2
m = n + 1
del = 1._prec
do while (abs(del) > zero)
zetamn = (-1)**(m-n) * bernoullinumber(1+m-n) / (1+m-n)
fac = fac * m * (m-1)
res = res + zetamn / fac * logz**m
del = zetamn / fac * logz**m
res = res + del
m = m + 2
enddo
END FUNCTION logz_polylog
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment