Pathwise Differentiation of Worldline Path Integrals
Abstract
The worldline method is a powerful numerical path-integral framework for computing Casimir and Casimir–Polder energies. An important challenge arises when one desires derivatives of path-integral quantities—standard finite-difference techniques, for example, yield results of poor accuracy. In this work we present methods for computing derivatives of worldline-type path integrals of scalar fields to calculate forces, energy curvatures, and torques. In Casimir–Polder-type path integrals, which require derivatives with respect to the source point of the paths, the derivatives can be computed by a simple reweighting of the path integral. However, a partial-averaging technique is necessary to render the differentiated path integral computationally efficient. We also discuss the computation of Casimir forces, curvatures, and torques between macroscopic bodies. Here a different method is used, involving summing over the derivatives of all the intersections with a body; again, a different partial-averaging method makes the path integral efficient. To demonstrate the efficiency of the techniques, we give the results of numerical implementations of these worldline methods in atom–plane and plane–plane geometries. Being quite general, the methods here should apply to path integrals outside the worldline context (e.g., financial mathematics).
I Introduction
The Casimir effect is a fundamental consequence of quantum fields interacting with boundaries [1]. It typically arises as an attractive force between material bodies due to modifications of vacuum fluctuations by the presence of the bodies [2, 3]. An important experimental technique for measuring Casimir-type forces monitors the change in the frequency of a mechanical oscillator due to the presence of another dielectric body: such experiments are sensitive to the curvature of the Casimir energy. This technique has been applied, for example, to Casimir-force measurements in microelectromechanical systems [4], and also to Casimir–Polder measurements with Bose-Einstein condensates in a magnetic trap near a dielectric mirror [5]. Theoretical predictions of Casimir forces (and corresponding frequency shifts in experiments) require the computation of gradients of the Casimir energy. In general geometries, this requires a numerical approach.
The worldline path-integral method in particular is a promising framework for the numerical computation of Casimir energies [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]. It continues to be a useful method in various areas of quantum field theory [20, 21, 22, 23, 24]. In this method one generates an ensemble of closed stochastic paths and evaluates the Casimir energy as a functional average over the material properties along the paths. The worldline method has been thus far primarily applied in the case of scalar fields interacting with Dirichlet boundary conditions [7, 8, 9, 10, 11]. For example, this work has been applied to computing Casimir forces and torques for cylinder-plate, sphere-plate, and inclined-plate geometries [12, 14], as well as to computing the stress-energy tensor for parallel planes [16, 18]. More recently, the worldline method has been extended to incorporate the coupling of the electromagnetic field to magnetodielectric media [19]. In that reference, the electromagnetic worldline path integrals are only exact in symmetric geometries where the vector electromagnetic field splits into two uncoupled scalar fields.
In connecting the worldline method to experiments, where one is interested in forces and curvatures as numerical quantities, it is therefore important to consider the numerical differentiation of worldline path integrals. Additionally, the worldline path integral for the part of the Casimir–Polder potential corresponding to the transverse-magnetic (TM) polarization involves the second derivative of a worldline path integral [19]. Similarly, the calculation of the stress-energy tensor via worldline methods involves derivatives of worldline path integrals [25, 16, 18]. Due to the importance of estimating gradients of Monte Carlo path averages in other areas such as mathematical finance, there has already been a substantial effort towards developing general methods for differentiating path integrals [26, 27]. Since the methods in this paper apply quite generally, they may be applicable to such problems.
The most straightforward way to compute a numerical derivative is the finite-difference method. While finite-difference approximations are quite general and easy to implement, they have poor convergence properties for gradients of stochastic quantities [26, 27]. In computing a first derivative, for example, one needs to compare functional values of two slightly different paths, and then divide by a small parameter that characterizes the difference between them. In such averages over stochastic paths, the difference in the contributions of these paths may be large—in a worldline path integral, for example, one path may intersect a dielectric while its slightly shifted counterpart misses it, but these differences are precisely what determine the Casimir force. Thus, the finite-difference method can lead to a path average with a large sample variance, requiring extensive averaging—and thus excessive computing resources—to arrive at an accurate result. The problem is even worse for successive derivatives.
In this paper we present numerically efficient methods for computing gradients of worldline path integrals in two classes of problems. First, we consider derivatives of Casimir–Polder path integrals, where the derivatives are taken with respect to the source point of the paths. In this case, a reweighted path integral serves to compute the derivatives, but a partial-averaging technique is needed to avoid convergence problems in the limit of continuous-time paths. This method applies rather generally to numerical path integrals differentiated with respect to the source point. For example, it applies whenever the path functional is independent of the motion of the path in some neighborhood of the source point. It also applies if the path functional may be approximately averaged over some time interval around the source point.
In the second class of problems, we consider the calculation of Casimir forces, curvatures, and torques due to extended material bodies. A particularly relevant method is that of Weber and Gies, who computed forces in the sphere–plane and cylinder–plane geometries with Dirichlet boundary conditions [14]. In that work paths are shifted until they graze the planar surface, taking advantage of the freedom of the integral over . The force on the planar surface is then computed by integrating over the times when the path intersects the spherical or cylindrical surface. By contrast, we consider a generally valid method that sums over the derivative of an estimate of the path average or value between two successive points in the discrete path. Again, a partial-averaging method accelerates convergence.
II Derivatives of Worldline Casimir–Polder Energies
To serve as a concrete example of path-integral differentiation, we will consider Casimir-type energies for the scalar field corresponding to the transverse-electric (TE) polarization of the electromagnetic field coupled to a dielectric [19]. In the strong-coupling (perfect-conductor) limit, this path integral imposes the same Dirichlet boundary conditions as in the path integrals considered by Gies et. al [6].
The basic expression for the Casimir energy of this scalar field in a dielectric-permittivity background is (without renormalization)
(1) |
or equivalently,
(2) |
In these expressions, is the number of spacetime dimensions, but the temporal dimension has been explicitly removed at this stage. This expression also assumes a dispersion-free dielectric at zero temperature, but it (and the following treatment) are readily generalized to incorporate dispersion and temperature effects [19]. In this expression, the double angle brackets denote an ensemble average over closed Brownian paths (in spatial dimensions) that begin and end at . The single-angle-bracket notation indicates an average of the relative dielectric permittivity along the path :
(3) |
The path increments are Gaussian, with moments and . The energy in these expressions must still be renormalized by subtracting the zero-body energy (obtained by replacing by in the stochastic average) and the one-body energy (obtained as a limit of widely separated bodies), removing the divergence at . Physically, the zero-body term represents the energy associated with a uniform dielectric background of permittivity .
The Casimir–Polder potential for an atom interacting with a dielectric body arises by treating the atom as a localized perturbation to the dielectric, , and keeping the energy change to linear order in the (static) atomic polarizability . Again, this prescription ignores dispersion and temperature, but such effects are straightforward to include [19]. The resulting path integral following from (1) is
(4) |
Again, this expression must be renormalized by subtracting the zero-body energy, which amounts to subtracting 1, assuming that the atom is not embedded in a dielectric medium (i.e., in a neighborhood of ). This expression for the Casimir–Polder potential is similar to that of the Casimir energy (1), but the potential here is solely a function of paths emanating from the atomic position .
II.1 Finite Differences
In path integrals such as Eq. (4) for the Casimir–Polder potential, one can compute the Casimir–Polder force by differentiating with respect to the source point of the paths. A simple, direct way to compute such a gradient numerically is the finite-difference method. In this technique the derivative is computed in terms of the contribution of each path and its shifted counterparts of the form , where is a small number, and form an orthonormal basis for the configuration space. The simplest finite difference for the first derivative, for example, yields the following path integral for the force, from Eq. (4):
(5) |
Unfortunately, as a numerical method this path integral performs poorly. Specifically, in the case of interfaces between regions of otherwise uniform dielectric permittivity, the contribution to the force path integral for a given path vanishes except when differs for the shifted and original paths and , respectively. Depending on how is computed numerically, this difference may vary substantially among the possible paths in the limit of small . For example, in the limit of an interface between vacuum and a perfect conductor, the contribution for a given path vanishes except in the (unlikely) case that crosses the interface but does not. For small , only a small subset of the paths make a nonvanishing contribution to the path integral, and the sample variance diverges as . This problem becomes progressively worse when computing additional derivatives. Thus, it is important to consider alternative methods for computing derivatives.
Because of the presence of the integral in the path integrals (1) and (4), it is possible in particular geometries to implement finite differences in a way that avoids the convergence problems noted above. This follows from noting that, for example, in the case of a planar dielectric interface, a shift in the source point of a path is equivalent to a change in the path’s running time , as far as computing is concerned. Thus, the finite difference can effectively act on the factor instead of the path average. However, the rest of this paper will focus on methods that apply in general geometries and to path averages that lack the integral.
II.2 Partial Averages in the Vicinity of the Source Point
To handle derivatives with respect to the atomic position in the Casimir–Polder energy (4), consider the general, schematic form of the path integral
(6) |
in terms of an arbitrary path functional and probability measure for the paths. The relevant paths for Casimir–Polder energies are closed, Gaussian paths (Brownian bridges) starting and ending at ; in discrete form with discrete path samples, the probability density for these paths in dimensions is
(7) |
where . To proceed, we will assume the path functional to be approximately independent of (). This is appropriate, for example, in Casimir–Polder calculations where the dielectric permittivity is constant in the vicinity of the atom (e.g., as in the case of an atom in vacuum, at a finite distance from a dielectric interface). In this case, derivatives of the path integral (6) with respect to act only on the probability density . For the Gaussian density (7), the derivatives along a particular spatial direction have the form
(8) |
where we are now indicating the spatial dependence in only the relevant direction for notational simplicity, , and the Hermite polynomials are defined according to the convention
(9) |
Note that we have written out the derivatives only for one-dimensional paths to simplify the expressions, but the results here generalize straightforwardly to multiple spatial dimensions (including multiple derivatives in one direction as well as cross-derivatives), in addition to non-Gaussian path measures (e.g., for paths corresponding to more general Lévy processes).
Combining Eq. (8) with the path integral (6) gives the expression
(10) |
for the path integral derivatives. However, this expression is problematic as a numerical derivative estimate because of the factor , which diverges in the continuum limit . This factor indicates large sample variances and cancellations between paths in this limit, resulting in inefficient numerical computations.
One approach to ameliorating this problematic behavior comes from the observation that if the path functional is approximately independent of , then in the limit of large , will also be approximately independent of neighboring points, such as , , and other nearby points. In this case, it is possible to carry out the integrals with respect to these points, to obtain a “partially averaged” path integral. (Note that this method is distinct from other partial-averaging methods [28, 29].) Carrying out the integrals over and , Eq. (10) becomes
(11) |
where and are defined by
(12) | ||||
(13) |
for . The probability density for the paths in the partially averaged expression (11) is
(14) |
which has “large steps” from to and to . For closed paths, it is generally most sensible to choose to apply the same partial averaging to the beginning and end of the path, such that and simplify to
(15) | ||||
(16) |
and the steps at the beginning and end of the path are equally large on average, as shown schematically (omitting the Brownian nature of the path for visual clarity) in Fig. 1.
Since the prefactor in the derivative (11) now scales as , there is clearly some reduction in the sample variance in a numeric computation as increases. However, the critical point is this: when chosen appropriately, this prefactor becomes independent of , curing the divergent sample variance in the continuum limit. To choose the number of points to partially average, the main consideration is that the averaging should not introduce significant error. Returning to the assumption that is approximately independent of , at this point we will have to be somewhat more precise and assume that depends on the path via a scalar function in the form . Then the key assumption is that is constant (or approximately constant) within a radius of the source point . The error in averaging over the point , while ignoring the corresponding dependence of , is small so long as there is a small probability for to leave the constant region. Assuming will be chosen to be small compared to , the path from to (and the corresponding path segment at the end) will behave approximately as an ordinary Wiener path. Since the probability for a one-dimensional Wiener path to cover a distance from in time is given by
(17) |
For , this expression is bounded above by . Then to keep the error acceptably small, the crossing probability is chosen to be below some small tolerance . This condition can be solved to find the total average step time such that . The fraction of the path one can acceptably average over is then given by
(18) |
(In practice we choose to be much smaller than suggested by this formula.) Note that is constant even as the path resolution increases, so that the numerical fluctuations, governed by , are independent of , as required. A bound for the numerical error then follows from multiplying the tolerance by the amount over which varies from to the exterior of the constant region.

