22
1 From the Phenomenology of Chemical Reactions …
in which x 1 = a and n is sufficiently large to make V (x) negligible. One should
note that this final expression evaluates f at x i +
h
2
and thus misses the classical
turning point or singularity. The approximation used in the rightmost formulation in
(1.50) refers to the case where we consider the trapezoid formed by the value of the
function f (x) at the midpoint of the interval and constant step intervals (of size h =
x 2 − x 1 = ... = x i+1 − x i ). The trapezoidal method, per se, is also inadequate because
it considers an arbitrarily fixed upper limit (x sup ). The pseudocode is, however, as
follows:
PROGRAM CMT1D: CLOSED MIDPOINT TRAPEZOIDAL 1D
INPUT x_inf,x_sup, n
-----------------------------------x_inf is the lower limit of the integral
x_sup is the upper limit of the integral
n is the number of sampling points of the
function in the interval x_inf to x_sup
f is the integrand function to be defined a
f(r)=\sqrt(1-b*b/r/r-V(r)/E)/r/r in which E and b are given
within f that is defined as a function of those parameters
and of the potential energy function V(r)
-----------------------------------sum = 0
dx = (x_sup - x_inf) / n
x_point =x_inf + 0.5 * dx
i_point REPEAT FOR GOING FROM 1 TO n-1
sum = sum + f (x_point)
x_point = x_point + dx
END REPEAT i_point
val_integr = sum*dx
OUTPUT val_integr
Note in the pseudocode the choice of fixing the number of iterations using a repetitive
structure up to n steps rather than using a conditional iteration REPEAT UNTIL
structure in order to maintain control of the number of iterations is allowed. This
has the advantage of facilitating the distributing, if wished, of the calculations on
many processors. It should also be said that in the above pseudocode, all of the
data is known (and therefore input), i.e., values of the lower bound x in f , the upper
bound x sup , and the number of quadrature grid points n. Also in the integrand, it is
assumed that other parameters such as energy E, the impact parameter b, and the
value of the potential V (r ) are given by the f (r ). Obviously, in a more articulated
code, some of these values may be determined differently (e.g., a numerical search
of the most suitable value of a or the search for a particular value of b). This is
the case, in particular, when dealing with the study of the physical problem of the
collision of two bodies in which you can have all or part of these parameters varied
by the program. For example, the closed integral could be evaluated using a simple
Monte Carlo method. In that case, a finite area fully including a portion covered by
the integral needs to be defined (see Ref. [2]). The Monte Carlo method, in fact,
associates the estimate of the integral with the fraction of the finite area covered by
the values of the integrand for randomly sampled values of the variables. This point
1 From the Phenomenology of Chemical Reactions …
in which x 1 = a and n is sufficiently large to make V (x) negligible. One should
note that this final expression evaluates f at x i +
h
2
and thus misses the classical
turning point or singularity. The approximation used in the rightmost formulation in
(1.50) refers to the case where we consider the trapezoid formed by the value of the
function f (x) at the midpoint of the interval and constant step intervals (of size h =
x 2 − x 1 = ... = x i+1 − x i ). The trapezoidal method, per se, is also inadequate because
it considers an arbitrarily fixed upper limit (x sup ). The pseudocode is, however, as
follows:
PROGRAM CMT1D: CLOSED MIDPOINT TRAPEZOIDAL 1D
INPUT x_inf,x_sup, n
-----------------------------------x_inf is the lower limit of the integral
x_sup is the upper limit of the integral
n is the number of sampling points of the
function in the interval x_inf to x_sup
f is the integrand function to be defined a
f(r)=\sqrt(1-b*b/r/r-V(r)/E)/r/r in which E and b are given
within f that is defined as a function of those parameters
and of the potential energy function V(r)
-----------------------------------sum = 0
dx = (x_sup - x_inf) / n
x_point =x_inf + 0.5 * dx
i_point REPEAT FOR GOING FROM 1 TO n-1
sum = sum + f (x_point)
x_point = x_point + dx
END REPEAT i_point
val_integr = sum*dx
OUTPUT val_integr
Note in the pseudocode the choice of fixing the number of iterations using a repetitive
structure up to n steps rather than using a conditional iteration REPEAT UNTIL
structure in order to maintain control of the number of iterations is allowed. This
has the advantage of facilitating the distributing, if wished, of the calculations on
many processors. It should also be said that in the above pseudocode, all of the
data is known (and therefore input), i.e., values of the lower bound x in f , the upper
bound x sup , and the number of quadrature grid points n. Also in the integrand, it is
assumed that other parameters such as energy E, the impact parameter b, and the
value of the potential V (r ) are given by the f (r ). Obviously, in a more articulated
code, some of these values may be determined differently (e.g., a numerical search
of the most suitable value of a or the search for a particular value of b). This is
the case, in particular, when dealing with the study of the physical problem of the
collision of two bodies in which you can have all or part of these parameters varied
by the program. For example, the closed integral could be evaluated using a simple
Monte Carlo method. In that case, a finite area fully including a portion covered by
the integral needs to be defined (see Ref. [2]). The Monte Carlo method, in fact,
associates the estimate of the integral with the fraction of the finite area covered by
the values of the integrand for randomly sampled values of the variables. This point
