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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
program rien
integer i
double precision h
h=1.d-2
open(1,file='gamma8.dat',status='unknown')
do i=-100,100
write(1,*) i*h, gammasuppcompact(i*h,100,500)
end do
close(1)
end
function gammasuppcompact(x,n,m)
integer n,m,i
double precision f1,f2,h,pi,x,gammasuppcompact
pi=4.d0*datan(1.d0)
f1=0.d0
f2=0.d0
h=2.d0/(dble(n)*dble(m))
do i=1,m-1
f1=f1+gamma(x+1.d0/dble(n)-i*h)*dble(n)*
& (dcos((n*pi/2.d0)*(-1.d0/dble(n)+i*h)))**2
enddo
do i=0,m-1
f2=f2+gamma(x+1.d0/dble(n)-i*h-h/2.d0)*n*
& (dcos((dble(n)*pi/2.d0)*(-1.d0/dble(n)+i*h+h/2.d0)))**2
enddo
gammasuppcompact=(h/6.d0)*(2.d0*f1+4.d0*f2)
return
end
function gamma(x)
double precision x,gamma
gamma=1.d0+(1.d0+signe(-x**2/4.d-2+1.d0))/2.d0
return
end
function signe(x)
double precision x,signe
if(x.ge.0.d0) then
signe=1.d0
else
signe=-1.d0
end if
return
end |
Partager