C NCLFORTSTART subroutine ftslow(npts,r, kmax,a0,a,b) implicit none integer npts, kmax real r(npts) real a(kmax),b(kmax), a0 C NCLEND integer n, k real pi, arg, coef a0 = 0.0 do n=1,npts a0 = a0+r(n) end do a0 = a0/npts ! average pi = 4.0*atan(1.0) arg = (2.0/npts)*pi do k=1,kmax a(k) = 0.0 b(k) = 0.0 do n=1,npts coef = (2.0/npts)*r(n) a(k) = a(k) + coef*cos(k*(n-1)*arg) b(k) = b(k) + coef*sin(k*(n-1)*arg) end do end do if (mod(npts,2).eq.0) then a(kmax) = a(kmax)/2.0 b(kmax) = 0.0 ! numerical end if return end