Integration of (exp(iz)/z) dz
by Reinaldo Baretti Machín
www.geocities.com/serienumerica
[email protected]
real(aint),aimag(aint)= -0.00621543964, 6.28352404
c complex integration
complex z , aint, sum ,f ,imag ,z1,z2 ,dz
f(z) = (1./z)*exp(imag*z)
imag=cmplx(0.,1.)
pi=2.*asin(1.)
r=10.
thetai =0.
thetaf=2.*pi
sum=cmplx(0.,0.)
nstep=3000
dtheta=(thetaf-thetai)/float(nstep)
do 10 i=1, nstep
theta=thetai+float(i)*dtheta
z1=cmplx(r*cos(theta), r*sin(theta))
z2=cmplx(r*cos(theta-dtheta), r*sin(theta-dtheta))
dz=imag*r*exp(imag*theta)*dtheta
sum=sum + (dz/2.)*(f(z1) + f(z2))
10 continue
aint=sum
print*,'real(aint), aimag(aint)=',real(aint) , aimag(aint)
stop
end