These apply readily to the computation of derivatives of the Casimir–Polder potential. For example, the path integral for the Casimir–Polder force becomes
(19) |
after partial averaging, where an appropriate estimator for the path average of the permittivity is
(20) |
Note that the details of how the points and enter this estimator are not critical, since for small tolerances the dielectric permittivity at these points should be equal to the source-point permittivity for the vast majority of paths. Fig. 1 shows an example of the physical setup for this path integral for an atom near a planar dielectric surface. In evaluating this path integral numerically here, the distance scale is simply the distance between the atom and the dielectric interface, and a small tolerance guarantees that the points and are unlikely to cross over the interface.
In this differentiated path integral for the force, in principle no renormalization term is required—any renormalization term is independent of the position of the atom, and thus vanishes under the derivative. That is, the term in Eq. (19) does not ultimately contribute, because it vanishes under the ensemble average for any value of . However, on a path-wise basis this renormalization term is critical in a numerical implementation of this path integral, because it cuts off the divergence at and dramatically reduces the sample variance of finite ensemble averages, particularly for small .
II.3 Partial Averages Close to One Body
The partial-averaging approach is also useful in computing derivatives in a geometry with two or more material bodies, when the source point of the path integral is close to one of the bodies. This situation applies, for example, when computing the two-body stress-energy tensor in the vicinity of one of the bodies [25, 16, 18], or when extracting the nonadditive, multibody contribution to the Casimir–Polder potential.
As a concrete example, consider differentiating the Casimir–Polder potential of an atom between two dielectric half-spaces, where the atom is close to one interface (Fig. 2). In this problem there are two relevant scales for the path running time : the first time that the path touches either body, and the first time that the path touches both bodies. For the atom at position between interfaces at positions and , these times are on the order of and , respectively. If the atom is particularly close to one body, the dominant contribution to the worldline path integral comes from paths where . The approach of the previous section is limited in this case, because it relies on the dielectric permittivity being approximately constant in a neighborhood of the source point, with the effectiveness of the method increasing with the radius of this neighborhood. The method thus only effects partial averaging to a limited extent, for .

