%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% coddington.m
% This is used for minimizing sherical
% aberration for a single thin lens.
% Inputs:   f (focal length)
%           n (refractive index)
%          so (object distance to first surface)
% Outputs: R1, R2 radii of curvatures.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear; clc;
% inputs
f  = 20;
n  = 1.5;
so = 30;

% calculations
si = 1 / (1/f-1/so)
P  = (si+so)/(si-so)
sigma = -2*(n^2-1)*P / (n+2)
R1 = 2*f*(n-1) / (sigma+1)
R2 = 2*f*(n-1) / (sigma-1)
