function [res1,res2]=fctn2(a,b,rad,theta)

% Fucntion: f(z) = e^z/(z-a)(z-b)

% theta=(-pi):(1/49):(pi);
res1=[];
res2=[];

for n=1:1:length(rad)
    r=rad(n);
    
%     cir=r*exp(1i*theta);
%     figure(1);
%     scatter(real(cir),imag(cir),'g.')
%     hold on
%     pause(0.00001)
    
    k=1;
    temp1=[];
    
    % Summation of the fucntional values of the discrete points on the
    % contour
    for dummy=1:1:length(theta)-1
        delta=r.*exp(1i*(theta(k+1)))-r.*exp(1i*(theta(k)));
        thetamid=(theta(k+1)+theta(k))/2;
        k=k+1;
        temp1=[temp1 (exp(r.*(exp(1i*thetamid)))/(((r.*(exp(1i*thetamid)))-a)*((r.*(exp(1i*thetamid)))-b)))*delta];
    end
    temp2=(1/(2*pi*1i))*sum(temp1);
    res1=[res1 temp2];
    
    % Using Cauchy's Residue Theorem
    if abs(a)<abs(b)
        if(abs(a)<r && r<abs(b))
            res2=[res2 (exp(a)/(a-b))];
        elseif(abs(b)<r)
            res2=[res2 (exp(a)/(a-b))+(exp(b)/(b-a))];
        else
            res2=[res2 0];
        end
    else
        if(abs(b)<r && r<abs(a))
            res2=[res2 (exp(b)/(b-a))];
        elseif(abs(b)<r)
            res2=[res2 (exp(b)/(b-a))+(exp(a)/(a-b))];
        else
            res2=[res2 0];
        end
    end
end
% figure(1)
% scatter(real(a),imag(a),'bx');
% hold on;
% scatter(real(b),imag(b),'mx');