Dipartimento di Matematica

Similar documents
CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

Fast and accurate methods for the discretization of singular integral operators given on surfaces

Numerical Integration of Functions with Endpoint Singularities and/or Complex Poles in 3D Galerkin Boundary Element Methods

which arises when we compute the orthogonal projection of a vector y in a subspace with an orthogonal basis. Hence assume that P y = A ij = x j, x i

Contents. MATH 32B-2 (18W) (L) G. Liu / (TA) A. Zhou Calculus of Several Variables. 1 Multiple Integrals 3. 2 Vector Fields 9

Properties of Transformations

(x 3)(x + 5) = (x 3)(x 1) = x + 5. sin 2 x e ax bx 1 = 1 2. lim

A Brief Outline of Math 355

Midterm for Introduction to Numerical Analysis I, AMSC/CMSC 466, on 10/29/2015

A note on multivariate Gauss-Hermite quadrature

you expect to encounter difficulties when trying to solve A x = b? 4. A composite quadrature rule has error associated with it in the following form

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

AMS 209, Fall 2015 Final Project Type A Numerical Linear Algebra: Gaussian Elimination with Pivoting for Solving Linear Systems

Elementary Linear Algebra

Numerical Integration for Multivariable. October Abstract. We consider the numerical integration of functions with point singularities over

1 Integration in many variables.

8.3 Partial Fraction Decomposition

A PLANAR SOBOLEV EXTENSION THEOREM FOR PIECEWISE LINEAR HOMEOMORPHISMS

Topic 4 Notes Jeremy Orloff

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

FINITE ELEMENT METHOD: APPROXIMATE SOLUTIONS

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

3. Numerical integration

The 3 dimensional Schrödinger Equation

Lectures 9-10: Polynomial and piecewise polynomial interpolation

Numerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration.

Solutions for the Practice Final - Math 23B, 2016

Tangent spaces, normals and extrema

Week 2 Techniques of Integration

Scientific Computing: An Introductory Survey

Newtonian Mechanics. Chapter Classical space-time

Section 6.6 Gaussian Quadrature

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

Algebra II. Paulius Drungilas and Jonas Jankauskas

April 15 Math 2335 sec 001 Spring 2014

PURE MATHEMATICS AM 27

MTH4101 CALCULUS II REVISION NOTES. 1. COMPLEX NUMBERS (Thomas Appendix 7 + lecture notes) ax 2 + bx + c = 0. x = b ± b 2 4ac 2a. i = 1.

Ch. 03 Numerical Quadrature. Andrea Mignone Physics Department, University of Torino AA

MATH 205C: STATIONARY PHASE LEMMA

Systems of Linear ODEs

The iterated sinh transformation

10550 PRACTICE FINAL EXAM SOLUTIONS. x 2 4. x 2 x 2 5x +6 = lim x +2. x 2 x 3 = 4 1 = 4.

The purpose of this lecture is to present a few applications of conformal mappings in problems which arise in physics and engineering.

APPENDIX A. Background Mathematics. A.1 Linear Algebra. Vector algebra. Let x denote the n-dimensional column vector with components x 1 x 2.

for all subintervals I J. If the same is true for the dyadic subintervals I D J only, we will write ϕ BMO d (J). In fact, the following is true

The Convergence of Mimetic Discretization

Lecture 9 Approximations of Laplace s Equation, Finite Element Method. Mathématiques appliquées (MATH0504-1) B. Dewals, C.

Physics 251 Solution Set 1 Spring 2017

Stabilization and Acceleration of Algebraic Multigrid Method

Spherical Coordinates and Legendre Functions

MAC2313 Final A. (5 pts) 1. How many of the following are necessarily true? i. The vector field F = 2x + 3y, 3x 5y is conservative.

Preliminary Exam 2016 Solutions to Morning Exam

Solutions to Dynamical Systems 2010 exam. Each question is worth 25 marks.

Scientific Computing

ASTR 320: Solutions to Problem Set 2

Vector Spaces. Vector space, ν, over the field of complex numbers, C, is a set of elements a, b,..., satisfying the following axioms.

(x 3)(x + 5) = (x 3)(x 1) = x + 5

GRE Math Subject Test #5 Solutions.

Mathematical Methods wk 2: Linear Operators

Sydney University Mathematical Society Problems Competition Solutions.

HIGH ORDER METHODS FOR WEAKLY SINGULAR INTEGRAL EQUATIONS WITH NONSMOOTH INPUT FUNCTIONS

Solving the 3D Laplace Equation by Meshless Collocation via Harmonic Kernels

CS 257: Numerical Methods

Mathematics 104 Fall Term 2006 Solutions to Final Exam. sin(ln t) dt = e x sin(x) dx.

MTH Linear Algebra. Study Guide. Dr. Tony Yee Department of Mathematics and Information Technology The Hong Kong Institute of Education

Simple Examples on Rectangular Domains

Structural Aspects of Numerical Loop Calculus

BTL What is the value of m if the vector is solenoidal. BTL What is the value of a, b, c if the vector may be irrotational.

Lecture 1 - Vectors. A Puzzle... Introduction. Vectors: The quest begins! TA s Information. Vectors

Bohr & Wheeler Fission Theory Calculation 4 March 2009

Invariants and Symmetry

Numerical Methods for Inverse Kinematics

Representation theory and quantum mechanics tutorial Spin and the hydrogen atom

Math The Laplacian. 1 Green s Identities, Fundamental Solution

Domains of analyticity for response solutions in strongly dissipative forced systems

SYMPLECTIC GEOMETRY: LECTURE 5

1. General Vector Spaces

Partial Fractions. June 27, In this section, we will learn to integrate another class of functions: the rational functions.

Dot Products. K. Behrend. April 3, Abstract A short review of some basic facts on the dot product. Projections. The spectral theorem.

Stability of Feedback Solutions for Infinite Horizon Noncooperative Differential Games

Lecture 4: Numerical solution of ordinary differential equations

51. General Surface Integrals

A Gaussian integral with a purely imaginary argument

Global Existence of Large BV Solutions in a Model of Granular Flow

HW2 Solutions

Mathematical Methods for Physics

2. The Schrödinger equation for one-particle problems. 5. Atoms and the periodic table of chemical elements

Numerical Analysis of Electromagnetic Fields

Change Of Variable Theorem: Multiple Dimensions

Position and orientation of rigid bodies

Practice Exam. 2x 1 + 4x 2 + 2x 3 = 4 x 1 + 2x 2 + 3x 3 = 1 2x 1 + 3x 2 + 4x 3 = 5

homogeneous 71 hyperplane 10 hyperplane 34 hyperplane 69 identity map 171 identity map 186 identity map 206 identity matrix 110 identity matrix 45

Linear Algebra Massoud Malek

Fact: Every matrix transformation is a linear transformation, and vice versa.

20 The Hydrogen Atom. Ze2 r R (20.1) H( r, R) = h2 2m 2 r h2 2M 2 R

Quaternion Cubic Spline

MTH739U/P: Topics in Scientific Computing Autumn 2016 Week 6

Contravariant and Covariant as Transforms

INTRODUCTION TO FINITE ELEMENT METHODS

