apochromat design, with movie

Contents

clear
load apo1
global cv th rn;

movie

filename = 'apo1x.avi';
aviobj = avifile(filename);
N = 21;
shape = linspace(-4,4,N);
data = zeros(length(shape),4);
for k=1:length(shape)
    v=[0 0 shape(k)];
    show_frame;
    aviobj = addframe(aviobj,getframe(gcf));
    data(k,:) = f;
end
aviobj = close(aviobj);
minimum 29.6568 at 2 16
minimum 29.6568 at -3.05512 -3.93701 -4
minimum 2.44574 at 3 6
minimum 2.44574 at -3.68504 -3.87402 -3.6
minimum 4.6169 at 10 15
minimum 4.6169 at -3.11811 -3.43307 -3.2
minimum 1.18755 at 17 24
minimum 1.18755 at -2.55118 -2.99213 -2.8
minimum 1.07733 at 25 36
minimum 1.07733 at -1.79528 -2.48819 -2.4
minimum 2.12919 at 28 33
minimum 2.12919 at -1.98425 -2.29921 -2
minimum 0.401989 at 36 44
minimum 0.401989 at -1.29134 -1.79528 -1.6
minimum 0.400446 at 44 54
minimum 0.400446 at -0.661417 -1.29134 -1.2
minimum 0.0545833 at 99 5
minimum 0.0545833 at -3.74803 2.17323 -0.8
minimum 0.0501199 at 54 58
minimum 0.0501199 at -0.409449 -0.661417 -0.4
minimum 0.0706656 at 86 27
minimum 0.0706656 at -2.3622 1.35433 0
minimum 0.212185 at 58 64
minimum 0.212185 at -0.0314961 -0.409449 0.4
minimum 0.403471 at 51 64
minimum 0.403471 at -0.0314961 -0.850394 0.8
minimum 0.136669 at 95 18
minimum 0.136669 at -2.92913 1.92126 1.2
minimum 0.489954 at 99 15
minimum 0.489954 at -3.11811 2.17323 1.6
minimum 0.148026 at 36 74
minimum 0.148026 at 0.598425 -1.79528 2
minimum 1.10022 at 30 66
minimum 1.10022 at 0.0944882 -2.17323 2.4
minimum 0.0967267 at 25 68
minimum 0.0967267 at 0.220472 -2.48819 2.8
minimum 0.626444 at 20 71
minimum 0.626444 at 0.409449 -2.80315 3.2
minimum 4.57156 at 14 60
minimum 4.57156 at -0.283465 -3.1811 3.6
minimum 3.75043 at 6 40
minimum 3.75043 at -1.54331 -3.68504 4

find minima in each cross-section

semilogy(shape,data(:,1));
[c idx] = min(data(:,1));
v = data(idx,2:4);
disp('starting point');
disp(v);
f = apochromat(v);
fprintf('merit function %g\n',norm(f));
starting point
   -0.4094   -0.6614   -0.4000

merit function 0.223875

trial 1