The partial-averaging method extends to this case if there are approximate analytical solutions available for the path integral. As in the case of the TE-polarization path integral [19], it is possible to find analytical solutions for path integrals corresponding to certain material geometries, and then to recast more general worldline path integrals in a form that leverages those solutions. In particular, the (un-renormalized) Casimir–Polder energy can be written as an ensemble average over paths divided into segments. The ensemble average in the path integral must then include an average over the positions of points that define a discrete path, as well as averages over all possible path segments connecting each pair of neighboring points:
(21) |
Here, the connected-double-angle brackets denote an ensemble average over all bridges between and , , and the dielectric susceptibility for the two bodies is . With this ordering of brackets, the averages over all path segments between points and occur for a fixed set of discrete points, and then the average must be taken over all possible discrete paths . The key point of this section is that for simple geometries, such as a single planar interface, it is possible to carry out the average over the path segments analytically. In the example of a single, planar interface, the solution corresponds to the generating function of the sojourn time of a Brownian bridge (see Ref [19], App. B).
For sufficiently small time steps (), the probability for the path to interact with both bodies on a given discrete step is small, so the path integral over bridges is well-approximated by accounting only for the nearest body. For path increments close to the body, the path-segment average is then
(22) |
The crucial point is that this path integral (including the Gaussian probability measure for the path increment), which we can write as
(23) |
corresponds to a propagator for an associated diffusion equation [30, 31, 32, 33], so the solutions between adjacent steps can be composed into the solution for a larger, combined step. The partial averaging can then be carried out as in the method of the previous section by composing steps together. To ensure that the error associated with the partial averaging is small, the probability to touch the more-distant body in time should remain below some small tolerance . In the example of two planar interfaces, this condition has the explicit form
(24) |
using the same argument that led to Eq. (18). In more general material geometries, the analytical path integral must also approximate the shape of the nearest body. For example, a smooth but nonplanar interface (e.g., the surface of a spherical body) can be approximated locally by a plane for the purposes of the path-segment average in a given path increment. However, in this case, is also constrained because the geometric approximation must hold over the typical extent of the path up to time . For example, in a local planar approximation, the distance that paths typically explore in time must be small on the curvature scale of the interface.
After averaging, the derivatives are readily computed, although in general they will not yield the same Hermite-polynomial weighting factors as in Eq. (10):
(25) |
As discussed at the end of the previous section, this expression should be renormalized as necessary. Note that in the path integral here, the derivatives act on both the Gaussian path measure and the subaverages over path segments [via the bracketed factor in Eq. (23)]. In addition, the functional form of may vary depending on the local path position , because it should reflect only the presence of the interface nearest . Although the approximate solution near the source point of the path is crucial for the partial averaging, it is not necessary to use such analytical results for the entire path. For example, one could also use the simpler trapezoidal estimator [19] for the average of the dielectric function around the remainder of the path.
The averaging approach described here helps to improve the sample variance in a numerical average when the source point of the paths is close to an interface, even though the functional integral cannot be treated as approximately constant, as assumed in the previous method of Section II.2. Both this and the previous methods of path-averaging described can be thought of as choosing non-uniform time steps in the discrete path. It is important to note, however, that in most path integrals, all of the time steps should be vanishingly small for good accuracy; but in the partially averaged path integrals here, the “large” first and last steps should be of fixed time step, even in the limit as the remaining step sizes become vanishingly small. Since the derivatives act on the first and last path steps, the sample variance decreases as their respective time steps increase. In order to improve the statistical convergence of the path average, the first and last steps should therefore be as large as possible, while controlling the errors associated with the simplified, approximate integrands. The methods here still allow a high resolution for the middle section of the path, in order to accurately capture the geometry dependence of the path integral.
III Differentiation of Worldline Casimir Energies
Path integrals of the form of Eqs. (1) or (2) correspond to Casimir energies between macroscopic bodies. The computation of their derivatives requires a different set of methods because they involve an integral over all possible source points for the paths. To compute forces, curvatures of potentials, and torques within this framework, it is necessary to differentiate with respect to generalized coordinates, such as distances and angles between bodies, in contrast to the derivatives with respect to path source points that we considered above. Here we will develop a general method to handle such derivatives of path integrals.
For the purposes of differentiation, the critical component of the Casimir-energy path integral has the form
(26) |
where is a linear functional of a function of the path average (3) of the susceptibility , and where labels a generalized coordinate of the first body (or collection of bodies), and labels a generalized coordinate of the second body (or collection thereof). For example, a typical arrangement is depicted in Fig. 3, where uniform dielectric bodies are separated by vacuum, although the treatment here may be straightforwardly generalized to nonuniform dielectric media. In this case, the susceptibility is given generally by
(27) |
where is the dielectric susceptibility of body ; defines the surface of the th body, with and on the interior and exterior of the body, respectively; and is the center of the th body. The integral still averages over the paths via the path average. Recall that depends implicitly on via the path statistics, because .