1 Assignment 1: Nonlinear dynamics (due September

Transcription:

Dipartimento di Matematica L. SCUDERI ON THE COMPUTATION OF NEARLY SINGULAR INTEGRALS IN 3D BEM COLLOCATION Rapporto interno N. 14, giugno 2006 Politecnico di Torino Corso Duca degli Abruzzi, 24-10129 Torino-Italia

On the computation of nearly singular integrals in 3D BEM collocation Letizia Scuderi Abstract In this paper we propose an efficient strategy to compute nearly singular integrals over plane triangles in R 3, arising in BEM collocation. The strategy is based on a proper use of various nonlinear transformations, which smooth, or move away or quite eliminate all the singularities close to the domain of integration. We will deal with singularities of the form 1/r, 1/r 2 and 1/r 3, being r = x y the distance between a near observation point x and a point y of a triangular element. Extensive numerical tests show that the approach here proposed is highly efficient and competitive. KEY WORDS: singular integrals; numerical quadrature; boundary element method 1 Introduction In the boundary integral equation methods for a linear partial differential equation Lu = 0, the fundamental solution G of L plays a fundamental role. For Laplace s equation u = 0 over a domain Ω R 3 the fundamental solution G is given by G L (x, y) := 1 1 4π x y, x, y R3 ; for the Helmholtz equation u + k 2 u = 0, where k is the wave number (in particular k = 2π/λ, being λ the wavelength of the electromagnetic radiation) the fundamental solution G is G H (x, y) := 1 4π exp ( ik x y ), x, y R 3, x y with i := 1. We explicitly remark that for static problems, i.e. for k = 0, G H G L. According to the single-layer or double-layer potential representation used for the solution This work was supported by the Ministero dell Università e della Ricerca Scientifica e Tecnologica of Italy. Dipartimento di Matematica, Politecnico di Torino, Corso Duca degli Abruzzi 24, 10129 Torino, Italy. letizia.scuderi@polito.it 1

G, there are two possibilities to transform the differential equation of a given Dirichlet boundary value problem into an integral equation, and the following two different integral kernels (1.1) K 0 (x, y) = G(x, y), K 1 (x, y) = G(x, y) n y are involved respectively. In (1.1) G(x, y)/ n y denotes the normal derivative of the solution with respect to y. By assuming that the bounded domain Ω may be approximated by a polytope whose boundary Γ approximates Ω, the resulting integral equation is defined on Γ. Since the faces of the polytope are polygons, we can assume that Γ consists of plane triangular pieces. Therefore in 3D boundary element method a key issue is the efficient and fast computation of integrals of the form (1.2) K(x, y)p(y) dy, where K(x, y) is one of the kernel functions in (1.1) and p(y) restricted to is a polynomial in y, e.g. a linear function on. In this paper we will assume that the observation point x is outside the integration domain, but very close to it, i.e. we deal with the so-called nearly singular integrals, which arise massively in BEM collocation. Typically the number of such integrals, which have to be evaluated for an N N system matrix, increases quadratically in N. Taking into account that the singular element integrals (i.e. those belonging to the main diagonal of the matrix) are only O(N), the efficiency of the BEM is greatly dependent on the accurate and efficient computation of the nearly singular boundary integrals. Taking into account that for G(x, y) = G L (x, y) and G(x, y) = G H (x, y) we have (1.3) K 1 (x, y) = K1 L (x, y) :=< n y, y G L (x, y) >= 1 < n y, x y > K 1 (x, y) = K H 1 (x, y) := 1 4π ( 1 x y 3 + 4π ik x y 2 respectively, the integral (1.2) involves integrals of the form f(x, x y ) (1.4) I := p(y) dy, x y l, x y ) 3 exp ( ik x y ) < n y, x y > where l = 1 if in (1.2) K = K 0, l = 3 if K = K1 L and l = 2, 3 if K = K1 H, and f is a smooth function depending on x y but it is not zero at x = y, so that l describes the order of the singularity of the integrand. Indeed, since integrals (1.4) are invariant under rotation and translation, the Cartesian co-ordinates system (t 1, t 2, t 3 ) in R 3 can be chosen such that the triangle lies in t 1, t 2 -plane and x has co-ordinates (0, 0, t 3 ) = t 3 n, being n = (0, 0, 1) T. From this configuration it immediately follows that < n y, x y > is constant. Therefore, in (1.4) f is equal to a constant or to a constant multiplied by exp ( ik x y ). If f is constant, then the computation of I can be partly or completely performed analytically; 2

otherwise it is necessary to proceed by numerical quadrature. Although x in (1.4) lies outside and, hence, the integrand function of I is regular, the computation of the nearly singular integrals is considered by some users the most difficult case. Indeed standard methods like Gauss formulae are less and less accurate as the distance of the poles of the integrand function from the domain of integration becomes smaller and smaller ([1], p. 312). Therefore, even if the integrands are regular, they require a large number of quadrature nodes to provide accurate enough results. In the literature this problem has been faced by using different strategies. Whenever possible, analytic integration is considered. However this approach may yield to strongly unstable formulae and needs a huge number of functional evaluations. Moreover, the analytic integration is ruled out when having curved triangles. Another type of strategy, proposed for the computation of the nearly singular integrals, is based on an adaptive element subdivision ([9], [11]). However by proceeding with subdivisions of the quasi singular element into a certain number of subelements, the highest degree of the polynomial, which can be integrated exactly, decreases drastically with respect to the total number of nodes. For this reason, in [12] it was considered a different approach based on a cubic variable transformation for each of the two variables describing the element, which automatically lumps the points towards the singularity. Variable transformations have been considered also in [2], [4]-[7], [10], in order to weaken or completely eliminate the nearly singularity, before applying Gauss quadrature. In [6], [7] (see also [5]) a variable transformation method is proposed for curved triangles; after introducing the local polar co-ordinates, it employs a transformation for the radial variable and, if the projection of the observation point on the element is close to an edge of this latter, another one for the angular variable. In [4] (see also [3]) the authors also use local polar co-ordinates, performing the inner integrals analytically and the outer integral by Gauss quadrature. Finally, in [2], [10] the authors consider planar triangles and, after introducing a proper change of variable which eliminates the nearly singular term in the inner integral, proceed by applying a Gauss quadrature to compute the (transformed) inner and the outer integral. However, in no one of the above cited papers where variable transformation methods are proposed, the authors take into account of the possible new nearly singularities arising from their previous changes of variable. Therefore, to reach a good accuracy they have to use Gauss quadrature rules with a large number of nodes. In this paper we propose a new variable transformation method, which takes into account of the original nearly singularities and of all the new singularities of the transformed integrand. To this aim for the inner integral we use the transformations considered in [6] and in [2], and for the outer integral, and possibly again for the inner, a polynomial transformation that we have already used in [14] (see also [13]). More precisely, we compute nearly singular integrals defined over planar triangles, by using first the local polar co-ordinates and then introducing in the inner integral a nonlinear transformation which eliminates exactly the nearly singularity. However, as we shall see, this is still not exhaustive because this manipulation gives rise to other real or complex singularities in the integrand itself or in its derivatives, which are at the boundary or outside the domain of integration but very close to it. Therefore, the computation of the inner and the outer integral by means of standard quadrature formulae could turn out to be fairly expensive. 3

We overcome this drawback by means of some proper changes of variable that, taking into account of the position of the nearly singularity, eliminate or move this latter away from the interval of integration. In this way, we obtain a very good accuracy by means of a Gauss-Legendre formula with a number of quadrature nodes significantly smaller than that used in [2], [6], [10]. Extensive numerical tests will emphasize the efficiency of our approach. We believe that it can handle efficiently also curved triangles; to this end we could start in a way similar to [6] and then proceed by introducing our transformations before applying the Gauss-Legendre quadrature rule. However, the transformations that in the case of plane triangles completely eliminate the nearly singularity due to the term 1/ x y l, l = 1, 2, 3, in the case of curved triangles can only weakener it, because of the previous introduction of the parametric representation of the curved surface on which lies the triangular element. Curved triangles, together with the computation of the nearly singular integrals arising in the Galerkin BEM, will be object of our next research. 2 The problem setting Since the triangle Γ is generally in an arbitrary position in the space R 3, we begin the treatment of the integral (1.4) by describing a transformation which maps the generic configuration of x and into the standard configuration defined below. Let us describe x by the Cartesian co-ordinates x = (x 1, x 2, x 3 ) T and denote the vertices of by d 1, d 2, d 3. By using the orthonormal basis (2.1) z 1 := d2 d 1 d 2 d 1, z3 := (d2 d 1 ) (d 3 d 1 ) (d 2 d 1 ) (d 3 d 1 ), z2 := z 3 z 1, we define the following affine transformation y t = (t 1, t 2, t 3 ) T : (2.2) t = Ay b or y = A T (t + b) with A := (z 1, z 2, z 3 ) T, b = (z 1 ) T x (z 2 ) T x (z 3 ) T d 1 which brings the general configuration into a standard one having the following properties: i) the transformed triangle T lies in the plane t 3 = 0 (this means that if t T, then t = (t 1, t 2, 0) T ); ii) the transformed observation point s := Ax b lies on the t 3 -axis (this means that s = (0, 0, c) T, c = (z 3 ) T (x d 1 ) R)., 4