[xo vout hp] = cycle(v,@apochromat);
disp('solution');
disp(xo);
show_progress(hp);
  #      merit    damping        chg  r      ratio
  1     0.2233    0.00497      0.592  3   0.000128
  2     0.2228    0.00491      0.585  3   0.000128
  3     0.2222    0.00485       0.58  3   0.000129
  4     0.2217     0.0048      0.574  3   0.000129
  5     0.2212    0.00475      0.568  3    0.00013
  6     0.2207     0.0047      0.563  3    0.00013
  7     0.2201    0.00465      0.557  3   0.000131
  8     0.2196    0.00461      0.552  3   0.000131
  9     0.2191    0.00456      0.547  3   0.000132
 10     0.2186    0.00452      0.543  3   0.000132
 11     0.2181    0.00447      0.538  3   0.000133
 12     0.2177    0.00443      0.533  3   0.000133
 13     0.2172    0.00439      0.529  3   0.000134
 14     0.2167    0.00435      0.525  3   0.000134
 15     0.2162    0.00432      0.521  3   0.000135
 16     0.2158    0.00428      0.516  3   0.000135
 17     0.2153    0.00424      0.513  3   0.000136
 18     0.2149    0.00421      0.509  3   0.000136
 19     0.2144    0.00417      0.505  3   0.000136
 20      0.214    0.00414      0.501  3   0.000137
 21     0.2135    0.00411      0.498  3   0.000137
 22     0.2131    0.00407      0.494  3   0.000138
 23     0.2127    0.00404      0.491  3   0.000138
 24     0.2123    0.00401      0.487  3   0.000138
 25     0.2118    0.00398      0.484  3   0.000139
 26     0.2114    0.00395      0.481  3   0.000139
 27      0.211    0.00392      0.478  3    0.00014
 28     0.2106     0.0039      0.475  3    0.00014
 29     0.2102    0.00387      0.472  3    0.00014
 30     0.2098    0.00384      0.469  3   0.000141
 31     0.2094    0.00382      0.466  3   0.000141
 32      0.209    0.00379      0.463  3   0.000141
 33     0.2086    0.00377       0.46  3   0.000142
 34     0.2082    0.00374      0.458  3   0.000142
 35     0.2078    0.00372      0.455  3   0.000143
 36     0.2074    0.00369      0.453  3   0.000143
 37     0.2071    0.00364      0.446  3   0.000143
 38     0.2067    0.00361      0.443  3   0.000144
 39     0.2063    0.00359      0.441  3   0.000144
 40     0.2059    0.00357      0.439  3   0.000144
 41     0.2056    0.00355      0.436  3   0.000144
 42     0.2052    0.00353      0.434  3   0.000145
 43     0.2049    0.00351      0.432  3   0.000145
 44     0.2045    0.00349       0.43  3   0.000145
 45     0.2041    0.00347      0.427  3   0.000146
 46     0.2038    0.00345      0.425  3   0.000146
 47     0.2034    0.00343      0.423  3   0.000146
 48     0.2031    0.00341      0.421  3   0.000147
 49     0.2027    0.00339      0.419  3   0.000147
 50     0.2024    0.00337      0.417  3   0.000147
 51     0.2021    0.00336      0.415  3   0.000147
 52     0.2017    0.00334      0.413  3   0.000148
 53     0.2014    0.00332      0.411  3   0.000148
 54     0.2011     0.0033       0.41  3   0.000148
 55     0.2007    0.00329      0.408  3   0.000148
 56     0.2004    0.00327      0.406  3   0.000149
 57     0.2001    0.00325      0.404  3   0.000149
 58     0.1997    0.00324      0.403  3   0.000149
 59     0.1994    0.00322      0.401  3   0.000149
 60     0.1991    0.00321      0.399  3    0.00015
 61     0.1988    0.00319      0.398  3    0.00015
 62     0.1985    0.00318      0.396  3    0.00015
 63     0.1982    0.00316      0.394  3    0.00015
 64     0.1978    0.00315      0.393  3    0.00015
 65     0.1975    0.00313      0.391  3   0.000151
 66     0.1972    0.00312      0.389  3   0.000151
 67     0.1969     0.0031      0.388  3   0.000151
 68     0.1966    0.00309      0.386  3   0.000151
 69     0.1963    0.00308      0.385  3   0.000151
 70      0.196    0.00306      0.383  3   0.000151
 71     0.1957    0.00305      0.382  3   0.000152
 72     0.1954    0.00303       0.38  3   0.000152
...

trial 2

v = [-2 1 -0.5];
[xo vout hp] = cycle(v,@apochromat);
disp('solution');
disp(xo);
show_progress(hp);
xop = xo;
  #      merit    damping        chg  r      ratio
  1     0.1362      0.869       24.2  3  4.46e-006
  2     0.1148      0.206      0.794  3  1.38e-005
  3     0.1021      0.188      0.564  3  1.41e-005
  4    0.09072      0.203       0.49  3  1.44e-005
  5    0.07892      0.242      0.462  3  1.46e-005
  6    0.06541      0.322      0.464  3  1.49e-005
  7    0.04756      0.514        0.5  3  1.51e-005
  8    0.01586          1       0.47  3  1.54e-005
  9 1.057e-008          1    0.00952  3  1.56e-005
 10 1.198e-012          1  2.58e-007  3  1.56e-005
solution
   -2.4596
    1.4076
   -0.1190

trial 3