III.1 Force
The force on a body follows from the gradient of the Casimir energy, where the derivatives are taken with respect to the body’s position. For example, the force on body is given by differentiating the path integral in Eq. (26) with respect to the body position :
(28) |
In this expression, is independent of (since is a linear function of ). In the case where is exponential, we can divide the path average into two steps: first, averaging over the discrete, uniform steps , and second, averaging over all the subpaths between and :
(29) |
Here, the connected-double-angle brackets denotes an average over all such bridges between and , as in Sec. II.3, and the subscript indicates an average over all discrete paths of steps. Then applying the derivative to the product of subpaths,
(30) |
There are typically terms here, but if is associated with a sharp surface, only of them will contribute to the sum. Again, this form of the path integral is specific to an exponential ; for example, Eq. (2) is of the form
(31) | |||
and works with this method. Other path integrals, for example of the form of Eq. (1),
(32) | |||
can be handled using the alternate form for the force,
(33) |
where . Qualitatively, the Casimir force on a body arises from paths that pierce its surface, with a vector path weight in the direction of the surface normal at the path source point. Although the surface of an arbitrary body involves surface normals pointing in all directions, each surface normal obtains a different geometry-dependent weight via the path ensemble. The result is, in general, a nonzero net force.
As in Sec. II.2, a partial-averaging procedure accelerates convergence. If one surface is located at , then the condition is
(34) |
for a positive tolerance [typically ; note that setting simply detects a surface crossing]. When this condition is satisfied for any boundary, the solution advances forward by points, and the estimate of the function or the susceptibility is calculated with respect to this larger path length.
III.2 Potential Curvature
This method can be easily extended to the second derivative of the worldline energy, which yields the potential curvature,
(35) |
in basis . Applying this to the path integral (26) gives
(36) |
and applying the derivatives in the case where is exponential yields
(37) | ||||
However, it is possible to recast one derivative with respect to the other surface,
(38) |
in which case, applying the derivatives, in the case where is exponential, and making the approximation for well separated bodies, where characterizes the body separation, we obtain
(39) | ||||
In the general case, where is any function, in the same approximation we obtain
(40) | ||||
Partial averaging is then carried out as in Sec. III.1.
III.3 Torque
The Casimir torque on a body follows in a similar way by considering the energy shift due to a small rotation. Specifically, consider an infinitesimal rotation of body 1 about the point , with axis , and through angle :
(41) |
For a small rotation angle, the rotation matrix has the form
(42) |
where is the Kronecker delta and is the Levi–Civita symbol; repeated indices are summed throughout this section. The torque for a rotation about axis can be written as . The -derivative acts only on the path-averaged dielectric part of the energy integral,
(43) |
where in the last step we introduced the usual vector cross-product . Substituting this into Eq. (26), the resulting path integral for the torque, after dropping the arbitrary axis , is
(44) |
This expression for the torque has the intuitive interpretation where the contribution from each surface element is the cross-product of the displacement vector from the rotation center to the surface point with the Casimir force density associated with that surface element.
IV Numerical Results
In this section we demonstrate the feasibility and good performance of the above methods for numerically differentiating worldline path integrals. As in previous work [19], the basic Casimir–Polder calculation of an atom interacting with a planar dielectric interface, along with the Casimir energy of two thin, parallel, planar dielectric membranes, will serve as the test cases for these methods.
IV.1 Partial Averaging
Fig. 4 demonstrates the utility of the Hermite-weighting method of Eq. (11) for computing derivatives of path integrals. The plot shows the results of the numerical evaluation of the path integral (4) for the Casimir–Polder potential of an atom near a dielectric half-space, along with the computed spatial derivatives up to the tenth. Since the potential and its derivatives are normalized to the potential in the perfect-conductor limit, the analytic result is distance-independent, and has the same form in each case, given by the expression
(45) |
as discussed in Ref. [19] (while not completely realistic [34], this model suffices for a numerical test).
Some aspects of the calculations in this figure are worth discussing here. These computations nominally employed points per path. However, at finite , the error analysis in Ref. [19] indicates that numerical accuracy suffers, particularly at large values of the susceptibility , because the finitely sampled path does not have the same “extent” as the same path in the continuum limit. To help maintain accuracy at large , the paths employ some limited, finer sampling: the two path intervals on either side of the point closest to the dielectric interface are each sampled with more points (see App. A for the algorithm to generate these sub-paths). This strategy substantially alleviates the major source of sampling error at large , while negligibly impacting the computational effort. In terms of the number of partial averages, we make the simplistic choice of choosing a fixed value of for each calculation (, 20, 200, 200, and 500 partial averages were employed for , 2, 4, 7, and 10 derivatives, respectively), despite the indication of Eq. (18) that the number of partial averages should be chosen to be inversely proportional to to maintain a controlled error. This is justified by noting that the partial averages can be chosen to have small errors for small values of , and the effects of the resulting larger error for large values of will be suppressed by the factor in the path integral (4). (For high-accuracy evaluation of the path integral, the partial averages should instead be chosen in a -dependent way.)
Another major numerical challenge that arises in Fig. 4 in the case of high-order derivatives comes from the Hermite-polynomial factor in Eq. (11). One issue here is that the Hermite polynomial takes on large values for large values of . But the Gaussian path measure in the path integral only generates such large values rarely. This means that, with ordinary Gaussian paths, rare events make large contributions to the ensemble, leading to poor statistical accuracy in the numerical computations. In these calculations, we employed the direct solution of sampling from the Hermite–Gaussian density
(46) |
where the factor
(47) |
normalizes the probability distribution. Then a Gaussian deviate of zero mean and variance allows the first and last path steps to be generated according to and , and the remainder of the path is generated as a Brownian bridge running from to in time (see App. A for the bridge-generating algorithm). With these modified paths, the path average (11) should be modified to read
(48) |
where . Because the Hermite polynomial can take either sign, a great deal of cancellation occurs in Eq. (48) among the paths, which can again lead to poor statistical performance for high-order derivatives, when the Hermite polynomial has multiple regions of opposing sign. To combat this, for a given path, the path functional can be averaged over multiple values of (holding the rest of the path fixed) to effect this cancellation on a pathwise basis. The calculations in Fig. 4, used averages over 1, 5, 100, 5000, and 5000 values of per path for , 2, 4, 7, and 10 derivatives, respectively, where the were sampled from a sub-random (1D van der Corput) sequence to enhance the accuracy of this subaverage.
The numerical performance in Fig. 4 is generally quite good, although performance suffers for high-order derivatives. All of the data here represent statistical averages over paths (except for derivatives, which averages over paths). The points at a given derivative order were computed using the same random numbers, so the points within a curve are not statistically independent. The error bars (delimiting one standard error) are invisibly small on the plot, and amount to a relative statistical error of at most , , , , , and for , 1, 2, 4, 7, and 10 derivatives, respectively. The observed accuracy of the results is comparable to the standard error in each case except for the 10th derivative, where the observed error is at worst 14%, despite the extra computational effort. However, note that a comparable computation of the 10th derivative via the finite-difference method would be completely unfeasible. For an effective resolution of points per path (with and subsampling of points as described above), a length scale of the order is appropriate for the finite difference, but this leads to a standard deviation in the path values of the order of relative to the mean.

