Utility module containing the routines to perform the integration of functions.
More...
|
subroutine, public | integrate (func, ss) |
| Routine to compute integrals of function from O to #maxint. More...
|
|
subroutine | qromb (func, a, b, ss) |
| Romberg integration routine. More...
|
|
subroutine | qromo (func, a, b, ss, choose) |
| Romberg integration routine on an open interval. More...
|
|
subroutine | polint (xa, ya, n, x, y, dy) |
| Polynomial interpolation routine. More...
|
|
subroutine | trapzd (func, a, b, s, n) |
| Trapezoidal rule integration routine. More...
|
|
subroutine | midpnt (func, a, b, s, n) |
| Midpoint rule integration routine. More...
|
|
subroutine | midexp (funk, aa, bb, s, n) |
| Midpoint routine for bb infinite with funk decreasing infinitely rapidly at infinity. More...
|
|
Utility module containing the routines to perform the integration of functions.
- Copyright
- 2018 Jonathan Demaeyer. See LICENSE.txt for license information.
subroutine, public int_comp::integrate |
( |
external |
func, |
|
|
real(kind=8) |
ss |
|
) |
| |
Routine to compute integrals of function from O to #maxint.
- Parameters
-
func | function to integrate |
ss | result of the integration |
Definition at line 30 of file int_comp.f90.
30 REAL(KIND=8) :: ss,func,b
34 CALL qromb(func,0.d0,b,ss)
subroutine int_comp::midexp |
( |
external |
funk, |
|
|
real(kind=8) |
aa, |
|
|
real(kind=8) |
bb, |
|
|
real(kind=8) |
s, |
|
|
integer |
n |
|
) |
| |
|
private |
Midpoint routine for bb infinite with funk decreasing infinitely rapidly at infinity.
- Parameters
-
funk | function to integrate |
aa | lower limit of the integral |
bb | higher limit of the integral |
s | result of the integration |
n | higher stage of the rule to be computed |
Definition at line 200 of file int_comp.f90.
201 REAL(KIND=8) :: aa,bb,s,funk
204 REAL(KIND=8) :: ddel,del,sum,tnm,x,func,a,b
205 func(x)=funk(-log(x))/x
209 s=(b-a)*func(0.5*(a+b))
223 s=(s+(b-a)*sum/tnm)/3.
subroutine int_comp::midpnt |
( |
external |
func, |
|
|
real(kind=8) |
a, |
|
|
real(kind=8) |
b, |
|
|
real(kind=8) |
s, |
|
|
integer |
n |
|
) |
| |
|
private |
Midpoint rule integration routine.
- Parameters
-
func | function to integrate |
a | lower limit of the integral |
b | higher limit of the integral |
s | result of the integration |
n | higher stage of the rule to be computed |
Definition at line 167 of file int_comp.f90.
168 REAL(KIND=8) :: a,b,s,func
171 REAL(KIND=8) :: ddel,del,sum,tnm,x
173 s=(b-a)*func(0.5*(a+b))
187 s=(s+(b-a)*sum/tnm)/3.
subroutine int_comp::polint |
( |
real(kind=8), dimension(n) |
xa, |
|
|
real(kind=8), dimension(n) |
ya, |
|
|
integer |
n, |
|
|
real(kind=8) |
x, |
|
|
real(kind=8) |
y, |
|
|
real(kind=8) |
dy |
|
) |
| |
|
private |
Polynomial interpolation routine.
Definition at line 91 of file int_comp.f90.
92 REAL(KIND=8) :: dy,x,y,xa(n),ya(n)
95 REAL(KIND=8) :: den,dif,dift,ho,hp,w,c(nmax),d(nmax)
100 if (dift.lt.dif)
then 115 if(den.eq.0.)stop
'failure in polint'
subroutine int_comp::qromb |
( |
external |
func, |
|
|
real(kind=8) |
a, |
|
|
real(kind=8) |
b, |
|
|
real(kind=8) |
ss |
|
) |
| |
|
private |
Romberg integration routine.
- Parameters
-
func | function to integrate |
a | lower limit of the integral |
b | higher limit of the integral |
func | function to integrate |
ss | result of the integration |
Definition at line 44 of file int_comp.f90.
44 INTEGER :: jmax,jmaxp,k,km
45 REAL(KIND=8) :: a,b,func,ss,eps
47 parameter(eps=1.d-6, jmax=20, jmaxp=jmax+1, k=5, km=k-1)
49 REAL(KIND=8) :: dss,h(jmaxp),s(jmaxp)
52 CALL trapzd(func,a,b,s(j),j)
54 CALL polint(h(j-km),s(j-km),k,0.d0,ss,dss)
55 IF (abs(dss).le.eps*abs(ss))
RETURN 60 stop
'too many steps in qromb'
subroutine int_comp::qromo |
( |
external |
func, |
|
|
real(kind=8) |
a, |
|
|
real(kind=8) |
b, |
|
|
real(kind=8) |
ss, |
|
|
external |
choose |
|
) |
| |
|
private |
Romberg integration routine on an open interval.
- Parameters
-
a | lower limit of the integral |
b | higher limit of the integral |
func | function to integrate |
ss | result of the integration |
chose | routine to perform the integration |
Definition at line 70 of file int_comp.f90.
70 INTEGER :: jmax,jmaxp,k,km
71 REAL(KIND=8) :: a,b,func,ss,eps
73 parameter(eps=1.e-6, jmax=14, jmaxp=jmax+1, k=5, km=k-1)
75 REAL(KIND=8) :: dss,h(jmaxp),s(jmaxp)
78 CALL choose(func,a,b,s(j),j)
80 call polint(h(j-km),s(j-km),k,0.d0,ss,dss)
81 if (abs(dss).le.eps*abs(ss))
return 86 stop
'too many steps in qromo'
subroutine int_comp::trapzd |
( |
external |
func, |
|
|
real(kind=8) |
a, |
|
|
real(kind=8) |
b, |
|
|
real(kind=8) |
s, |
|
|
integer |
n |
|
) |
| |
|
private |
Trapezoidal rule integration routine.
- Parameters
-
func | function to integrate |
a | lower limit of the integral |
b | higher limit of the integral |
s | result of the integration |
n | higher stage of the rule to be computed |
Definition at line 138 of file int_comp.f90.
139 REAL(KIND=8) :: a,b,s,func
142 REAL(KIND=8) :: del,sum,tnm,x
144 s=0.5*(b-a)*(func(a)+func(b))
155 s=0.5*(s+(b-a)*sum/tnm)