088be4cAn interactive tutorial on the Dirichlet problem, accuracy against costJeremy Magland 1function U = lp_bexact(X, Y)
2% LP_BEXACT Ground truth for the interior Dirichlet problem on a curve.
3%
4% A sum of point sources placed outside the curve,
5%
6% u(z) = sum_k c_k log|z - z_k| ,
7%
8% which is harmonic everywhere except at the sources and therefore harmonic on
9% the whole of the interior. Its trace on the curve is the Dirichlet data, and
10% it is the exact solution by construction, to full precision at every point.
11zk = [1.8 + 0.9i, -1.5 - 1.7i, 0.2 + 2.4i];
12ck = [1.0, -0.7, 0.5];
13U = zeros(size(X));
14for k = 1:numel(zk)
15 U = U + ck(k) * 0.5 * log((X - real(zk(k))).^2 + (Y - imag(zk(k))).^2);
16end
17end