function f = sing1(v)
%   f = sing1(v)
%
%   is a defect function for the design of a singlet lens.
%
%   The variables are
%
%       v(1) = first surface curvature
%       v(2) = second surface curvature
%
%   The defects are
%
%       f(1) = power error (difference from target power 1/20)
%       f(2) = coma

%   Written by: John S. Loomis, University of Dayton
%   Revision: 8 Feb 2003

global cv th rn;
cv(2)=v(1); % first surface curvature
cv(3)=v(2); % second surface curvature
yap = 5.0;
uco = 0.1;
scl = yap^2/2;
ya = parax([yap 0],cv,th,rn);
yc = parax([0 uco],cv,th,rn);
f(1) = -ya(4,2)/ya(1,1) - 1/20; % power error
w = ford(ya,yc,cv,th,rn,1);
f(2) = w(2)/scl; % coma error
f = f';