program array
implicit none
integer(8)::i,j
real(8):: dt
real(8):: RR(1317,26123),t(26123),IR(1317,26123),f(8,26123)
complex(8):: sum(1317),factor(1317),fnl(1317)
complex(8),dimension(:,:),allocatable::R
allocate( R(1317,26123))
j=0.
sum(j)=0.
factor(j)=0.
Open(0 , File ='/Users/clyrionchen/Desktop/result1-4.log')
Open(11 , File ='/Users/clyrionchen/Desktop/ReR' )
Open(22 , File ='/Users/clyrionchen/Desktop/ImR' )
do i=1,26123
read(11,*) RR(:,i)
read(0,*) f(:,i)
read(22,*) IR(:,i)
end do
t(:)=f(1,:)
r(:,:)=cmplx(Rr(:,:),IR(:,:),kind=16)
do j=1,1317
do i=2,26123
factor(j)=(r(j,i)+r(j,i-1))/2. *(t(i)-t(i-1))
sum(j)=sum(j)+factor(j)
end do
end do
do j=1,1317
write(*,*) sum(j)
end do
end program
“Rr” and “Dr” Form a complex number, and now we need to integrate the complex number, the trapezoidal integral I wrote myself (top base plus bottom base, divided by 2, times the time interval). There are 1317 groups of points, and each group needs to be integrated to get the result. But it turns out that the value of the integral doesn't match the result. Is it the parallel error, or is it the numerical integration error? How should I write this program? Thank you very much for your answer.