Skip to content

Commit f09659a

Browse files
committed
Add newtoniansquare routine
1 parent 51f9b20 commit f09659a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
11
# MultivariateSingularIntegrals.jl
22
Julia package for computing multivariate singular integrals
3+
4+
5+
The function `newtoniansquare([x,y], n)` computes a matrix of Newtonian potentials of Legendre polynomials on the unit square $Ω := [-1,1]^2$. That is it computes
6+
```math
7+
\begin{pmatrix}
8+
L_{00}(𝐱) & \cdots & L_{0,p-1}(𝐱) & L_{0p}(𝐱) \\
9+
L_{10}(𝐱) & \cdots & L_{1,p-1}(𝐱) \\
10+
\vdots & \iddots \\
11+
L_{p0}(𝐱)
12+
\end{pmatrix}
13+
```
14+
where $𝐱 = [x,y]$ is any point in $ℝ²$ (including on or near the unit square $Ω$) and
15+
```math
16+
L_{k,j}(𝐱) := ∬_Ω P_k(s) P_j(t) \log(\| [s,t] - [x,y] \|) \, ds \, dt
17+
```
18+
where $P_k$ and $P_j$ are the Legendre polynomials of degree $k$ and $j$, respectively.

src/MultivariateSingularIntegrals.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ module MultivariateSingularIntegrals
22
using LinearAlgebra, ClassicalOrthogonalPolynomials, SingularIntegrals, FillArrays
33
import Base: size
44

5-
export logkernelsquare, stieltjessquare, logkernelsquare!, stieltjessquare!
5+
export newtoniansquare, logkernelsquare, stieltjessquare, logkernelsquare!, stieltjessquare!
66

77

88
function imlogkernel_vec(n, z)
99
T = float(real(typeof(z)))
1010
transpose(complexlogkernel(Legendre{T}(), -im*float(z)))[1:n] + m_const_vec(n, float(z))
1111
end
1212

13+
newtoniansquare(z::AbstractVector, n) = real(logkernelsquare(complex(z...), n))
14+
newtoniansquare(z::Number, n) = real(logkernelsquare(z, n))
15+
1316
include("stieltjessquare.jl")
1417
include("logkernelsquare.jl")
1518

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ end
5757
end
5858
end
5959

60+
@testset "newtonian" begin
61+
@test newtoniansquare(0.1+0.2im, 10) == newtoniansquare([0.1,0.2], 10) == real(logkernelsquare(0.1+0.2im, 10))
62+
end
63+
6064
# n = 4000
6165
# z = 2.0
6266
# @profview logkernelsquare(z, n)

0 commit comments

Comments
 (0)