File: stheta_sq.f90

package info (click to toggle)
elkcode 2.3.22-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,972 kB
  • ctags: 3,389
  • sloc: f90: 40,548; fortran: 20,560; perl: 965; makefile: 320; sh: 287; ansic: 67; python: 41
file content (39 lines) | stat: -rw-r--r-- 894 bytes parent folder | download | duplicates (4)
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

! Copyright (C) 2008 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
! This file is distributed under the terms of the GNU Lesser General Public
! License. See the file COPYING for license details.

!BOP
! !ROUTINE: stheta_sq
! !INTERFACE:
real(8) function stheta_sq(x)
! !INPUT/OUTPUT PARAMETERS:
!   x : real argument (in,real)
! !DESCRIPTION:
!   Returns the Heaviside step function corresponding to the square-wave pulse
!   approximation to the Dirac delta function
!   $$ \tilde\Theta(x)=\left\{\begin{array}{ll}
!    0 & \quad x \le -1/2 \\
!    x+1/2 & \quad -1/2 < x < 1/2 \\
!    1 & \quad x\ge 1 \end{array}\right. $$
!
! !REVISION HISTORY:
!   Created July 2008 (JKD)
!EOP
!BOC
implicit none
! arguments
real(8), intent(in) :: x
if (x.le.-0.5d0) then
  stheta_sq=0.d0
  return
end if
if (x.lt.0.5d0) then
  stheta_sq=x+0.5d0
else
  stheta_sq=1.d0
end if
return
end function
!EOC