function [X] = v2exact(r, theta, beta, a)
% Exact expression for the two-jump interaction potential when r1 = r2:
%   function [X] = v2exact(r, theta, beta, a).
% Return value I is a matrix in r, theta, beta, and a.
%
% Formula:
%
%            2
%  2 a    -r  / 2 beta (1 - sin^2(theta/2))
% -----  e
%   r
%
%

	[ignored, nr]    = size(r);
	[ignored, ntheta] = size(theta);
	[ignored, nbeta ] = size(beta);
	[ignored, na]     = size(a);

	X = zeros(nr, ntheta, nbeta, na);

	for ir = 1 : nr
		sr = r(ir);

		for itheta = 1 : ntheta
			stheta = theta(itheta);

			for ibeta = 1: nbeta
				sbeta = beta(ibeta);

				for ia = 1: na
					sa = a(ia);

					X(ir, itheta, ibeta, ia) = ...
						v2exact_scalar(sr, stheta, sbeta, sa);
				end
			end
		end
	end
end