v = [-0.5 1 -2];
[xo vout hp] = cycle(v,@apochromat);
disp('solution');
disp(xo);
show_progress(hp);
  #      merit    damping        chg  r      ratio
  1      145.4  7.85e-005        1.5  3  5.41e-008
  2      145.4   0.000246       2.93  3  8.69e-008
  3      145.4    0.00081       4.48  3  1.89e-007
  4      145.2    0.00209       9.39  3  2.32e-007
  5      144.8     0.0064       10.7  3  6.53e-007
  6      144.3    0.00625       19.4  3  3.44e-007
  7      142.9     0.0198       16.3  3  1.51e-006
  8      142.9  5.57e-005       2.68  3  2.09e-008
  9      142.6    0.00414       17.9  3  2.47e-007
 10      140.9     0.0238       18.6  3  1.53e-006
 11      140.1      0.011       48.7  3  2.66e-007
 12      135.9     0.0598       24.9  3   4.9e-006
 13        131     0.0723       31.9  3  2.82e-006
 14      5.027      0.196        147  3  8.54e-007
 15      5.004    0.00615       2.36  3  1.58e-005
 16      4.987    0.00562       1.72  3  1.92e-005
 17      4.972    0.00547       1.46  3  2.16e-005
 18      4.958    0.00542       1.31  3  2.35e-005
 19      4.944    0.00539        1.2  3  2.51e-005
 20       4.93    0.00543       1.12  3  2.65e-005
 21      4.916    0.00541       1.05  3  2.78e-005
 22      4.902    0.00545       1.01  3  2.89e-005
 23      4.888    0.00545       0.96  3     3e-005
 24      4.874    0.00549      0.926  3  3.09e-005
 25      4.861    0.00549       0.89  3  3.18e-005
 26      4.847    0.00549      0.858  3  3.26e-005
 27      4.833    0.00552      0.835  3  3.33e-005
 28       4.82    0.00552       0.81  3   3.4e-005
 29      4.806    0.00552      0.787  3  3.46e-005
 30      4.793    0.00552      0.766  3  3.52e-005
 31      4.779    0.00551      0.747  3  3.57e-005
 32      4.766    0.00551       0.73  3  3.62e-005
 33      4.753    0.00549      0.712  3  3.66e-005
 34       4.74    0.00548      0.697  3   3.7e-005
 35      4.726    0.00547      0.682  3  3.74e-005
 36      4.713    0.00549      0.673  3  3.77e-005
 37        4.7    0.00547       0.66  3   3.8e-005
 38      4.687    0.00546      0.648  3  3.82e-005
 39      4.674    0.00545      0.636  3  3.84e-005
 40      4.662    0.00543      0.626  3  3.86e-005
 41      4.649    0.00542      0.616  3  3.88e-005
 42      4.636     0.0054      0.607  3  3.89e-005
 43      4.624    0.00538      0.598  3  3.91e-005
 44      4.611    0.00537      0.589  3  3.92e-005
 45      4.599    0.00535      0.581  3  3.92e-005
 46      4.586    0.00533      0.574  3  3.93e-005
 47      4.574    0.00532      0.566  3  3.93e-005
 48      4.562    0.00529      0.559  3  3.93e-005
 49       4.55    0.00527      0.552  3  3.93e-005
 50      4.538    0.00525      0.546  3  3.93e-005
 51      4.526    0.00523      0.539  3  3.93e-005
 52      4.514    0.00521      0.534  3  3.92e-005
 53      4.502    0.00519      0.528  3  3.92e-005
 54       4.49     0.0052      0.526  3  3.91e-005
 55      4.479    0.00518      0.521  3   3.9e-005
 56      4.467    0.00516      0.516  3  3.89e-005
 57      4.456    0.00514      0.511  3  3.87e-005
 58      4.444    0.00511      0.506  3  3.86e-005
 59      4.433    0.00509      0.502  3  3.85e-005
 60      4.422    0.00507      0.498  3  3.83e-005
 61       4.41    0.00505      0.494  3  3.82e-005
 62      4.399    0.00503       0.49  3   3.8e-005
 63      4.388    0.00501      0.487  3  3.78e-005
 64      4.377    0.00498      0.483  3  3.76e-005
 65      4.366    0.00496      0.479  3  3.74e-005
 66      4.356    0.00494      0.476  3  3.72e-005
 67      4.345    0.00492      0.473  3   3.7e-005
 68      4.334    0.00489       0.47  3  3.68e-005
 69      4.324    0.00487      0.467  3  3.65e-005
 70      4.313    0.00485      0.464  3  3.63e-005
 71      4.303    0.00482      0.461  3  3.61e-005
 72      4.292     0.0048      0.458  3  3.58e-005
