program propagation implicit none real odd pi sum integer open unit 20

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
program propagation
implicit none
real :: x,v,t, odd, pi,f,sum
integer :: i,j,k
open(unit=20, file='p1.txt',status='unknown')
pi=4.*atan(1.)
do j=0,200
x=j/10.
sum=0.0
do i=1,5
odd=2*i-1
sum= sum+(4./pi)*(1.+(1./odd)*sin(odd*x))
end do
write(20,*) i, x, sum
print*, i, x, sum
end do
end program