function [ Ueff, th_min, Ueff_min] = Ueff_fun( theta,a )
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here

if theta==0
    Ueff=2.0;
else
    Ueff=1 + 2*a*(1-cos(theta)).^2./(sin(theta)).^2 + cos(theta);
end

if a>1
    th_min=0;
    Ueff_min=2.0;
else 
    th_min=2*acos(a.^(1/4));
    Ueff_min=1 + 2*a*(1-cos(th_min)).^2./(sin(th_min)).^2 + cos(th_min);
end

end