By taking into account that the 3 3 matrix A is orthogonal and introducing the above transformation in (1.4), we obtain f(x, A(x y) ) f(x, Ax (t + b) ) I = p(y) dy = p(a T (t + b)) dt A(x y) (2.3) l T Ax (t + b) l g(s, s t ) = N(t) dt s t l T where s = (0, 0, c) T, t = (t 1, t 2, 0) T and g(s, s t ) := f(a T (s + b), s t ), N(t) := p(a T (t + b)). By recalling that the expression of f contains the scalar product < n y, x y > when in (1.2) K = K 1 (see (1.3)), now we examine how this latter changes after the introduction of the orthogonal transformation (2.2). By taking into account that orthogonal transformations of R n preserve angles between lines and that is a plane triangle, we have n y = n and < n, x y >=< An, A(x y) >=< n T, s t >= c. Therefore, from (1.2)-(1.4) it follows that g(s, s t ) in (2.3) is reduced to a constant or a constant multiplied by exp( ik s t ). More precisely, g(s, s t ) = 1/4π if in (1.2) K = G L, g(s, s t ) = c/4π if K = K1 L, g(s, s t ) = exp( ik s t )/4π if K = G H, g(s, s t ) = c exp( ik s t )/4π if K coincides with the first term of K1 H and, finally, g(s, s t ) = i k c exp( ik s t )/4π if K coincides with the second term of K1 H. Let us denote by v 0 = (0, 0, 0) T the projection of s on the t 3 = 0 plane and the vertices v 1, v 2, v 3 of T by the Cartesian co-ordinates. The indexing of the vertices v 1, v 2, v 3 will be chosen according to the orientation of Γ, i.e. z 3 defined in (2.1) is the outer normal of Γ on. The triangle T oriented in this way will be written as T = [v 1, v 2, v 3 ]. Taking into account of the orientation, for any integrand F, defined on all the domains involved, we can use the following formula F (t) dt = F (t) dt + F (t) dt + F (t) dt, [v 1,v 2,v 3 ] [v 0,v 1,v 2 ] [v 0,v 2,v 3 ] [v 0,v 3,v 1 ] where each integral is defined over an oriented triangle. For example, we can assume that the orientation is positive (negative), if the vertices of the triangle are disposed in the anticlockwise (clockwise) sense. By applying the above formula we split the integral over the triangle T = [v 1, v 2, v 3 ] into a sum of three integrals over triangles containing the origin as a corner point, i.e. I = I 1,2 + I 2,3 + I 3,1 where (2.4) I i,j := [v 0,v i,v j ] g(s, s t ) s t l N(t) dt. After having reduced the original problem to the computation of the integrals I i,j, we introduce in (2.4) the polar co-ordinates t 1 = ρ cos(ϑ), ϑ min ϑ ϑ max, t 2 = ρ sin(ϑ), 0 ρ R(ϑ), 5

where for the triangle represented in Figure 1 and for v i = (v1, i v2, i 0) T and v j = (v1, j v2, j 0) T, the limits of integration are ( ) v j 2 arctan if v j 1 0 ϑ min = ϑ (i,j) min := ϑ max = ϑ (i,j) max := π 2 arctan π 2 v j 1 ( ) vi 2 v1 i otherwise, if v i 1 0 otherwise. Figure 1: The triangle [v 0, v i, v j ]. Moreover, sin(ϑ) a (i,j) cos(ϑ) (2.5) R(ϑ) = R (i,j) v1 i (ϑ) := cos(ϑ) b (i,j) sin(ϑ) b (i,j) if v j 1 v i 1 if v j 1 = v i 1 if v j 2 = v i 2 where We then rewrite I i,j in (2.4) as follows a (i,j) = vj 2 v2 i v j, b (i,j) = vj 1v2 i v2v j 1 i 1 v1 i v j. 1 v1 i (2.6) I i,j = ϑmax ϑ min R(ϑ) g(c, ρ dϑ 2 + c 2 ) 0 ( N(ρ cos(ϑ), ρ sin(ϑ)) ρ dρ. ρ 2 + c 2 ) l 6

As basis function N, we can consider local Lagrange basis for polynomials of degree p = 1, 2,.... Example 1 Recalling that the Lagrange linear basis functions in the case of the unit triangle σ = [(0, 0) T, (1, 0) T, (0, 1) T ] are given by N σ 1 ( t 1, t 2 ) = t 1, N σ 2 ( t 1, t 2 ) = t 2, N σ 3 ( t 1, t 2 ) = 1 t 1 t 2, by using the affine invertible mapping t = Bt with ( v j 1 v1 B = i v j 2 v2 i we deduce the corresponding basis function for the triangle [v 0, v i, v j ] N 1 (t 1, t 2 ) = d(v i 2t 1 v i 1t 2 ), N 2 (t 1, t 2 ) = d(v j 1t 2 v j 2t 1 ), ), N 3 (t 1, t 2 ) = 1 d[(v i 2 v j 2)t 1 (v i 1 v j 1)t 2 ], where d = 1/det(B). Therefore in the linear case we have to compute the following integrals (2.7) I 1 i,j := I 2 i,j := I 3 i,j := ϑmax ϑ min ϑmax ϑ min ϑmax ϑ min R(ϑ) dϑ 0 cos(ϑ) dϑ sin(ϑ) dϑ g(c, ρ 2 + c 2 ) ( ρ dρ, ρ 2 + c 2 ) l R(ϑ) 0 R(ϑ) 0 g(c, ρ 2 + c 2 ) ( ρ 2 + c 2 ) l ρ 2 dρ, g(c, ρ 2 + c 2 ) ( ρ 2 + c 2 ) l ρ 2 dρ. In the following two subsections we will describe the numerical strategy adopted for the efficient computation of the inner and the outer integral of (2.6), respectively. 2.1 On the computation of the inner integral in (2.6) In this subsection we will focus our attention on the computation of the inner integral in (2.6). In the following treatment we will consider three different cases according to the type of singularity and, within them, we will distinguish the case of g equal to a constant, for example g 1, and the case of g function of x and r := x y. This because the above cases are treated by means of different and tailored strategies. Therefore, by taking 7

(1.4), (2.3) and (2.4) into account, we will consider singularities of type 1/r, 1/r 2 and 1/r 3. In particular, we will deal with the following integrals (2.8) S p,l (ϑ, c) := if g 1 in (2.6), and (2.9) D p,l (ϑ, c) := R(ϑ) 0 R(ϑ) 0 ρ p ( dρ, p 1, l = 1, 2, 3, ρ 2 + c 2 ) l ρ p ( ρ 2 + c 2 ) l g(c, ρ 2 + c 2 ) dρ, p 1, l = 1, 2, 3, if g 1. The integrals S p,l can be computed by means of a recursion formula, which can be easily derived by integration by parts. Explicit formulae to evaluate the integrals S p,l for every p and l are also given in [4]. The integrals D p,l defined in (2.9) must be computed numerically. But a straightforward application to the integral D p,l of a Gauss-Legendre quadrature rule gives a poor accuracy because of the nearly singularity associated with the 1/( ρ 2 + c 2 ) l term. We note explicitly that the accuracy worsens as c decreases, because the smaller c is, the closer the singularity is to the interval of integration. Therefore, by following the idea developed in [6] and in the recent paper [2] (see also [10]), to make the Gauss formula more efficient, as described below, we first introduce a proper change of variable to eliminate the above-mentioned nearly singularity. Then, if there are no other singularities arising from the previous transformation that need to be weakened, we apply to the transformed integral a Gauss- Legendre quadrature rule. 1/r singularity For the computation of the integral S p,1 we use the following formula ( R(ϑ) + ) [R(ϑ)] S 0,1 (ϑ, c) = log 2 + c 2, c (2.10) S 1,1 (ϑ, c) = [R(ϑ)] 2 + c 2 c, S p,1 (ϑ, c) = [R(ϑ)]p 1 p [R(ϑ)]2 + c 2 p 1 p c2 S p 2,1 (ϑ, c), p 2. For the computation of the integral D p,1, before applying a Gauss-Legendre quadrature rule, we introduce the following change of variable ( ) ρ 1 (2.11) ρ = c sinh(x) x = asinh, dx = c ρ2 + c dρ, 2 to cancel the nearly singular term 1/ ρ 2 + c 2 in D p,1. Hence we have (2.12) D p,1 (ϑ, c) = asinh( R(ϑ) c ) 0 ( [ c sinh(x)] p g c, c ) [sinh(x)] 2 + 1 dx. 8