...

use all starting points

soln = zeros(length(shape),5);
for k=1:length(shape)
    v = data(k,2:4);
    [xo vout hp ncycles] = cycle(v,@apochromat);
    f = apochromat(xo);
    soln(k,:) = [norm(f) ncycles xo'];
    fprintf('%4d %10.4g %5d %10.4f %10.4f %10.4f\n',k,soln(k,:));
end
   1     0.1252  1000     0.3099    -0.8574     0.9274
   2     0.1304  1000     0.2763    -0.7918     0.8557
   3    0.06265  1000    -0.1225    -0.5105     0.3938
   4    0.02282  1000    -0.3687    -0.5319    -0.1026
   5     0.0942  1000     0.1608    -0.6980     0.7306
   6     0.2763  1000     0.3154    -0.9053     0.9766
   7    0.06581  1000    -0.0625    -0.5709     0.4979
   8    0.09589  1000     0.1470    -0.6890     0.7170
   9 3.729e-013   170    -2.4596     1.4076    -0.1190
  10     0.1151  1000     0.1727    -0.7162     0.7517
  11 3.686e-012     9    -2.4596     1.4076    -0.1190
  12    0.03932  1000     0.3028    -0.8517     0.9196
  13    0.07018  1000     0.3324    -0.8812     0.9558
  14 8.502e-012   246    -2.4596     1.4076    -0.1190
  15 2.525e-012   419    -2.4596     1.4076    -0.1190
  16 5.077e-012   490    -2.4596     1.4076    -0.1190
  17    0.05495  1000     0.3374    -0.8866     0.9622
  18     0.5951  1000     0.2803    -0.5777     0.6795
  19     0.5121  1000     0.2934    -0.6409     0.7315
  20      15.96  1000     0.1075    -0.4685     0.6606
  21      6.833  1000     0.2365    -0.5543     0.6954

thicken the lens

f = apochromat(xop);
fprintf('merit %g\n',norm(f));
close
th(2) = 2;
th(3) = 0.5;
th(4) = 1;
th(5) = 0.1;
th(6) = 2.5;
sa = ones(size(th))*50/8;
lp = [2 4 6];
drawsys;
merit 1.21987e-009

optimize thickened lens

[xo vout hp] = cycle(xop,@apochromat);
disp('solution');
disp(xo);
drawsys;
disp('lens prescription');
rd = curvature(cv);
disp([rd' th' rn(2,:)' sa']);

save apo2 cv th rn xo sa lp
  #      merit    damping        chg  r      ratio
  1      11.39          1       20.9  3  1.56e-005
  2  0.0005696      0.991       1.13  3  7.58e-006
  3 2.472e-005      0.987     0.0628  3   7.9e-006
  4  6.59e-009          1   0.000864  3  7.91e-006
  5 3.679e-013          1  5.48e-008  3  7.91e-006
solution
   -2.0316
    1.2755
   -0.3325

lens prescription
         0         0    1.0000    6.2500
  -30.5876    2.0000    1.6200    6.2500
  -10.4086    0.5000    1.0000    6.2500
   -9.0378    1.0000    1.6541    6.2500
  -74.6384    0.1000    1.0000    6.2500
   32.8980    2.5000    1.4866    6.2500
  -16.4809         0    1.0000    6.2500

show aberrations

yap = 50/8;
uco = tan(2.0*pi/180);
wvl = [ 0.48613 0.58756 0.65627 ];
for k=1:3
    ya = parax([yap 0],cv,th,rn(k,:));
    yc = parax([0 uco],cv,th,rn(k,:));
    fprintf('\n wavelength %g\n', wvl(k) );
    ford(ya,yc,cv,th,rn(k,:),wvl(k));
end
 wavelength 0.48613

      W040       W131       W222       W220       W311
      0.00       1.60       0.96       0.86       0.10

 wavelength 0.58756

      W040       W131       W222       W220       W311
      0.00       1.35       0.79       0.71       0.09

 wavelength 0.65627

      W040       W131       W222       W220       W311
      0.00       1.22       0.70       0.63       0.08
th = th*0;