{'fraction_non_alphanumeric': 0.05218896858768241, 'fraction_numerical': 0.02080413334432627, 'mean_word_length': 4.592991085152168, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modified representations for the close evaluation problem

When using boundary integral equation methods, we represent solutions of a linear partial differential equation as layer potentials. It is well-known that the approximation of layer potentials using quadrature rules suffer from poor resolution when evaluated closed to (but not on) the boundary. To address this challenge, we provide modified representations of the problem's solution. Similar to Gauss's law used to modify Laplace's double-layer potential, we use modified representations of Laplace's single-layer potential and Helmholtz layer potentials that avoid the close evaluation problem. Some techniques have been developed in the context of the representation formula or using interpolation techniques. We provide alternative modified representations of the layer potentials directly (or when only one density is at stake). Several numerical examples illustrate the efficiency of the technique in two and three dimensions.


Introduction
One can represent the solution of partial differential boundary-value problems using boundary integral equation methods, which involves integral operators defined on the domain's boundary called layer potentials. Using layer potentials, the solution can be evaluated anywhere in the domain without restriction to a particular mesh. For that reason boundary integral equations have found broad applications, including in fluid mechanics, electromagnetics, and plasmonics [8,2,4,3,1,6,5,7].
The close evaluation problem refers to the nonuniform error produced by high-order quadrature rules used to discretize layer potentials. This phenomenon arises when computing the solution close to the boundary (i.e. at close evaluation points). It is well understood that this growth in error is due to the fact that the integrands of the layer potentials become increasingly peaked as the evaluation point approaches the boundary (nearly singular behavior), leading in limit cases to an O(1) error [15].
There exists a plethora of manners to address the close evaluation problem: using extraction methods based on Taylor series expansions [9], regularizing the nearly singular behavior of the integrand and adding corrections [10,11], compensating quadrature rules via interpolation [12], using Quadrature By Expansion related techniques (QBX) [15,17,16,13,18,14,19], using adaptive methods [20], using singularity subtraction techniques and interpolation [21,23,22], or using asymptotic approximations [24,25,26], to name a few. Most techniques rely on either providing corrections to the kernel (related to the fundamental solution of the PDE at stake), or to the density (solution of the boundary integral equation).
In the latter category, it is well-known that Laplace's double-layer potential can be straightforwardly modified via a density subtraction technique based on Gauss' law (e.g. [27]). This modification alleviates the close evaluation problem, and provides a better approximation for any given numerical method. However this identity technique is specific to Laplace's double-potential. Other identities have been derived for other problems, such as for the elastostatic problem [28].
In this paper we provide modified representations of layer potentials, and we give guidance to address the close evaluation problem in two and three dimensions. In particular, we modify Laplace's single-layer potential (representing the solution of the exterior Neumann Laplace problem) and Helmholtz layer potentials (in the context of a sound-soft scattering problem). With some given quadrature rule, the resulted modified representations allow us to obtain better approximations compared to standard representations. The proposed modifications are based on subtracting specific solutions (or auxiliary functions) of the PDE at stake. The use of auxiliary functions have been developed in the context of Boundary Regularized Integral Equation Formulation (BRIEF) [29,30,31] to regularize the representation formula on the boundary, or in the context of density interpolation techniques [21,23,32] to regularize layer potentials (generalization of density subtractions). Those techniques commonly consider multiple auxiliary functions, and may require to solve additional problems to find such functions. The proposed work concentrates on regularizing nearly singular integrals using explicitly one analytic auxiliary function, and when representing the solution with layer potentials involving only one density (no representation formula). We provide several examples of auxiliary functions (and compare them), and provide guidelines to find them. The proposed modified representations are simple and easy to implement, it allows one to straightforwardly gain accuracy in evaluating the solution, especially when computational resources are limited. This work provides valuable insights into Laplace and Helmholtz layer potentials. Additionally this can also be applied to modify boundary integral equations to avoid weakly singular integrals.
The paper is organized as follows: Section 2 presents some context and motivation for the proposed modified representations, Section 3 establishes the modified representations and general guidelines to find appropriate auxiliary functions. Sections 4 and 5 illustrate the efficiency of the modified representations for Laplace and Helmholtz in two and three dimensions, off and on boundary. Finally, Section 6 presents our concluding remarks, Appendices A and B provide a brief summary of the Nyström methods used in two and three dimensions, and Appendix C details some proofs for Section 3.

Motivation for modified representations
Consider a domain D ⊂ R d , d = 2, 3, that is a bounded simply connected open set with smooth boundary (of class C 2 ), and a linear elliptic partial differential equation of the form Lu = 0. It is common to represent the solution v of that PDE using the so-called representation formula (e.g. [40,Theorem 6.5], [33,Theorem 3.1]). In particular for v satisfying Lv = 0 in D, we have the following identities: where G denotes the fundamental solution of considered PDE, n y is the unit outward normal of D at y, and dσ y is the integration surface element. For instance, (1) holds true for L := ∆ and L := ∆ + k 2 , the Laplace and the Helmholtz equation, respectively. The goal of this paper is to use (1) with well-chosen v to modify the representation of the solution of boundary value problems associated to L. Let us illustrate the strategy with for example the Exterior Neumann Laplace problem: Find u ∈ C 2 (E) ∩ C 1 (Ē := R d \ D) such that: with some smooth data g (with null average). The solution of Problem (2) can be represented using the Green's formula [34,33]: where and the trace on the boundary satisfies the boundary integral equation of the second kind: The fundamental solution G is singular when y = x * . For x ∈ R d \ ∂D, assume we can write x = x * ± n x * with n x * the unit outward normal at x * , and > 0 the distance from the boundary. Then G is nearly singular at y = x * when |x − y| = 1 (i.e. when x is close to the boundary). A layer potential is said to be a weakly singular integral (resp. a nearly singular integral) when its kernel (G or ∂ n G in the cases above) is singular at y = x * (resp. nearly singular at y = x * ). There exist high-order quadrature rules to approximate weakly singular integrals with very high accuracy (e.g. [35,37,38,36]). However, high accuracy is lost for nearly singular integrals: this is the so-called close evaluation problem. Assuming we have solved (5), we can modify (3) using (1) to address the close evaluation problem. Taking the difference we obtain (6) If one finds v such that v(x * ) = u(x * ) and ∂ n x * v(x * ) = g(x * ), where x * ∈ ∂D denotes the closest boundary point of the evaluation point x (x = x * + n x * ), then (6) doesn't suffer from the close evaluation problem. Similarly, one can represent the solution of Problem (2) using a single-density representation given by the single-layer potential: with ρ a continuous density solution of the boundary integral equation of the second-kind: Assuming we have solved (8) for ρ, subtracting (1) from (7) we obtain If one finds v such that v(x * ) = 0 and ∂ n x * v(x * ) = ρ(x * ), then (9) doesn't suffer from the close evaluation problem. Representations (6) and (9) are attractive representations, and several works have provided guidelines on how to build appropriate solutions v. For (6) one can use Taylor-like functions v(x) = u(x * )g(x) + ∂ n x * u(x * )f (x), withg andf solutions of some Laplace boundary value problems [29,30,31]. This technique has been first developed in the context of Boundary Regularized Integral Equation Formulation (BRIEF) (namely to solve (5) using the same subtraction technique on boundary) and applied to evaluate the solution near the boundary. For (9) one can use density interpolation methods [21,23,32]: where (H j ) j satisfy the PDE (in the above case (H j ) j are harmonic functions). In both methods the chosen auxiliary functions v necessarily depend on the trace u (and/or normal trace ∂ n u), or the density ρ at the closest evaluation point. Furthermore they require to satisfy at least two conditions (two boundary value problems or two boundary conditions). In this paper we provide another construction of modified representations for singledensity representations of Laplace and Helmholtz boundary value problems. The construction relies on auxiliary functions v that are independent of the density (solution of the boundary integral equation), and requires fewer constraints in the context of (7). As a consequence, our approach provides more freedom in choosing v. The proposed modified representations are also simple to implement and do not add significant computational costs. In what follows we provide modified representations for Laplace and Helmholtz in 2D and 3D, and provide several examples to illustrate the efficiency of the method.

Modified representations
We present modified representations for single-density representations of Laplace and Helmholtz boundary value problems. In particular, we consider the interior Dirichlet Laplace problem (where one can represent the solution using the double-layer potential), the exterior Neuman Laplace problem (2) (using the single-layer potential (7)), and the sound-soft scattering problem.

Modified representation for the Laplace double-layer potential
The interior Dirichlet problem for Laplace consists in finding u ∈ C 2 (D) ∩ C 1 (D) such that with some smooth data f . The solution of Problem (10) can be represented as a doublelayer potential [34,33]: with G defined in (4), and µ a continuous density solution of the boundary integral equation: We now make use of (1) to modify (11). One can show the following (see Appendix C.1 for details): The solution of the exterior Dirichlet Laplace problem (11) admits the modified representation: The modified representation (14) has smoother integrands than (11), and it addresses the close evaluation problem, in the sense that nearly singular terms vanish as y → x * .
From Proposition 1 we can now build auxiliary functions v independent of µ, and there exist plenty of candidates: constant, linear, based on the Green's function (v(y) = G(y, x 0 ) with x 0 ∈ E), quadratic (v(y 1 , y 2 ) = 1 + ( , v(y 1 , y 2 , y 3 ) = e y 3 (sin y 1 + sin y 2 ), etc. The solution v ≡ 1 naturally satisfies the conditions (13), and the modified representation (14) boils down to The modified representation (15) is well-known and widely used (e.g. [27,15,25]), it is the simplest representation that naturally addresses the close evaluation problem. Thus, we do not provide numerical results for this case. Rather, we concentrate on other layer potentials.
3.2 Modified representation for the Laplace single-layer potential Going back to Problem (2), one can show the following (see Appendix C.2 for details): The solution of the exterior Neumann Laplace problem (2) admits the modified representation: The modified representation (17) has smoother integrands than (7).
Contrary to auxiliary functions provided in Taylor-like methods and density interpolation methods (discussed in Section (2)), auxiliary functions v do not depend on ρ and rely on only one constrain (16). Therefore, there is a lot of freedom in choosing v: given u a solution of Laplace's equation, then one

Candidates may then include:
-the linear function v(y) = n x * · y ; -the function v(y) = 2 d−1 πG(y, x * + n x * ) based on the Green's function ; Note that the above candidates are valid in R d , one can also consider any of the quadratic functions above in R 3 as a function of (y i , y j ), i, j = 1, 2, 3, j = i. In Section 4 we will test (17) using several candidates v and make comparisons. The modified representation (17) adds two terms to compute compared to (7), it is the price to pay to gain accuracy at close evaluation points. We will make comparative tests to quantify this aspect.

Modified representation for the Helmholtz double-and single-layer potentials
We consider in this case the sound-soft scattering problem: with some smooth data f associated to the wavenumber k. Above, the last condition represents the Sommerfeld radiation condition. The solution of Problem (18) can be represented as a combination of double-and single-layer potentials [39]: with G H defined by with H (1) 0 (·) the Hankel function of the first kind, and µ a continuous density satisfying: One obtain the following: Then the solution of the sound-soft scattering problem (18) admits the modified representation: (23) The modified representation (23) has smoother integrands than (19).
The proof can be found in Appendix C.3. One can check in particular that plane waves v(y) = e ikn x * ·(y−x * ) do satisfy (22), whereas Green-based functions like v(y) = G H (y, x * + n x * ) (up to some constant) cannot. We will use (23) with plane waves for the numerical examples.

Numerical examples
The accuracy in approximating (11)-(15), (7)-(17), (19)-(23) respectively, relies on the resolution of the boundary integral equation (12), (8), (21) respectively. In what follows we assume that the boundary integral equations are sufficiently resolved. Given the density's resolution, we compare the representations and their modified ones through several examples. All the codes can be found in [41].

Example 1: exterior Laplace in two dimensions
Since ∂D is a closed smooth boundary, we use the Periodic Trapezoid Rule (PTR) to approximate (7) and (17), where we will use several v according to Proposition 2. We consider an exact solution of Problem (2): which consists in choosing g(x * ) = ∂ n x * u exact (x * ), for any x * ∈ ∂D. All simulations are done outside of a kite-shaped domain using the Periodic Trapezoid Rule with N = 128 quadrature points for the following representations: • V0: standard representation (7); • V1: modified representation (17) with the linear function v 1 (y) = n x * · y; • V2: modified representation (17) with the Green-based function v 2 (y) = 2πG(y, x * + n * ); • V3: modified representation (17) with the quadratic function v 3 (y) = 1 2 • V4: modified representation (17) with the quadratic function .   We solved (8) using the Nyström method based on the Periodic Trapezoid Rule (using Matlab classic backslash). The accuracy of all methods is limited by the accuracy of the resolution for ρ (in particular when considering moderate N ). This can be assessed by looking the density's Fourier coefficients decay: in this case the coefficients decay is bounded by 10 −5 for N = 128. Results in Figures 1 and 2 show that given ρ resolved, the approximation of the modified representations provide better results overall. Far from the boundary, all methods approximate well the solution. As the evaluation point gets closer to the boundary ( → 0), V0 approximated by PTR suffers from the close evaluation problem and the error increases (see [15]). Note that the single-layer potential commonly suffers less from this phenomenon than the double-layer potential (e.g. [24]). Using the modified representations (V1-V4) allows to reduce the error by a couple of orders of magnitude for the close evaluation problem. All modified representations provide a satisfactory correction overall. We use a naïve (straightforward) implementation of (7) and (17) in Matlab, computed on a Mac mini SSD 512Go. We provide run times in Table  1 for various number of quadrature points. Run times do not count the time to compute the boundary integral equation for ρ (being the same for all methods). Representation V0 is obviously cheaper (less terms to compute) than V1-V4, and V1 is cheaper than V2-V4 due to simpler terms: there are less operations to conduct to compute v 1 (y) than the other provided auxiliary functions. To better compare the methods, Figure 3 represents log plots of the maximum error with respect to the number of quadrature points N and for various distances from point A (indicated in Figure 1). Results show that modified representations allow to gain a couple of order of magnitude even for moderate N (N < 100). Additionally, the error using V0 decreases linearly with the number of quadrature points whereas it is cubic using modified representations. While there is no significant difference between the considered  Table 1 -Laplace 2D single-layer. CPU times (in seconds) for various number of quadrature points and representations. Times account for computing the solution at N × 12 grid points ( = 10 −k , k = 0, 11 ) on a body-fitted grid.
modified representations V1-V4, one may consider run times (and simplicity of auxiliary function v) to discuss competitiveness. Based on above results, overall representation V1 seems to be the best choice for the best computational cost-accuracy trade-off. Let us emphasize that the focus of this paper is to highlight the efficacy and simplicity of the proposed modified representations, given a quadrature rule. Our results show that modified representations allow to naturally gain a couple of orders of magnitude in the error, addressing the close evaluation problem even for moderate computational resources. Additionally, the proposed auxiliary functions are independent of the density ρ. In the next section we investigate the efficacy of (17) in three dimensions.

Example 2: exterior Laplace in three dimensions
Given a domain D ⊂ R 3 with smooth boundary, we assume ∂D to be an analytic, closed, and oriented surface that can be parameterized by y = y(s, t) for s ∈ [0, π] and t ∈ [−π, π]. Then one can write (7) as with J(s, t) = |y s (s, t)×y t (s, t)|/ sin(s) the Jacobian. We now work with a surface integral defined on a sphere, and we use a three-step method (see [26] for details) to approximate (7) and (17). This method corresponds to a modification of the product Gaussian quadrature rule (PGQ) [42], and it has been shown to be very effective for computing layer potentials in three dimensions at close evaluation points compared to other quadrature methods for nearly singular integrals [26]. It relies on (i) rotating the local coordinate system so that x * corresponds to the north pole, (ii) use Periodic Trapezoid Rule with 2N quadrature points to approximate the integral with respect to t, (iii) use Gauss-Legendre with N quadrature points mapped to (0, π) (and not (−1, 1)) to approximate the integral with respect to s. This leads to the approximation: 1) the N -point Gauss-Legendre quadrature rule abscissas with corresponding weights w i for i = 1, · · · , N . One proceeds similarly for (17). We consider an exact solution of Problem (2): which consists in choosing g(x * ) = ∂ n x * u exact (x * ), for any x * ∈ ∂D. The efficacy of the three-step method for various geometries (including effects of curvature) is presented in [26]. Naively implementing this method has the same computational cost as the PGQ method. We do not focus in this paper on fast implementations but do believe that it is possible to speed up this method using ideas that have been previously developed including the fast multipole method [20]. Then for simplicity, results will be computed on a sphere where the resolution of ρ does not require a lot of quadrature points. One can apply the technique for arbitrary closed smooth surfaces, but might be limited by the resolution of (8). All simulations are done outside of a sphere of radius 2 using the three-step method with N = 16 for the following representations: • V0: standard representation (7); • V1: modified representation (17) with the linear function v 1 (y) = n x * · y; • V2: modified representation (17) with the Green-based function v 2 (y) = 4πG(y, x * + n * ); • V3: modified representation (17) with the quadratic function v 3 (y) = 1 2 • V4: modified representation (17) with the quadratic product function .
Note that there are other quadratic polynomials v (as a function of 2 variables instead of 3, see [22] where those polynomials serve as basis for interpolation method). We make here the choice to test using similar functions as in Section 4.1.1. We solve (8) using a Galerkin method and the product Gaussian quadrature rule [42,43,44,45,35] (see Appendix B for details). The accuracy in approximating V0-V4 is limited by the accuracy of the resolution for ρ. This can be assessed by looking at the coefficients' decay of the density spherical harmonic expansion. In this case the coefficients' decay has reached 10 −15 . Results in Figure 4 show that given ρ resolved, the approximation of the modified representations provide better results overall, except for V2 where the error plateaus around 10 −7 for small (providing less accurate results compared to standard representation V0). Note that the single-layer potential commonly suffers less from the close evaluation than the double-layer potential, and the chosen method provides already a good approximation. This is the reason why the error when considering V0 decays as decreases [26]. The modified representations allow to make it even better. To better assess the efficacy of the modified representations in three dimensions, Figure 5 represents log plots of the maximum error with respect to N ∈ {8, 16, 24, 32} (the method uses 2N × N quadrature points) and for various distances from the point B. Results show that as → 0, V1-V4 allow to gain a couple of orders of magnitude in the error, even for a small N . Note that the error produced by three-step method doesn't seem to depend on N , and in this case there are more variations with respect to the choice of auxiliary function v than in two dimensions. Here, V1 (the linear function) is the best representation, producing the smallest errors (and the fastest to compute as indicated in Table 2). Again, the threestep method has been designed to treat nearly-singular integrals. It is the reason why the method provides already satisfactory results (given the resolution of ρ). The modified representations allow to significantly gain even more accuracy in this case, even with limited computational resources.   Table 2 -Laplace 3D single-layer. CPU times (in seconds) for various number of quadrature points and representations for computing the solution (as described in Figure 4) from the points A and B, for = 10 −k , k = 0, 11 .