As we can see in Tables 9 and 10, the computation of (2.12) by means of a Gauss-Legendre rule is less and less accurate as c becomes smaller and smaller. Therefore, when c is very small, for example c < 0.01, we suggest the use of the following different change of variable (2.13) ρ = x 2 c 2 x = ρ 2 + c 2, dx = ρ ρ2 + c 2 dρ, which, similarly to (2.11), allows to eliminate the nearly singular term 1/ ρ 2 + c 2 through the Jacobian and, on the contrary of (2.11), allows to obtain a good accuracy by means of the n-point Gauss-Legendre rule already for small values of n. We then have [R(ϑ)] 2 +c 2 ( ) p 1 (2.14) D p,1 (ϑ, c) = x2 c 2 g (c, x) dx. c As we can see, when p is even, the change of variable (2.13), unlike (2.11), introduces a singularity at c in the derivatives of the integrand function and this makes the computation of the transformed integral by means of a Gauss-Legendre quadrature formula fairly expensive. For this reason, before applying a quadrature rule we introduce a further change of variable given by (2.15) x = c + t q, q > 1 t = (x c ) 1/ q. By choosing q even, (2.15) allows to eliminate exactly the above mentioned singularity, otherwise it only allows to make the transformed integrand function smoother than the original one. By introducing (2.15) in (2.14), we have (2.16) D p,1 (ϑ, c) = ( [R(ϑ)] 2 +c 2 c ) 1/ q 0 qt q 1 ( t q (t 2 + 2 c )) p 1 g (c, c + t q ) dt. In the numerical tests we choose q = 2 when c = 0.1, 0.01 and q = 4 when c = 0.001, 0.0001. For c > 0.001 the changes (2.11) and (2.13) are quite equivalent, while for c 0.001 (2.13) (possibly combined with (2.15)) is more effective than (2.11). As we shall see in Subsection 2.2, changes of variable of type (2.15) play a fundamental role in the computation of the outer integral in (2.6). 1/r 2 singularity For the computation of the integral S p,2 we use the following formula ( ) [R(ϑ)]2 + c S 1,2 (ϑ, c) = log 2, (2.17) c ( R(ϑ) S 2,2 (ϑ, c) = R(ϑ) c atan c S p,2 (ϑ, c) = [R(ϑ)]p 1 p 1 ), c 2 S p 2,1 (ϑ, c), p 3. 9

For the computation of the integral D p,2, before proceeding numerically we introduce the following change of variable ( ) x (2.18) ρ = exp c c 2 x = c log(ρ 2 + c 2 ), dx = 2 c ρ ρ 2 + c dρ 2 to remove the singularity associated with the term 1/(ρ 2 + c 2 ). However, in this way the derivatives of the transformed integrand function are singular exactly at an endpoint of the corresponding interval of integration. Indeed, we have (2.19) D p,2 (ϑ, c) = c log([r(ϑ)] 2 +c 2 ) c log(c 2 ) 1 2 c ( exp ( ) ) p 1 ( ( )) x x c c 2 g c, exp dx. 2 c Therefore, when p is even we have to smooth the singularity of the integrand function at c log(c 2 ); to this end we introduce the following change of variable (2.20) x = c log(c 2 ) + t q, q > 1 t = ( x c log(c 2 ) ) 1/ q and we get (2.21) ( c log([r(ϑ)] 2 +c 2 ) c log(c 2 )) 1/ q D p,2 (ϑ, c) = 0 2 c ( ( )) c log(c 2 ) + t q g c, exp dt. 2 c qt q 1 ( ( ) ) p 1 c log(c2 ) + exp t q c c 2 In the numerical tests, as smoothing exponent of the polynomial transformation (2.20), we choose q = 2 and, for improving further on the accuracy, we also split the interval of integration of (2.21) about its midpoint. 1/r 3 singularity For the computation of the integral S p,3 we use the following formula S 1,3 (ϑ, c) = 1 c 1 [R(ϑ)]2 + c, 2 ( R(ϑ) (2.22) S 2,3 (ϑ, c) = [R(ϑ)]2 + c + log R(ϑ) + ) [R(ϑ)] 2 + c 2, 2 c S p,3 (ϑ, c) = [R(ϑ)] p 1 (p 2) [R(ϑ)] 2 + c 2 p 1 p 2 c2 S p 2,3 (ϑ, c), p 3. When l = 3 the computation of the integral D p,3 in (2.9) is a little more involved than the integrals D p,1 and D p,2. To remove the nearly singularity associated with the term 1/(ρ 2 + c 2 ) 3/2 we introduce the following change of variable ( c ) 2 (2.23) ρ = c x 2 x = c ρ2 + c, dx = c ρ dρ 2 (ρ 2 + c 2 ) 3/2 10

and we have (2.24) D p,3 (ϑ, c) = 1 c p 2 c [R(ϑ)] 2 +c 2 ( 1 x 2 x ) p 1 ( g c, c ) dx. x Notice that in this way the transformed integrand function must be smoothed for p even at 1 where the derivatives of 1 x 2 are singular and at 0, which is close to c / [R(ϑ)] 2 + c 2 for c small, where 1/x is singular. We face the above mentioned singularities separately, and therefore we first rewrite the integral as sum of two integrals over the intervals of integration [ c / [R(ϑ)] 2 + c 2, ( c / [R(ϑ)] 2 + c 2 +1)/2] and [( c / [R(ϑ)] 2 + c 2 +1)/2, 1] and then we introduce in the first integral the change of variable x = t q 1 and in the second integral the change x = 1 t q 2, with q 1, q 2 > 1. Thus, we get (2.25) D p,3 (ϑ, c) = [( ) ] 1/ q1 c [R(ϑ)] 2 +c 2 +1 /2 ( ) 1/ q1 c p 2 q t q 1 1 1 c [R(ϑ)] 2 +c 2 [ ( ) ] 1/ q2 c 1 [R(ϑ)] + 2 +c 2 +1 /2 c p 2 q t q 2 1 2 0 ( 1 t 2 q 1 t q 1 ( t q 2 2 1 t q 2 ) p 1 ( g c, c ) t q 1 ) p 1 g ( c, dt ) c dt. 1 t q 2 Notice that in the first integral the change of variable x = t q 1 with a large q 1 moves the left endpoint of the interval of integration away from the singularity at zero; in the second integral the change x = 1 t q 2, with q 2 even, completely eliminates the singularity at 1. In the numerical tests we will choose q 1 = 3 and q 2 = 2 when c = 0.1 and q 1 = 6 and q 2 = 4 when c = 0.01, 0.001, 0.0001. These latter choices are purely experimental and allow to reach a good enough accuracy with a few quadrature nodes. 2.2 On the computation of the outer integral in (2.6) In this subsection we will focus our attention to the computation of the outer integral in (2.6). In particular, we will consider the following integrals (2.26) O S := and (2.27) O D := ϑmax ϑ min ϑmax ϑ min S p,ϑ (ϑ, c)s(ϑ) dϑ D p,ϑ (ϑ, c)s(ϑ) dϑ, where s(ϑ) is a smooth function. For instance, if we consider the linear basis functions of Example 1, then p = 1, 2 and s(ϑ) = 1, sin(ϑ), cos(ϑ) (see (2.7)). Generally for the computation of the integrals (2.26) and (2.27) the straightforward application of the Gauss-Legendre quadrature rule (see [2], [4], [10]) is used. However this 11

might be unsatisfactory because of the presence of singularities off but close to the interval of integration, which may affect adversely the accuracy of a standard quadrature rule. Indeed, as we have already remarked, this latter could request too many quadrature nodes in order to reach a good accuracy, and this fact is not acceptable for the collocation method, and even more so far the Galerkin method, where many integrals must be computed or approximated. Since in our case it is possible to determine the location of the singularities, we have worked out a special approach to compute the above integrals by using a few quadrature nodes. It is based on proper changes of variable, possibly associated with a splitting of the interval of integration. From the expression of the functions S p,ϑ in (2.10), (2.17), (2.22) and of the upper limit of integration of the integrals D p,ϑ in (2.14) or (2.16), (2.21) and in (2.25), it follows that to compute accurately and efficiently the outer integral in (2.6), it is necessary to adopt a special strategy to compute, accurately and with a few quadrature nodes, the functions i) [R(ϑ)] p, ii) [R(ϑ)] p [R(ϑ)] 2 + c 2, iii) R(ϑ)R (ϑ)/([r(ϑ)] 2 + c 2 ), iv) [R(ϑ)] p / [R(ϑ)] 2 + c 2, with a non negative integer p. From (2.5) and (b (i,j) ) 2 + c 2 [sin(ϑ) a (i,j) cos(ϑ)] 2 if v j [sin(ϑ) a (i,j) cos(ϑ)] 2 1 v1 i (2.28) [R(ϑ)] 2 + c 2 (v i = 1) 2 + c 2 [cos(ϑ)] 2 if v j [cos(ϑ)] 2 1 = v1 i (b (i,j) ) 2 + c 2 [sin(ϑ)] 2 if v j [sin(ϑ)] 2 2 = v2 i it follows that the functions i)-iv) are singular at ϑ = atan(a (i,j) ) + mπ, m Z, in the case v j 1 v1, i at ϑ = π/2 + mπ in the case v j 1 = v1 i and at ϑ = mπ in the case v j 2 = v2. i A simple computation shows that ϑ represents also the real part of the complex and conjugate zeros of the analytic function at the numerators of (2.28). More precisely, we have that the function (b (i,j) ) 2 + c 2 [sin(ϑ) a (i,j) cos(ϑ)] 2 is zero at ϑ = atan(a (i,j) ) + mπ ± 1/4i log((1 β) 2 + α 2 )/(1 + β) 2 + α 2 )), where α = a (i,j) c 2 /((b (i,j) ) 2 + c 2 ) and β = b (i,j) (b (i,j) ) 2 + c 2 + (a (i,j) c) 2 /((b (i,j) ) 2 + c 2 ), the function (v1) i 2 + c 2 [cos(ϑ)] 2 vanishes at ϑ = π/2 + mπ ± i log(v1/c i + 1 + (v1/c) i 2 ) and, finally, the function (b (i,j) ) 2 + c 2 [sin(ϑ)] 2 vanishes at ϑ = mπ ± i log(b (i,j) /c + 1 + (b (i,j) /c) 2 ). Hence we deduce that the functions i)-iv) have a singular behavior at the points above denoted with ϑ. When one of these points is close to the interval of integration, the above mentioned functions become large in their vicinity, thus reducing the accuracy of the numerical computation of the integral. In these cases we obtain a considerable improvement 12

