c------------------------------------------------- c Author: Brian Martin c modified last: Nov.5, 2004. c------------------------------------------------- c------------------------------------------------- c a program to calculate the sum of c Bessel Functions. c The equation is: c V(x) = 2 *sum(n=-inf..inf)U(sqrt(x^2+(nw)^2)) c Where U(r) is defined by: c U(r) = const. * Ko(r) c Ko is the 0th order bessel function c------------------------------------------------- program test implicit none c------------------------------------------------- c Variable declarations c------------------------------------------------- c used for command line argument parsing integer iargc, i4arg real*8 r8arg real*8 calcv external calcv c this is the x in the equation real*8 x real*8 v c index variables integer n, range real*8 e, w c------------------------------------------------- c------------------------------------------------- c make sure there is at least one argument if (iargc() .lt. 1) go to 1000 c------------------------------------------------- c------------------------------------------------- c Argument Parsing c------------------------------------------------- range = i4arg(1,-1) * 10000 e = r8arg(2, 1.0d-6) w = r8arg(3, 1.0d0) do n = -1*range, range x = n / 1.0d4 call calcv(v,x,w,e) c output the sum write(*,*) x, v end do stop 1000 continue write(0,*) 'usage: test []' write(0,*) ' nmax is the max of n' write(0,*) ' e is tolerance parameter' write(0,*) ' default is 1.0d-6' stop end