FORTRAN code for box function
c www.uprh.edu/rbaretti
c integral for the box function
c https://math.stackexchange.com/questions/375960/solving-an-
c integral-equation-using-the-fourier-transform
implicit real*8(a-h,o-z)
real*8 kernel1,kernel2, k
data nx,nk/30,2000/
kernel1(k,x)= (2.d0/pi)*(1.d0-k**2/6.d0)*dcos(k*x)
kernel2(k,x)= (2.d0/pi)*dsin(k)*dcos(k*x)/k
pi=2.d0*dasin(1.d0)
xi= -7.d0/pi
xf=-xi
ki=0.d0
kf=50.d0
dx=(xf-xi)/dfloat(nx)
dk=(kf-ki)/dfloat(nk)
do 10 ix=0,nx
x =xi+dx*dfloat(ix)
sum=0.d0
do 20 ik=1,nk
k=ki+dk*dfloat(ik)
if(ik.eq.1)sum=sum+(dk/2.d0)*(kernel1(k,x) + kernel1(k-dk,x))
if(ik.gt.1)sum=sum+(dk/2.d0)*(kernel2(k+dk,x)+ kernel2(k,x) )
20 continue
print 100 ,x,sum
10 continue
100 format('x,f(x)=',2(3x,e10.3))
stop
end
x,f(x)= -0.223E+01 -0.144E-01
x,f(x)= -0.208E+01 -0.187E-01
x,f(x)= -0.193E+01 -0.205E-01
x,f(x)= -0.178E+01 -0.160E-01
x,f(x)= -0.163E+01 -0.859E-02
x,f(x)= -0.149E+01 -0.824E-02
x,f(x)= -0.134E+01 -0.225E-01
x,f(x)= -0.119E+01 -0.464E-01
x,f(x)= -0.104E+01 -0.259E-01
x,f(x)= -0.891E+00 0.951E+00
x,f(x)= -0.743E+00 0.958E+00
x,f(x)= -0.594E+00 0.983E+00
x,f(x)= -0.446E+00 0.998E+00
x,f(x)= -0.297E+00 0.994E+00
x,f(x)= -0.149E+00 0.979E+00
x,f(x)= 0.833E-16 0.972E+00
x,f(x)= 0.149E+00 0.979E+00
x,f(x)= 0.297E+00 0.994E+00
x,f(x)= 0.446E+00 0.998E+00
x,f(x)= 0.594E+00 0.983E+00
x,f(x)= 0.743E+00 0.958E+00
x,f(x)= 0.891E+00 0.951E+00
x,f(x)= 0.104E+01 -0.259E-01
x,f(x)= 0.119E+01 -0.464E-01
x,f(x)= 0.134E+01 -0.225E-01
x,f(x)= 0.149E+01 -0.824E-02
x,f(x)= 0.163E+01 -0.859E-02
x,f(x)= 0.178E+01 -0.160E-01
x,f(x)= 0.193E+01 -0.205E-01
x,f(x)= 0.208E+01 -0.187E-01
x,f(x)= 0.223E+01 -0.144E-01