of the behaviour of the integrand function in the interval of integration by introducing the following simple change of variable (2.29) ϑ = ϑ + t q, q > 1. Thanks to it the transformed integrand function need to be evaluated at fewer points than those requested by the computation of the original integral. Indeed, the transformation (2.29) offers the primary advantage of moving the singularity away from the interval of integration. Therefore, for the computation of the outer integral, when ϑ is close to the interval of integration we use the change of variable (2.29), with q = 3; this latter has turned out the best choice in the innumerable numerical tests done. We use (2.29) whenever the distance of ϑ (for some m Z) from the interval of integration is less than a certain value d. On the ground of the numerical tests, we have set d = 0.3. Notice that when ϑ max ϑ min tends to π, there is a singular behavior close to both of the endpoints of the interval of integration. In this case we rewrite the integral as sum of two integrals, the first over [ϑ min, (ϑ min + ϑ max )/2] and the second over [(ϑ min + ϑ max )/2, ϑ max ], and then we introduce in each of them the change (2.29) with the respective ϑ. Very often we apply a splitting of the interval of integration to reach a good enough accuracy by few quadrature nodes. More precisely, in our algorithm we proceed as follows: we first check if ϑ min is close to ϑ for some m; if this is the case and if ϑ max ϑ min is less than a certain value a, we introduce (2.29) and then we apply a n-point Gauss-Legendre rule. Likewise to d, we have signed to a an experimental value and we have set a = 1.80. If (ϑ max ϑ min ) > a we first split the interval of integration by the midpoint (ϑ min + ϑ max )/2 and then we introduce (2.29) in the integral over [ϑ min, (ϑ min + ϑ max )/2] and, if ϑ max is close to ϑ for m = m + 1, also in the integral over [(ϑ min + ϑ max )/2, ϑ max ]. Successively, we apply the n-point Gauss-Legendre rule to both the integrals. In the case that ϑ min is not close to ϑ, we check if by chance ϑ max is close to ϑ for some m Z, and then we proceed as for ϑ min. In the case that none of the endpoints ϑ min and ϑ max are close to ϑ, we proceed by applying directly a n-point Gauss-Legendre rule. To show the efficacy of the change of variable (2.29) we use it in the computing of the following integrals (2.30) (2.31) 1 ε 1 ε [R(ϑ)] dϑ, R(ϑ) [R(ϑ)] 2 + c 2 dϑ, 1 R(ϑ)R (2.32) (ϑ) ε [R(ϑ)] 2 + c dϑ, 2 1 [R(ϑ)] p (2.33) [R(ϑ)]2 + c dϑ, 2 ε with R(ϑ) = b/ sin(ϑ) and varying ε; the constants b, c and p are specified in the caption of the corresponding Tables 1-5. In these tables the choice q = 1 corresponds to the straightforward application of the n-point Gauss-Legendre quadrature rule, without using 13

any transformation. In the columns q = 3 (q = 5) we report the relative errors obtained by introducing the change of variable ϑ = t 3 (ϑ = t 5 ). In Tables 1-3, where we report the relative errors for the integrals (2.30)-(2.32) respectively, the comparison q = 1 and q > 1 is striking: for the same value of n the relative errors for q > 1 are very much smaller than those for q = 1. Moreover, for q > 1 the accuracy increases very fast. Notice that for ε = 0.001 by choosing q = 5 the relative accuracy improves with respect to q = 3; however, bigger values of q give a sensible increase of the accuracy only when using higher order Gauss-Legendre quadrature rules. ε = 0.1 ε = 0.01 ε = 0.001 n q = 1 q = 3 q = 1 q = 3 q = 1 q = 3 q = 5 4 6.53E 03 3.11E 06 1.69E 01 4.43E 04 3.97E 01 6.70E 03 2.41E 04 6 4.92E 04 4.11E 09 7.98E 02 8.08E 06 2.99E 01 5.05E 04 3.01E 06 8 3.65E 05 5.35E 12 3.74E 02 1.46E 07 2.30E 01 3.74E 05 3.69E 08 10 2.68E 06 1.73E 02 2.65E 09 1.79E 01 2.75E 06 4.50E 10 12 1.97E 07 7.93E 03 8.59E 13 1.41E 01 2.02E 07 5.48E 12 14 1.44E 08 3.62E 03 1.11E 01 1.48E 08 6.70E 14 Table 1: Relative errors for the integral (2.30) with b = 0.1. ε = 0.1 ε = 0.01 ε = 0.001 n q = 1 q = 3 q = 1 q = 3 q = 1 q = 3 q = 5 4 6.01E 03 2.51E 06 1.62E 01 4.29E 04 3.86E 01 6.51E 03 1.97E 04 6 4.53E 04 4.77E 09 7.64E 02 7.75E 06 2.90E 01 4.90E 04 2.62E 06 8 3.35E 05 1.08E 11 3.57E 02 1.40E 07 2.23E 01 3.63E 05 4.81E 08 10 2.47E 06 2.50E 14 1.65E 02 2.53E 09 1.74E 01 2.67E 06 8.38E 11 12 1.81E 07 7.59E 03 4.57E 13 1.37E 01 1.96E 07 1.13E 11 14 1.32E 08 3.46E 03 1.08E 01 1.43E 08 4.36E 14 Table 2: Relative errors for the integral (2.31) with b = 0.1, c = 0.1. ε = 0.1 ε = 0.01 ε = 0.001 n q = 1 q = 3 q = 1 q = 3 q = 1 q = 3 q = 5 4 8.36E 03 1.75E 05 1.91E 01 4.87E 04 4.30E 01 7.17E 03 6.00E 05 6 6.30E 04 5.29E 08 9.00E 02 7.91E 06 3.23E 01 5.44E 04 1.38E 05 8 4.67E 05 3.87E 11 4.21E 02 1.61E 07 2.49E 01 4.05E 05 2.75E 07 10 3.43E 06 7.34E 13 1.95E 02 3.17E 09 1.94E 01 2.98E 06 3.58E 09 12 2.52E 07 8.94E 03 5.53E 11 1.52E 01 2.18E 07 1.38E 10 14 1.84E 08 4.08E 03 9.40E 13 1.20E 01 1.60E 08 9.45E 12 Table 3: Relative errors for the integral (2.32) with b = 0.1, c = 0.1. The complex poles are ϑ ±i 0.8814. When the singular behavior is mainly due to the presence of complex and conjugate poles ϑ close to the interval of integration, an improvement in accuracy of the n-point Gauss-Legendre rule can be also obtained by means of the following transformation (2.34) ϑ = R(ϑ ) + I(ϑ )sinh(t), where R(ϑ ) and I(ϑ ) denote the real and the imaginary part of ϑ, respectively. This transformation comes from that used in [8]. Notice that the Jacobian I(ϑ )cosh(t) of the transformation (2.34), unlike that of (2.29), is not zero but tends to zero at the nearly singular point as I(ϑ ) tends to zero, thus reducing the peaked nature of the integrand. 14

