- #1
phynewb
- 13
- 0
Hi guys,
I just wrote a simple code for delta function and print it out. Here it is.
It turns out to be quite wrong by using function del. I cannot figure out what's wrong with the function because the expression is the same. Can you tell me how to debug the function? Thanks!
I just wrote a simple code for delta function and print it out. Here it is.
Code:
program main
implicit none
integer i
real*8 del
real*8,parameter:: ep=1D-2
real*8,parameter:: pi=3.1415926
do i=-10,10,1
write(*,*) i,del(real(i)) ! use function
enddo
do i=-10,10,1
write(*,*) i,(1.0/pi*ep/((real(i))**2+ep**2)) ! no use function
enddo
end
function del(x)
implicit none
real*8 del
real*8 x
real*8,parameter::ep=1D-2
real*8,parameter:: pi=3.1415926
del=(1.0/pi*ep/(x**2+ep**2))
return
end