IV.2 Convergence: Finite Differences vs. Partial Averages


To study the numerical error of the partial-averaging method in more detail, we performed the same calculations as in the previous section for one and two spatial derivatives of the Casimir–Polder potential for an atom near a planar interface, while varying the number of partial averages (Figs. 5 and 6). To simplify the analysis, is held constant (independent of ), ignoring the error-control criterion (18). For comparison, the plots also show the corresponding errors when computing the derivatives via finite differences. The first derivative employs the second-order, centered-difference formula , where is a small spatial displacement. The second derivative exploits the analogous difference formula . In implementing the finite-difference methods, it is important to apply these difference formulae on a path-wise basis (or equivalently, apply the difference formulae on ensemble averages over equivalent path samples) for this method to produce any kind of reasonable result. In applying the finite-difference method, the numerical details (path generation, calculation of path averages, etc.) otherwise match those of previous work (see Ref. [19], Section V). Although the error for both the partial-averaging and finite-difference methods behaves similarly in the plots, note that the quantities and from the two methods are not directly comparable. In the partial-averaging method, sets a length scale that varies with in the integral in Eq. (4). However, it is customary practice for the finite-difference method to use a displacement independent of the details of the rest of the calculation, so represents a fixed length scale, independent of . Nevertheless, the plots provide a useful visual comparison of the performance of the two methods.
The performance of the two methods for a dielectric susceptibility (Fig. 5) is similar in minimizing the relative error in the case of one derivative. However, the partial-averaging method performs clearly better in the two-derivative case. Although in this computation, for numerical purposes this calculation is in a “small-” regime because [19]. In terms of the path integral, this means that, in the first-derivative case, when comparing two slightly displaced copies of the same path that overlaps the dielectric interface, the difference in the path-average functional from the path integral (4) will be small, of the order for sufficiently small displacements. Finite differences tend to work well when operating on smooth functions, and this is exactly what Fig. 5(a) shows: despite the noisy nature of the paths, the path integral in this regime is relatively well behaved, allowing the finite differences to exhibit performance comparable to that of the partial-averaging method. The clear separation between the methods in Fig. 5(b) highlights the better performance of the partial-averaging method for derivatives beyond the first.
Figure 5 also shows fits to the data (the range of each fit is shown in App. C, Table 1). On the side of small or , the data are fit to or in Fig. 5a, and to in Fig. 5b. This reflects the or scaling expected of the statistical error in the case of derivatives [particularly in the latter case, where Eq. (11) has a prefactor that scales in this way]. On the side of large or , the logarithms of the data (on both axes) are fit to a second-order polynomial. The crossings of the corresponding curves are marked by stars, which give the best error expected from the method. The relative errors in the first-derivative methods are both around and the relative error in the second-derivative partial-average method is around . The first-derivative error also exhibits a spurious dip (actually a zero), as noted above, for near . However, this does not represent a reliable error minimum in a more general calculation. Rather, the asymptotic scaling only just becomes visible in a relatively narrow interval (near the center of the interval marked between and ) before the statistical error takes over. This region represents the true best-case error of this method in this calculation.
The difference in performance between the methods is even more clear in the perfect-conductor () limit (Fig. 6). In both the first- and second-derivative cases the partial-averaging method achieves substantially better accuracy than the finite-difference method. The contrast is particularly striking for the second derivative, where the finite difference achieves a minimum error of around 20%, making the method effectively useless in this regime. (Note that in the finite difference of the first derivative, there is a spurious zero near , as discussed above.) The poor performance of the finite difference is consistent with the argument in the introduction. In the perfect-conductor regime, slightly shifted paths can produce path-functional values that differ by much more than —the path-average functional from the path integral (4), after renormalization, leads to a null value for paths that do not overlap the interface, but a value of unity for overlapping paths. This leads to large statistical errors in a finite, numerical path average, because finite differences lead to path-functional values switching between zero and for derivatives. Also, as is evident in the data, the systematic errors become relatively large in this regime as well, especially in the case of the second derivative. In fact, because we know from prior work [19] that the calculations in the perfect-conductor limit are subject to larger systematic errors than small- (i.e., ) calculations, we used substantially more points per path in the large- calculations ( compared to for , with the addition here of sub-path sampling, using points per interval near the path point closest to the surface, as described in the previous section; to keep the numerical effort comparable in the two cases, the large- results average over paths, compared to the paths in the case).
The same curve fits were applied in Fig. 6 (fit ranges in App. C, Table 1). For the first derivative, the finite-difference best relative error is , while the partial-average best relative error is , a difference of a factor of 5. In the second-derivative case, the partial-average method performs much better than the finite-difference, with a relative error of .
At this point it is worth reiterating one of the main motivations for developing the partial-averaging method for numerical differentiation. The computation of the Casimir–Polder potential in the case of transverse-magnetic (TM) polarization involves the second derivative of a path integral with a path-integral potential that is highly singular at a dielectric interface. Indeed, the TM potential at an interface between finite- dielectric materials turns out to be far more pathological than the above behavior of the TE path integral for an interface in the limit. This pathological behavior is problematic when applying the finite-difference method to the numeric differentiation of the TM path integral. However, as we will show in a future publication, the partial-averaging method is a serviceable alternative method for computing the TM-polarization potential.
IV.3 Casimir Force and Curvature