Moreover, unlike (2.29) the transformation (2.34) does not depend on an arbitrary parameter, even if sometimes we have found convenient to use (2.34) in the following form (2.35) ϑ = R(ϑ ) + q I(ϑ )sinh(t), where the real number q is chosen small properly. For example in Table 5, q = ε represents a better choice than q = 1, because in (2.33) for p = 1 the dominant nearly singularity arises from the term R(ϑ). Incidentally, we notice that the transformation (2.35) may be used also to improve the behavior of an integrand function with only a nearly real singularity ϑ, but in this case (2.35) must be rewritten as follows (2.36) ϑ = ϑ + q sinh(t). In Tables 4 and 5 we report a comparison of the transformations (2.29) and (2.35) in the computation of the integral (2.33). ε = 0.1 ε = 0.01 ε = 0.001 n q = 1 q = 3 q = 1 q = 1 q = 3 q = 1 q = 1 q = 5 q = 1 4 5.96E 04 4.22E 06 5.14E 08 2.23E 03 7.87E 05 1.09E 06 1.95E 03 1.43E 03 1.49E 06 6 9.05E 06 1.01E 07 1.52E 09 5.37E 04 7.89E 05 1.30E 08 7.59E 04 1.74E 05 1.58E 08 8 8.93E 07 1.64E 09 8.59E 12 2.21E 05 3.92E 06 1.49E 10 1.28E 06 1.27E 05 1.94E 10 10 5.97E 08 2.34E 11 4.45E 14 9.51E 06 2.81E 07 1.60E 12 1.52E 05 3.09E 06 2.23E 12 12 3.53E 10 3.14E 13 1.49E 07 3.44E 08 1.22E 14 7.26E 07 5.39E 07 2.06E 14 14 1.39E 10 1.79E 07 3.27E 10 2.95E 07 8.24E 08 Table 4: Relative errors for the integral (2.33) with b = 0.01, c = 0.1, p = 0. The complex poles are ϑ ±i 0.0998. ε = 0.1 ε = 0.01 ε = 0.001 n q = 1 q = 3 q = ε q = 1 q = 3 q = ε q = 1 q = 5 q = ε 4 6.01E 03 2.51E 06 3.38E 05 1.62E 01 4.29E 04 3.67E 04 3.86E 01 1.97E 04 1.53E 03 6 4.53E 04 4.77E 09 2.08E 07 7.64E 02 7.75E 06 1.35E 05 2.90E 01 2.62E 06 5.79E 05 8 3.35E 05 1.08E 11 1.38E 09 3.57E 02 1.40E 07 2.82E 07 2.23E 01 4.81E 08 3.93E 06 10 2.47E 06 2.48E 14 8.66E 12 1.65E 02 2.53E 09 9.22E 09 1.74E 01 8.38E 11 1.47E 07 12 1.81E 07 5.47E 14 7.59E 03 4.57E 11 2.00E 12 1.37E 01 1.13E 11 1.03E 08 14 1.32E 08 3.46E 03 8.24E 13 1.40E 13 1.08E 01 4.36E 14 3.79E 10 Table 5: Relative errors for the integral (2.33) with b = 0.1, c = 0.1, p = 1. The complex poles are ϑ ±i 0.8814. The numerical results show that by using the sinh transformation the accuracy increases especially when the integrand function have only complex poles very close to the interval of integration. However, the transformation (2.29) seems to be generally more effective. Finally, we remark that the numerical results obtained for the other two expressions of R(ϑ) (see (2.5)) are similar to those of Tables 1-5 and, for this reason, we do not report them. 3 Numerical tests In this last section we present some of the innumerable and various tests on the numerical approach proposed in Section 2. We first consider the case of an observation point x, 15

whose projection onto the plane defined by is within. Therefore, by introducing the transformation (2.2) we get a triangle T, which lies onto the plane t 3 = 0 and contains the projection v 0 = (0, 0, 0) T of the transformed point s of x. The triangle T is then split into three subtriangles about the projection v 0. The geometry of the splitting into subtriangles is shown in Figure 2, with varying x. 0.8 0.6 0.4 0.2 0 x=(0.1,0.89,0.1) T 0 0.2 0.4 0.6 0.8 1 2 3 0.6 0.4 0.2 0 0.2 x=(0.1,0.89,0.1) T 1 2 3 0.4 0.2 0 0.2 0.4 0.6 0.8 x=(0.1,0.89,0.1) T x=(0.1,0.89,0.1) T 0.4 0.2 1 2 3 0 0.2 1 2 3 0 0.4 0.2 0.6 0.4 0.8 0.4 0.2 0 0.2 0.4 0.6 0 0.2 0.4 0.6 0.8 Figure 2: The three subtriangles of the transformed triangle T of = [(0, 0, 0) T, (1, 0, 0) T, (0, 1, 0) T ], with varying x. Notice that, although the original triangle has a proper shape, the three subtriangles may have rather inconvenient shapes depending on the position of s. In such a case, the convergence of the direct use of the Gauss-Legendre quadrature may become extremely slow. For this reason we have worked out the new procedure described in Section 2; it performs very efficiently also on integrals over nearly degenerate subtriangles. To test in a meaningful way our numerical approach we consider the triangle = [(0, 0, 0) T, (1, 0, 0) T, (0, 1, 0) T ] and an observation point x whose projection on is close to the right angle of (x = (0.1, 0.1, c) T, c R), far away from the edges and the vertices of (x = (0.2, 0.4, c) T ) and close to an edge but far away from a vertex (x = (0.4, 0.49, c) T ) and, finally, close to an edge and to a vertex (x = (0.1, 0.89, c) T ). The real constant c represents the effective distance from ; we choose c = 0.1, 0.01, 0.001 even if values of c smaller than 0.001 are admissible. Indeed, in the case of 1/r singularity, for comparing our results with those obtained in [10] we consider c = 0.0001. By taking into account what has been remarked on the integral (1.4) in Section 1, we apply our approach 16

to the following integrals: (3.1) (3.2) (3.3) (3.4) 1 x y l dy y 1 x 1 x y l dy exp( ik x y ) x y l dy (y 1 x 1 ) exp( ik x y ) x y l dy, where x = (x 1, x 2, x 3 ) T, y = (y 1, y 2, y 3 ) T, l = 1, 2, 3 and in (3.3) and (3.4) k = 2π/λ with λ = 10. This latter choice is done to compare some of our results with those in [2] and in [10]. By using the transformation (2.2), where in our case A is the identity matrix of order 3 and b = (x 1, x 2, 0) T, and the splitting into subtriangles, each of the above integrals is rewritten as the sum of three integrals over the subtriangles depicted in Figure 2. Hence, we first introduce the polar co-ordinates in each of these latters and then the transformations, described in Subsections 2.1 and 2.2, into the inner and the outer integral, respectively. Notice that the inner integral of (3.1) and (3.2) can be evaluated analytically. In Table 6 we report a detailed description of the numerical computation of the inner and the outer integral in the case l = 1, according to our approach. INNER INTEGRAL OUTER INTEGRAL subtriangles of T subtriangle 1 of T subtriangle 2 of T subtriangle 3 of T x = (0.1, 0.1, c) T smoothing (q = 3) at the right n-point Gauss-Legendre smoothing (q = 3) at the left c = 0.1, 0.01, 0.001 analytical ((2.10)) endpoint with splitting endpoint with splitting x = (0.2, 0.4, c) T or numerical n-point Gauss-Legendre n-point Gauss-Legendre n-point Gauss-Legendre c = 0.1, 0.01, 0.001 ((2.12) or (2.16) with with splitting with splitting x = (0.4, 0.49, c) T q = 2 for c = 0.1, 0.01, n-point Gauss-Legendre smoothing (q = 3) at the n-point Gauss-Legendre c = 0.1, 0.01, 0.001 q = 4 for c = 0.001) endpoints with splitting x = (0.1, 0.89, c) T n-point Gauss-Legendre smoothing (q = 3) at the smoothing (q = 3) at the right c = 0.1, 0.01, 0.001 endpoints with splitting endpoint with splitting Table 6: The main details on the computation of the inner and outer integral, which arise from (3.1)-(3.4) with l = 1, according to our approach. In the cases l = 2 and l = 3 the computation of the inner integral varies according to its nearly singular term. More precisely, for l = 2 (l = 3) we proceed analytically by using (2.17) ((2.22)) or numerically by using (2.21) with q = 2 ((2.25) with q 1 = 3 and q 2 = 2 when c = 0.1 and q 1 = 6 and q 2 = 4 when c = 0.01, 0.001). On the contrary, in the cases l = 2 and l = 3 the computation of the outer integral is substantially unchanged. We consider only a variation in the cases l = 3 and x = (0.2, 0.4, c) T for the subtriangles 2 and 3; in those cases we do not split the interval of integration before applying the n- point Gauss-Legendre rule, since this splitting is useless. In the setting of our strategy, 17

