function [est] = expectation(n,mu)

G = zeros([n,1]);

for i = 1:n
    Y = (randn + mu);
    if Y >= mu
        f = 1;
    else
        f = 0;
    end
    G(i) = f*exp(-mu*Y + mu^2/2);
end

est = mean(G)
v_est = var(G)/n


end