Example 3: scattering in two dimensions
We consider an exact solution of Problem (18): which consists in choosing f (x * ) = u exact (x * ), for any x * ∈ ∂D. All simulations are done outside of a star-shaped domain using the Periodic Trapezoid Rule with N = 256 quadrature points and k = 15 for the following representations: • V0: standard representation (19); • V1: modified representation (25) (i.e. (23) with the plane wave function v 1 (y) = e ikn x * ·(y−x * ) ). We solved (21) using Kress product quadrature rule [39] (see Appendix A). The quadrature rule is well adapted to approximate kernels with a logarithmic singularity. The accuracy of both methods is limited by the resolution for µ (the Fourier coefficients' decay of the density is bounded by 10 −6 for N = 256 and k = 15). Results in Figures 6 and  7 show that given µ resolved, the approximation of the modified representation provides better results overall. Similarly to Laplace's examples, both methods approximate well the solution far from the boundary. As the evaluation point gets closer to the boundary ( → 0), V0 approximated with PTR suffers from the close evaluation problem leading to large errors (see [15]). Using the modified representation V1 allows to reduce the error by a couple of order of magnitude for the close evaluation problem. Figure 8 rep-   resents log plots of the maximum error with respect to the number of quadrature points N ∈ 50, 3000 and for various distances from point A (indicated in Figure 6). Results show that for any number of quadrature points, the error when considering V0 explodes as we approach the boundary (error larger than 10 5 ) while the error with V1 remains bounded (of the order of 10 −2 in the case presented above). In this case standard rerpresentation V0 strongly suffers from the close evaluation problem, however the modified representation V1 significantly reduces the error. Even when standard quadrature rules fail to compute the standard representation, the proposed modified one regularizes the solution and provides satisfactory results without significant additional computational time (as shown in Table 3).  Table 3 -Helmholtz 2D. CPU times (in seconds) for various number of quadrature points and representations. Times account for computing the solution for N × 12 grid points (for = 10 −k , k = 0, 11 ) on a body-fitted grid.

Example 4: scattering in three dimensions
We consider an exact solution of (10): which consists in choosing f (x * ) = u exact (x * ), for any x * ∈ ∂D. All simulations are done outside of an ellipsoid parameterized by y(s, t) = (2 cos(t) sin(s), sin(t) sin(s), 2 cos(s)), (s, t) ∈ [0, π] × [−π, π], and using the three-step method with various N . This is in order to investigate the technique in the context of limited resolution, namely the coefficients' decay of the density spherical harmonic expansion doesn't reach machine precision. We consider k = 5 and the following representations: • V0: standard representation (19); • V1: modified representation (25). We solved (21) using Galerkin method and the product Gaussian quadrature rule (see Appendix B for details). The accuracy of both methods is limited by the accuracy of the resolution for µ. This limitation can be checked for instance by looking at the density spherical harmonics coefficients' decay: for k = 5, the resolution will be capped around 10 −2 for N = 16, 10 −4 for N = 24, and 10 −7 for N = 32. Results in Figure 9 show that given µ resolved, standard representation incurs bigger errors at close evaluation points while the modified representation provides better results overall. Here, the resolution of the boundary integral equation was fairly limited. Figure 10 represents log plots of the maximum error with respect to N ∈ 8, 32 (the method uses 2N × N quadrature points) and for various distances from the boundary from point A. While the three-step method has been designed to treat nearly-singular integrals and provided satisfactory results for Laplace's problems, the method here requires more quadrature points to achieve accuracy due to the wavenumber (see Section 4.2.3 for more details). The standard representation V0 suffers from both the close evaluation problem and the poor density resolution. The modified representation V1 allows to gain accuracy even with limited resolution (without significant additional computational time as indicated in Table 4). Figure 10 -Helmholtz 3D. Log-plot of the maximum error for computing the solution as described in Figure 9 with ∂D being the ellipsoid parameterized by y(s, t) = (2 cos(t) sin(s), sin(t) sin(s), 2 cos(s)), (s, t) ∈ [0, π] × [−π, π], at some distance along the normal from the point A= (−0.7664, 0.0607, 1.8433).  Table 4 -Helmholtz 3D. CPU times (in seconds) for various number of quadrature points and representations. Times account for computing the solution from points A and B, for = 10 −k , k = 0, 11 . 4.2.3 High frequency behavior It is well-known that for a fixed number of quadrature points N , accuracy is lost for larger wavenumbers k. Figures 11 and 12 represent the high frequency behavior for the Examples 3 and 4, for various k and N . We consider the same quadrature rules, exact solution u exact , boundary shapes, as in Sections 4.2.1, 4.2.2, but we vary k and/or N . The modified representation annihilates some oscillatory behavior by subtracting plane waves along the normal of the evaluation points. It allows then a better approximation for a wider range of wavenumbers (until the number of quadrature points isn't enough), and results in a greater wavenumber stability. Results in Figure 11 and 12 confirm this phenomenon.

Modified boundary integral equations
We have used (1) to modify the representation of solution of boundary value problems close to (but not on) the boundary. One could also use (1) to avoid weakly singular integrals in the boundary integral equation as done in BRIEF [31]. In the section we present a modified representation of (21). Proposition 4. Given x * ∈ ∂D, let v be a solution of Helmholtz equation in D ⊂ R d , d = 2, 3, satisfying conditions (22). Then the boundary integral equation (21) admits the modified representation: The modified representation (26) has smoother integrands than (21).
The proof can be found in Appendix C.3. Using again v(y) = e ikn x * ·(y−x * ) , Proposition 4 gives us the modified boundary integral equation: Equation (27) has no singular integrals (in the sense its integrands have vanishing singularities), in particular it could be approximated using standard quadrature rules such as PTR in two dimensions. Going back to Examples 3 and 4 presented in Sections 4.2.1 and 4.2.2, we now compare the approximation of the representations (19)- (25) where the density µ has been computed via (21)- (27). We then have four representations: • V0: standard representation (19) with previous approximation of (21); • V1: modified representation (25) with previous approximation of (21); • V2: standard representation (19), approximation of (27) using PTR as Nyström method (2D), using product Gaussian quadrature rule (3D). • V3: modified representation (25), approximation of (27) using PTR as Nyström method (2D), using product Gaussian quadrature rule (3D).   (18). Far from the boundary the error made using V2-V3 cannot be better than order 10 −6 . This limitation is due to the poor resolution of µ using Nyström method based on PTR to approximate (25). This can be assessed by looking at the density Fourier coefficients' decay, which caps at 10 −6 for N = 256. However, as the evaluation point gets closer to the boundary ( → 0), V3 yields  Table 5 -Helmholtz 2D. CPU times (in seconds) for various number of quadrature points to compute the solution of the boundary integral equation. competitive (sometimes better) results. Additionally, the use of Nyström PTR allows to reduce CPU times as indicated in Table 5. The modified boundary integral equation (27) can be approximated using standard quadrature rules such as Periodic Trapezoid Rule (note that Nyström PTR was not possible to use to solve for (21) due to singular integrals). Its resolution may be limited but it offers interesting corrections for the close evaluation problem using simple quadrature rules as well as faster solvers.
Results in Figure 14 show that the resolution of the solution using both methods yields the same accuracy in three dimensions. The product Gaussian quadrature rule is an open quadrature at the singular point y = x * (see Appendix B). Thus, the modification introduced in (25) doesn't affect the approximation. The product Gaussian quadrature rule is a well-used, efficient, easy to implement method, but one could consider a closed quadrature rule to study the effect of (27) more closely.  Figure 9 using N = 32, and for the four representations (standard or modified, off and on boundary).

Conclusion
In this paper we have provided modified representations for Laplace and Helmholtz layer potentials to address the close evaluation problem in several boundary value problems. Similar to Gauss' law, we take advantage of one auxiliary function, solution of the partial differential equation at stake. Similar technique has been used in the context of BRIEF and density interpolation. Our approach provides guidelines on how to develop them independently of the density, and valuable insights into the layer potentials inherent nearly singular behavior. Several examples in two and three dimensions have been presented and demonstrated the efficiency of the modified representations. Given a quadrature rule, the modified representation of the solution provides a better approximation by several orders of magnitude even with limited computational resources. This assumes that the density, solution of the boundary integral equation, is sufficiently well-resolved. The modified boundary integral equation has no singular behaviors anymore, and allows us to use standard quadrature rules that do not treat singularities. We have provided general modified representations, one can use them with any solution of their choice as long as they follow the provided guidelines to address the close evaluation.
One can use this technique to modify any other wave problems, including sound-hard, penetrable obstacles. Future work includes applying those techniques to plasmonic scattering problems [47,46], deriving an asymptotic analysis to quantify the limit behavior of the error as the evaluation point approaches the boundary, as well as extensions to other partial differential equations such as Stokes problems and others.

B Galerkin approximation
In this section we provide a brief summary about the Galerkin approximation used to compute the solutions of (12), (8), (21) and (27) in three dimensions. First, we compactly write (12), (8), (21) and (27) as with ψ denoting the density (i.e. µ, ρ), and F denoting the Dirichlet or Neumann data. We introduce the approximation for ψ ψ(y(θ, ϕ)) ≈ with y(θ, ϕ), θ ∈ (0, π), ϕ ∈ (−π, π) a parameterization of the boundary ∂D, {Y nm (θ, ϕ)} n,m the orthonormal set of spherical harmonics. For x * ∈ ∂D, we write x * = y(θ , ϕ ). Note that N in (30) corresponds also to the same order of the quadrature rule used to approximate (12), (8), (21) and (27). Substituting (30) into (29) and taking the inner product with Y n m (θ , ϕ ), we obtain the Galerkin equations We construct the N 2 × N 2 linear system for the unknown coefficients,ψ n m resulting from (31) evaluated for n = 0, · · · , N −1 with corresponding values of m . To compute the inner products, Y n m , K [Y nm ] and Y n m , F , we use the product Gaussian quadrature rule for spherical integrals [42]. This corresponds to approximate the integral with respect to ϕ using N Gauss-Legendre quadrature points, and the integral with respect to θ using a 2N Periodic Trapezoid Rule points. One can proceed as in the three-step method (see Section 4.1.2, and [26] for more details), by adding a rotation of the local coordinate system so that x * corresponds to the north pole, and by using the N Gauss-Legendre quadrature points mapped to (0, π) and not (−1, 1). For (12) we have ∂ ny G L (θ , ϕ , θ, ϕ)J(θ, ϕ) sin(θ)Y nm (θ, ϕ)dθdϕ.
C.2 Proof of Proposition 2 In this section we derive (17). Given v solution of Laplace's equation in D ⊂ R d , d = 2, 3, and for x ∈ E we write x = x * + n x * , with x * ∈ ∂D. Then we write (7)  The last term vanishes using (1) then one obtains (17).

C.3 Proof of Propositions 3, 4
In this section we derive (23), (26). Given v solution of the Helmholtz equation in D ⊂ R d , d = 2, 3, and for x ∈ E we write x = x * + n x * , with x * ∈ ∂D. Then we write (19) as:  (1), the third term vanishes, then one obtains (23). One proceeds similarly starting with (21): one can show that the layer potentials in (21) correspond to (32) for x = x * ∈ ∂D. Finally, (1) gives that the third term boils down to − 1 2 µ(x * )v(x * ), which finishes the proof.