in particular in the choice of the smoothing parameters q (or q 1, q 2 ) and q, our main aim has been that of obtaining a relative accuracy smaller than 10 5 by using the n-point Gauss-Legendre formula with n = 6. Very often and precisely, as already remarked in Subsection 2.2, when the length of the interval of integration is greater than 1.80, to achieve this objective we split the interval of integration about its midpoint and apply to each subinterval the n-point Gauss-Legendre rule. We prefer to split rather than use the 2n-point Gauss-Legendre rule for two reasons: the main one is that in this way, by halving the length of the interval of integration, the closeness of the complex poles is less adverse to the performance of a Gauss-Legendre rule and the secondary reason is to avoid the computation of the weights and nodes of the n-point and 2n-point Gauss-Legendre rules. As remarked in Subsection 2.1, the further change of variable depending on the parameter q (or q 1, q 2 in the case of 1/r 3 singularity) for the integrals D p,l is necessary whenever p is even and l = 1, 2 or p is even, l = 3 and an endpoint of the interval of integration is 1 or, finally, l = 3 and an endpoint of the interval of integration is close to 0. When no one of the above-mentioned cases happens, the above change is useless; however one could introduce all the same it by setting the smoothing parameter q (or q 1, q 2 ) equal to 1. Even if in this way the numerical results are slightly more accurate than those with q (or q 1, q 2 ) greater than 1, for simplicity we do not distinguish the various cases and we make only a choice for the smoothing parameter of the polynomial transformation of the outer integral, depending on the distance c. In each of the following Tables 7-16, we compare our approach, whose results are reported in the columns labelled at the top with q = 3, with the approach which uses only the transformation eliminating the nearly singular term in the inner integral. The numerical results of this latter are reported in the columns labelled with q = 1. To compare the approaches q = 1 and q = 3 in a fair way from the point of view of the total number of quadrature nodes required, in the case q = 1 we use the 2n-point Gauss-Legendre rule every time that in the case q = 3 we operate the splitting and apply the n-point Gauss- Legendre rule to each of the two resulting integrals. From this comparison, it appears that the smoothing strategy associated to the splitting outperforms the straightforward application of a Gauss-Legendre rule even if the latter uses twice the number of quadrature nodes. Our approach seems to be highly competitive especially when the projection of the observation point x is close to the boundary of the triangle. In Table 7 we report the absolute errors for the integrals I 1,2, I 2,3 and I 3,1 (see (2.4)), which arise from (3.1) with l = 1 and defined over the subtriangles 1, 2 and 3 of Figure 2, respectively. Notice, that the subtriangles, in which the special strategy is required, are those nearly degenerate; the more the triangle is degenerate, the more our approach is efficient and competitive. In particular, the comparison with q = 1 is remarkable for the subtriangle 2 when x = (0.1, 0.89, 0.1) T. 18

x = (0.1, 0.1, 0.1) T subtriangle 1 of T subtriangle 2 of T subtriangle 3 of T I 1,2 I1,2 n I 2,3 I2,3 n I 3,1 I3,1 n n q = 1 n q = 3 n q = 1 n q = 3 n q = 1 n q = 3 8 3.27E 04 4 + 4 1.84E 06 4 1.93E 04 4 1.93E 04 8 3.27E 04 4 + 4 1.84E 06 12 9.89E 06 6 + 6 4.33E 09 6 1.89E 06 6 1.89E 06 12 9.89E 06 6 + 6 4.33E 09 16 2.95E 07 8 + 8 1.17E 11 8 1.84E 08 8 1.84E 08 16 2.95E 07 8 + 8 1.17E 11 20 8.78E 09 10 + 10 4.09E 14 10 1.78E 10 10 1.78E 10 20 8.78E 09 10 + 10 4.09E 14 24 2.60E 10 12 + 12 12 1.73E 12 12 1.73E 12 24 2.60E 10 12 + 12 28 7.70E 12 14 + 14 14 1.69E 14 14 1.69E 14 28 7.70E 12 14 + 14 x = (0.2, 0.4, 0.1) T subtriangle 1 of T subtriangle 2 of T subtriangle 3 of T I 1,2 I1,2 n I 2,3 I2,3 n I 3,1 I3,1 n n q = 1 n q = 3 n q = 1 n q = 3 n q = 1 n q = 3 4 2.05E 04 4 2.05E 04 8 8.51E 06 4 + 4 2.38E 04 4 6.02E 06 4 + 4 1.68E 04 6 3.25E 06 6 3.25E 06 12 2.50E 08 6 + 6 4.04E 06 6 1.77E 08 6 + 6 2.85E 06 8 5.15E 08 8 5.15E 08 16 7.57E 11 8 + 8 7.07E 08 8 5.35E 11 8 + 8 5.00E 08 10 8.12E 10 10 8.12E 10 20 2.32E 13 10 + 10 1.26E 09 10 1.64E 13 10 + 10 8.92E 10 12 1.28E 11 12 1.28E 11 24 12 + 12 2.27E 11 12 12 + 12 1.61E 11 14 2.01E 13 14 2.01E 13 28 14 + 14 4.11E 13 14 14 + 14 2.91E 13 x = (0.4, 0.49, 0.1) T subtriangle 1 of T subtriangle 2 of T subtriangle 3 of T I 1,2 I1,2 n I 2,3 I2,3 n I 3,1 I3,1 n n q = 1 n q = 3 n q = 1 n q = 3 n q = 1 n q = 3 4 5.19E 05 4 5.19E 05 8 1.32E 03 4 + 4 8.09E 06 4 1.36E 04 4 1.36E 04 6 3.38E 07 6 3.38E 07 12 6.48E 05 6 + 6 6.40E 08 6 1.34E 06 6 1.34E 06 8 2.26E 09 8 2.26E 09 16 3.19E 06 8 + 8 5.06E 10 8 1.31E 08 8 1.31E 08 10 1.54E 11 10 1.54E 11 20 1.58E 07 10 + 10 4.05E 12 10 1.27E 10 10 1.27E 10 12 1.07E 13 12 1.07E 13 24 7.91E 09 12 + 12 3.50E 14 12 1.24E 12 12 1.24E 12 14 14 28 3.99E 10 14 + 14 14 1.24E 14 14 1.24E 14 x = (0.1, 0.89, 0.1) T subtriangle 1 of T subtriangle 2 of T subtriangle 3 of T I 1,2 I1,2 n I 2,3 I2,3 n I 3,1 I3,1 n n q = 1 n q = 3 n q = 1 n q = 3 n q = 1 n q = 3 4 1.72E 06 4 1.72E 06 8 8.45E 03 4 + 4 6.14E 05 8 3.38E 04 4 + 4 2.34E 06 6 2.25E 09 6 2.25E 09 12 4.28E 03 6 + 6 2.45E 06 12 1.04E 05 6 + 6 6.19E 09 8 2.95E 12 8 2.95E 12 16 2.21E 03 8 + 8 8.99E 07 16 3.16E 07 8 + 8 1.78E 11 10 12 20 1.16E 03 10 + 10 6.80E 08 20 9.53E 09 10 + 10 6.04E 14 12 14 24 6.00E 04 12 + 12 2.76E 09 24 2.87E 10 12 + 12 14 16 28 3.10E 04 14 + 14 4.38E 10 28 8.64E 12 14 + 14 Table 7: Absolute errors for the three integrals I 1,2, I 2,3 and I 3,1, which arise from (3.1) with l = 1 and defined over the subtriangles 1, 2 and 3 of Figure 2, respectively. 19

