function U = lp_lexact(kind, X, Y) % LP_LEXACT Exact solutions on the L-shaped domain (-1,1)^2 minus the quadrant % x > 0, y < 0. % % The re-entrant corner sits at the origin, with interior angle 3*pi/2 between % the edge y = 0, x > 0 and the edge x = 0, y < 0. Measuring the angle from the % first of those, counterclockwise, the domain is 0 < theta < 3*pi/2, and % % s(r, theta) = r^(2/3) sin(2 theta / 3) % % is harmonic there and vanishes on both edges of the corner. It is the slowest % decaying member of the family r^(2k/3) sin(2k theta/3) that a general % Dirichlet datum excites, and it is the reason the corner is a problem: s is % continuous, but its gradient is infinite at the origin and it has no second % derivative there, so every convergence rate derived from a Taylor expansion % is void. % % 'sing' the singular function alone % 'smooth' log|z - z0| with z0 outside the domain: harmonic, and smooth right % up to the corner, so the corner costs nothing % 'both' the sum, which is the generic case z0 = 1.6 + 1.3i; th = atan2(Y, X); th(th < -1e-13) = th(th < -1e-13) + 2*pi; % theta in [0, 3*pi/2] on the domain r = sqrt(X.^2 + Y.^2); sing = r.^(2/3) .* sin(2*th/3); smooth = 0.5 * log((X - real(z0)).^2 + (Y - imag(z0)).^2); switch kind case 'sing' U = sing; case 'smooth' U = smooth; otherwise U = sing + smooth; end end