function Aloc_mu = aloc_mu(mu,x,e)

% Aloc_mu = aloc_mu(mu,x,e)
%             It calculates a local contribution to the system matrix
%             that corresponds to the bilinear form:
%              a(v,u) = (1/mu) * \int_{K^e} grad(v(x))*grad(u(x)) dx

x1 = x(:,e(1));
x2 = x(:,e(2));
x3 = x(:,e(3));

R = [x2-x1 x3-x1];

if det(R)<=0
    warning('fliped element');
end

D = abs(det(R)) * (1/mu);
B = inv(R)' * [-1 1 0;-1 0 1];

Aloc_mu = 0.5 * B' * D * B;