The numerical methods of Section III for computing derivatives for Casimir-energy path integrals are similar to the partial-averaging method applied to the Casimir–Polder path integral in the previous section. Fig. 7 shows the results of such a computation, calculating the Casimir force (first derivative of the Casimir energy) and the curvature (second derivative of the Casimir energy) between two thin dielectric plates, where the total susceptibility and the relative permittivity are
(49) |
Here, viewing the delta-function limit as an idealization of a square profile of a dielectric of finite thickness , then , where is the susceptibility of the medium. The plot compares the numerical data to the exact Casimir force or curvature. When normalized to the potential in the perfect-conductor limit (), the Casimir energy has the form
(50) |
in terms of the Fresnel coefficient . This expression depends on and only in the combination ; in the limit , this efficiency is , for a far-field distance dependence, while in the limit , the efficiency is (i.e., the strong-coupling limit). The data are compared to derivatives of this expression with respect to .
The numerical method solves the exponential form (2) of the path integral; the only error that is not statistical is in treating the two surfaces as independent. That is, the error is in treating the occupation time for each delta-function surface independently, not both surfaces together. This explains the much better performance of the finite-difference method compared to Figs. 5 and 6. The numerical tests implement Eqs. (30) and (III.2), as appropriate for an exponential path integral. The discrete paths over points are averaged over all sub-paths between the points and ; in the one-body approximation, the appropriate quantity is the local time (rather, its generating function) and its derivative, detailed in Appendix B. Values for and are Monte-Carlo sampled. We also take advantage of the fact that any contributing path must cross any plane between the surfaces. That is, we may start paths midway between the two planes, with a reweighting factor of , where is the smallest path coordinate such that (or just if no other such point exists), and is the largest path coordinate such that (or just if no other such point exists).
The partial-averaging method amounts to looking for path segments that get close enough to the boundaries; details are given in Sec. III.1, particularly Eqs. (30), (34), and (III.2). Similar to the Casimir–Polder case, renormalization of the one-body energy is necessary to obtain a finite result. For the first derivative, we compute the one-body energy for the undifferentiated surface, and subtract it from the total energy. For the second derivative (III.2), where one derivative is applied to each surface, no renormalization is necessary.
For the finite-difference method, with renormalization of the one-body energies, the path integral has the form
(51) |
where is the two-body energy, is the one-body energy of body , and is the position of body . The first derivative is computed according to a standard, second-order finite difference, which for the component reads
(52) | ||||
where is some small perturbation. The second derivative is also computed according to a second-order finite difference,
(53) |
A better comparison with the partially averaged second derivative is
(54) |
applying one derivative to each interface.
We observe good agreement with the exact results (Fig. 7). The calculations employed paths, each of points per path. The first derivative used partial averaging over 300 points, while the second derivative used 250 points. The relative error in the first derivative ranges from for small to for large , and for the second derivative, the relative error ranges from at the low end to around at , though the error rises to about for the highest .
Figs. 8 and 9 show the errors of the partial-average method vs. the finite difference (and in the case of the second derivative, of one finite difference applied to each side). These plots display the relative error vs. the normalized separation for the finite-difference methods, or the partial-averaging fraction , as described in Section III.1. As in Figs. 5 and 6, the lines for small are curve fits to or in Figs. 8a and 9a, and to , , or , as indicated in Figs. 8b and 9b (fit ranges indicated in App. C, Table 2). For large , the curve fits are second-order polynomials to the log of the data (on both axes). The intersection of the small- and large- curves is marked with a star, and gives an estimate of the best error of the method. The partial-averaging method outperforms the finite-difference method for the first derivative in Fig. 8a, for (where the best error is for partial averaging, vs. for finite difference). The partial average still outperforms the finite difference for the second derivative in Fig. 8b, again for (where the best error is for partial averaging, vs. for finite difference, or for finite difference, one derivative applied to each side). For (Fig. 9), while the advantage persists for one derivative (where the best error is for partial averaging, vs. for finite difference); however, for the second derivative, the performance is roughly the same ( for partial averaging, vs. for finite difference, or for finite difference, one derivative applied to each side). For and the limit (both not shown), the methods are comparable in error for both the first and second derivative. So the partial average sometimes performs substantially better than finite differences, and never performs substantially worse. But it should also be appreciated that this partial average method is much faster than finite differences near the optimum value, because of the large time jumps near the surfaces involved.
The method that we have tested here clearly extends to a general geometry. It involves counting the intersections with one (or both) surfaces, and replacing one intersection (or one for each surface) with its derivative. It is thus not geometry-specific. The only requirement for partial averaging is that the typical distance covered during a large jump is small compared to a length scale where the nearest surface can be considered flat (assuming that a flat-surface approximation is employed, for example, in a sphere-sphere geometry [35]).
V Summary
We have developed methods for computing derivatives of Casimir–Polder and Casimir-type path integrals. Such derivatives are notable for being difficult to compute using finite differences, because they converge badly—a path only contributes if it marginally touches a surface, but has a large contribution, leading to a large sample variance. For Casimir–Polder-type path integrals, our method involves partial averaging over the region around the atom, which cuts off the sample variance from diverging. For Casimir-type integrals, the method involves counting all intersections with surfaces, and differentiating one of the subpaths. The partial averaging method there involves simply skipping large steps in time, leading to a large gain in computation time. In a future publication, we will apply this method to the Casimir–Polder potential for transverse-magnetic modes, which involves a second derivative.
Appendix A Brownian-Bridge Generation
The numerical evaluation of the path integrals in this paper and other work on worldline methods involves the generation of discrete, stochastic paths. The basic stochastic process is the Brownian bridge , which in its most basic form is subject to initial and final conditions , and diffuses continuously as a Wiener process for intermediate times [i.e., and for ]. The discrete representation of a Brownian bridge follows from the more general probability density (7). Samples of a Brownian bridge in discrete steps may then be generated in a numerical calculation via the recurrence relation
(55) |
where , the are random deviates sampled from the standard-normal distribution, and the recursion coefficients are
(56) |
This algorithm was discussed in previous work [19] (and is a variation of the “v-loop” algorithm of Gies et. al [6]).
In the numerical methods of this paper, it is necessary to generate samples of more general, “open” Brownian bridges that are subject to different initial and final conditions. (Specifically, this applies to the partial-averaging method as discussed in Sec. IV.1, and the finer path sampling around the “extremal” path point in the same section.) Under the conditions and , the above recurrence generalizes to
(57) |
where , , the bridge takes intermediate steps (each of time ), and the are still given by Eq. (56).
In the partial-averaging construction of paths in Sec. II.2, some portion of a path is constructed according to some consideration, and the generalized bridge recursion serves to fill in the rest of the path. For example, sampling from the Hermite–Gaussian density (46), after partial averaging, gives the first path steps at the beginning and end of the path, and a Brownian bridge must then complete the path in steps. To write out the algorithm more explicitly for this problem, suppose the “whole” path corresponds to an -step, discrete Brownian bridge with , and that we take the path coordinate after steps to be given. The above recursion then constructs a bridge from to in steps over a running time . Because there are time steps of duration , the recurrence (57) reads
(58) |
when adapted to this situation. The coefficients reduce to the expression (56) in terms of if the index is shifted by , so that starts at [note that this shift has already been applied in the recursion (58)]. Thus, the recursion (58) has the form of the last steps of the recursion (57)—an intuitive way to think of “completing” the path once the first steps are fixed.
Appendix B Local Time
For a stochastic process , the local time is defined as [36]
(59) |
The local time quantifies the amount of time that the process spends near a boundary at during the interval . It is related to the sojourn time , which measures the amount of time that the process spends in the state , through the derivative
(60) |
(See Ref. [19] for a definition and some statistics of the sojourn time.) The local times of a Wiener process with and are distributed according to the probability density
(61) |
An important quantity for the local time that we use in the simulations is the moment generating function, which takes the form
(62) |
again with , . This expression, along with its derivative with respect to , is used in the simulations in Sec. IV.3.
Appendix C Endpoints for Curve Fits
Here the endpoints for the curve fits are listed for Figs. 5 and 6 (Table 1), and 8 and 9 (Table 2). We list these since the fit results may depend somewhat on the choice of endpoint. In many cases, points near the crossover between the two curves are excluded because it is not clear where they should be assigned.
References
- Casimir [1948] H. B. G. Casimir, Proc. K. Ned. Akad. Wet. 51, 793 (1948).
- Casimir and Polder [1948] H. B. G. Casimir and D. Polder, Phys. Rev. 73, 360 (1948).
- Lifshitz [1956] E. Lifshitz, J. Exper. Theoret. Phys. USSR 29, 94 (1956).
- Chan et al. [2001] H. B. Chan, V. A. Aksyuk, R. N. Kleiman, D. J. Bishop, and F. Capasso, Science 291, 1941 (2001).
- Harber et al. [2005] D. M. Harber, J. M. Obrecht, J. M. McGuirk, and E. A. Cornell, Phys. Rev. A 72, 033610 (2005).
- Gies, Langfeld, and Moyaerts [2003] H. Gies, K. Langfeld, and L. Moyaerts, J. High Energy Phys. 2003, 018 (2003).
- Gies and Klingmüller [2006] H. Gies and K. Klingmüller, J. Phys. A 39, 6415 (2006).
- Gies and Klingmüller [2006a] H. Gies and K. Klingmüller, Phys. Rev. Lett. 96, 220401 (2006a).
- Gies and Klingmüller [2006b] H. Gies and K. Klingmüller, Phys. Rev. Lett. 97, 220405 (2006b).
- Gies and Klingmüller [2006c] H. Gies and K. Klingmüller, Phys. Rev. D 74, 045002 (2006c).
- Klingmüller and Gies [2008] K. Klingmüller and H. Gies, J. Phys. A 41, 164042 (2008).
- Weber and Gies [2009] A. Weber and H. Gies, Phys. Rev. D. 80, 065033 (2009).
- Fosco, Lombardo, and Mazzitelli [2010] C. Fosco, F. Lombardo, and F. Mazzitelli, Phys. Lett. B 690, 189 (2010).
- Weber and Gies [2010] A. Weber and H. Gies, Phys. Rev. Lett. 105, 040403 (2010).
- Aehlig et al. [2011] K. Aehlig, H. Dietert, T. Fischbacher, and J. Gerhard, (2011), arXiv:1110.5936 .
- Schäfer, Huet, and Gies [2012] M. Schäfer, I. Huet, and H. Gies, Int. J. Mod. Phys. Conf. Ser. 14, 511 (2012).
- Mazur and Heyl [2015] D. Mazur and J. S. Heyl, Phys. Rev. D 91, 065019 (2015).
- Schäfer, Huet, and Gies [2016] M. Schäfer, I. Huet, and H. Gies, J. Phys. A 49, 135402 (2016).
- Mackrory, Bhattacharya, and Steck [2016] J. B. Mackrory, T. Bhattacharya, and D. A. Steck, Phys. Rev. A 94, 042508 (2016).
- Schneider, Torgrimsson, and Schützhold [2018] C. Schneider, G. Torgrimsson, and R. Schützhold, Phys. Rev. D 98, 085009 (2018).
- Franchino-Viñas and Gies [2019] S. Franchino-Viñas and H. Gies, Phys. Rev. D 100, 105020 (2019).
- Corradini and Muratori [2020] O. Corradini and M. Muratori, J. High Energy Phys. 2020, 169 (2020).
- Rajeev [2021] K. Rajeev, Phys. Rev. D 104, 105014 (2021).
- Bastianelli and Paciarini [2024] F. Bastianelli and M. D. Paciarini, Class. Quantum Grav. 41, 115002 (2024).
- Scardicchio and Jaffe [2006] A. Scardicchio and R. L. Jaffe, Nucl. Phys. B 743, 249 (2006).
- Glasserman [2004] P. Glasserman, Monte Carlo Methods in Financial Engineering (Springer, 2004).
- Asmussen and Glynn [2007] S. Asmussen and P. W. Glynn, Stochastic Simulation (Springer, 2007).
- Matacz [2002] A. Matacz, J. Comput. Finance 6, 79 (2002).
- Predescu [2003] C. Predescu, J. Math. Phys. 44, 1226 (2003).
- Feynman [1948] R. P. Feynman, Rev. Mod. Phys. 20, 367 (1948).
- Kac [1949] M. Kac, Trans. Amer. Math. Soc. 64, 1 (1949).
- Durrett [1996] R. Durrett, Stochastic Calculus: A Practial Introduction (CRC Press, 1996).
- Karatzas and Shreve [1991] I. Karatzas and S. E. Shreve, Brownian Motion and Stochastic Calculus (Spring-Verlag, 1991).
- Babb, Klimchitskaya, and Mostepanenko [2004] J. F. Babb, G. L. Klimchitskaya, and V. M. Mostepanenko, Phys. Rev. A 70, 042901 (2004).
- Schoger et al. [2022] T. Schoger, B. Spreng, G.-L. Ingold, A. Lambrecht, P. A. M. Neto, and S. Reynaud, Int. J. Mod. Phys. A 37, 2241005 (2022).
- Borodin and Salminen [2002] A. N. Borodin and P. Salminen, Handbook of Brownian Motion—Facts and Formulae, 2nd ed. (Birkhäuser, 2002).