In Table 8 and following, while n denotes the number of quadrature nodes of the used Gauss-Legendre quadrature rule, n tot denotes the total number of the quadrature points required in the computation of the integral over the original triangle. The computation of n tot easily results from Table 6 and its respective comments. In all the tables the sign means that full relative accuracy (i.e. 14 significant digits in our case) has been achieved. x = (0.1, 0.1, 0.1) T x = (0.1, 0.1, 0.01) T x = (0.1, 0.1, 0.001) T I 1.47287534942578 I 1.87918375312867 I 1.93391491632701 4 20 5.75E 04 1.33E 04 4.50E 04 1.05E 04 4.38E 04 1.02E 04 6 30 1.47E 05 1.29E 06 1.15E 05 1.01E 06 1.12E 05 9.84E 07 8 40 4.14E 07 1.25E 08 3.24E 07 9.81E 09 3.15E 07 9.54E 09 10 50 1.20E 08 1.21E 10 9.44E 09 9.50E 11 9.17E 09 9.23E 11 12 60 3.55E 10 1.17E 12 2.78E 10 9.19E 13 2.70E 10 8.93E 13 14 70 1.05E 11 1.15E 14 8.21E 12 7.98E 12 x = (0.2, 0.4, 0.1) T x = (0.2, 0.4, 0.01) T x = (0.2, 0.4, 0.001) T I 1.80934549534372 I 2.28313355836924 I 2.33873776730059 4 20 1.21E 04 3.38E 04 9.62E 05 2.68E 04 9.40E 05 2.61E 04 6 30 1.82E 06 5.61E 06 1.44E 06 4.44E 06 1.41E 06 4.34E 06 8 40 2.85E 08 9.52E 08 2.26E 08 7.54E 08 2.21E 08 7.36E 08 10 50 4.49E 10 1.64E 09 3.56E 10 1.30E 09 3.47E 09 1.27E 09 12 60 7.06E 12 2.85E 11 5.59E 12 2.26E 11 5.46E 12 2.21E 11 14 70 1.12E 13 4.99E 13 8.87E 14 3.96E 13 8.66E 14 3.86E 13 x = (0.4, 0.49, 0.1) T x = (0.4, 0.49, 0.01) T x = (0.4, 0.49, 0.001) T I 1.67020625871864 I 2.09851896921962 I 2.15347085069994 4 16 9.02E 04 1.18E 04 7.18E 04 9.70E 05 7.00E 04 9.45E 05 6 24 3.98E 05 1.04E 06 3.17E 05 8.44E 07 3.09E 05 8.23E 07 8 32 1.92E 06 9.50E 09 1.53E 06 7.61E 09 1.49E 06 7.41E 09 10 40 9.47E 08 8.80E 11 7.54E 08 7.00E 11 7.35E 08 6.82E 11 12 48 4.74E 09 8.27E 13 3.77E 09 6.55E 13 3.67E 09 6.38E 13 14 56 2.39E 10 1.90E 10 1.85E 10 x = (0.1, 0.89, 0.1) T x = (0.1, 0.89, 0.01) T x = (0.1, 0.89, 0.001) T I 1.05573102843741 I 1.29195769171643 I 1.33641502284995 4 20 8.33E 03 6.20E 05 6.85E 03 6.02E 05 6.62E 03 6.12E 05 6 30 4.06E 03 2.31E 06 3.30E 03 2.12E 06 3.19E 03 2.06E 06 8 40 2.10E 03 8.51E 07 1.71E 03 7.83E 08 1.66E 03 7.50E 08 10 50 1.09E 03 6.44E 08 8.95E 04 2.88E 09 8.65E 04 2.75E 09 12 60 5.69E 04 2.62E 09 4.65E 04 1.06E 10 4.49E 04 1.01E 10 14 70 2.93E 04 4.15E 10 2.40E 04 3.87E 12 2.32E 04 3.70E 12 Table 8: Relative errors for the integral (3.1) with l = 1, whose inner integral is evaluated by (2.10). We wish to remark that we obtain practically the same results of Table 8 if we apply our numerical approach for computing the inner integral instead of proceeding analytically. 20

In Tables 9 and 10 we report the relative errors obtained for the integrals (3.3) and (3.4) with l = 1, respectively. Notice that the approach q = 3 outperforms q = 1 when c = 0.1, 0.01, with a few exceptions for x = (0.2, 0.4, c) T. As already remarked in Subsection 2.1 when c is equal or less than 0.001, within our approach it is more efficient to use the transformation (2.13) instead of (2.11). This is evident in Figures 3, 4 e 5. x = (0.1, 0.1, 0.1) T x = (0.1, 0.1, 0.01) T x = (0.1, 0.1, 0.001) T R(I) 1.42970516324654 R(I) 1.83755816482970 R(I) 1.89230767743005 I(I) 0.30943820412319 I(I) 0.30964103642031 I(I) 0.30964306514465 4 80 6.32E 04 1.52E 04 1.27E 03 1.13E 03 5.94E 03 5.75E 03 6 180 1.91E 05 1.66E 06 1.11E 05 9.17E 06 1.16E 04 1.17E 04 8 320 6.32E 07 2.02E 08 4.28E 07 5.37E 08 1.67E 06 2.02E 06 10 500 2.17E 08 2.39E 10 1.68E 08 2.97E 10 1.31E 08 2.93E 08 12 720 7.57E 10 2.81E 12 5.95E 10 3.10E 12 4.37E 10 3.77E 10 14 980 2.63E 11 3.16E 14 2.07E 11 3.33E 14 2.08E 11 4.45E 12 x = (0.2, 0.4, 0.1) T x = (0.2, 0.4, 0.01) T x = (0.2, 0.4, 0.001) T R(I) 1.77562600949030 R(I) 2.25132245672711 R(I) 2.30694901455659 I(I) 0.31121202313904 I(I) 0.31141555077274 I(I) 0.31141758645143 4 80 1.35E 04 3.68E 04 6.68E 04 7.56E 04 3.99E 03 4.09E 03 6 180 2.42E 06 7.06E 06 3.70E 06 4.58E 06 6.26E 05 6.24E 05 8 320 4.55E 08 1.40E 07 1.12E 08 8.49E 08 8.76E 07 8.23E 07 10 500 8.55E 10 2.81E 09 5.80E 10 2.14E 09 1.08E 08 9.25E 09 12 720 1.60E 11 5.70E 11 1.28E 11 4.54E 11 1.26E 10 1.10E 10 14 980 2.97E 13 1.16E 12 2.38E 13 9.22E 13 1.50e 12 1.78E 12 x = (0.4, 0.49, 0.1) T x = (0.4, 0.49, 0.01) T x = (0.4, 0.49, 0.001) T R(I) 1.63466394661728 R(I) 2.06472843193010 R(I) 2.11970084560881 I(I) 0.31107008965020 I(I) 0.31127356203223 I(I) 0.31127559715832 4 64 9.46E 04 1.25E 04 1.07E 04 7.69E 04 4.82E 03 4.56E 03 6 144 4.56E 05 1.17E 06 3.27E 05 4.31E 06 6.87E 05 7.34E 05 8 256 2.43E 06 1.16E 08 1.91E 06 1.60E 08 1.04E 06 1.00E 06 10 400 1.34E 07 1.20E 10 1.07E 07 9.36E 11 9.36E 08 1.14E 08 12 576 7.55E 09 1.30E 12 6.02E 09 1.24E 12 5.82E 09 1.18E 10 14 784 4.30E 10 1.37E 14 3.43E 10 1.24E 14 3.35E 10 1.12E 12 x = (0.1, 0.89, 0.1) T x = (0.1, 0.89, 0.01) T x = (0.1, 0.89, 0.001) T R(I) 0.99352055472983 R(I) 1.23081885612849 R(I) 1.27528865545932 I(I) 0.30943820412319 I(I) 0.30964103642031 I(I) 0.30964306514465 4 80 8.16E 03 3.55E 04 5.23E 03 2.72E 03 9.94E 03 1.08E 02 6 180 4.12E 03 3.52E 05 3.33E 03 4.39E 05 2.93E 03 3.39E 04 8 320 2.16E 03 2.48E 06 1.77E 03 2.39E 06 1.71E 03 8.25E 06 10 500 1.15E 03 3.87E 07 9.40E 04 2.62E 07 9.09E 04 2.13E 07 12 720 6.09E 04 3.02E 08 5.00E 04 2.58E 08 4.83E 04 2.24E 08 14 980 3.23E 04 2.97E 09 2.65E 04 2.44E 09 2.56E 04 2.31E 09 Table 9: Relative errors for the integral (3.3) with l = 1, whose inner integral is computed by (2.12). The relative errors of Table 9 and those of Figure 4 for x = (0.1, 0.1, c) T with c = 0.1, 0.01 can be compared with those of Figure 9 in [10]. To this end we recall that in [10] the authors do not use the polar co-ordinates and introduce an asinh transformation to eliminate the nearly singular term in the inner integral; then, they split the subtriangles along the radial direction at two points depending on the distance c of the observation point from the triangle and use the same Gauss-Legendre scheme in each of the resulting three regions and for all three subtriangles. By using about 1000 quadrature points in [10] they achieve 11 significant digits for c = 0.1, 8 digits for c = 0.01 and 5 digits for c = 0.0001, while by means of the same number of quadrature points and q = 3 we achieve the full relative accuracy (i.e. 14 significant digits) for all values of c = 0.1, 0.01, 0.0001. Notice that our approach with q = 1 already provides an accuracy of the order 10 10 when c = 0.1, 0.01, 0.0001. 21