ZernikeSeries[9053]: calculating the coefficients [12, 4]...
ZernikeSeries[9209]: calculating the coefficients [12, 6]...
ZernikeSeries[9358]: calculating the coefficients [12, 8]...
ZernikeSeries[9509]: calculating the coefficients [12, 10]...
ZernikeSeries[9662]: calculating the coefficients [12, 12]...
> 
cost(S);
 + 
 + 
 + 
1605 additions 11173 multiplications 690 divisions 17 functions
> 
cost(opd);
 + 
 + 
 + 
433 additions 3710 multiplications 187 divisions 13 functions
> 
save OPD, OPD_avg, opd, S, c, `d:/optics/AESOP/BeamCompExample.eqs`;
Sanity Check
The series expansion of the wavefront is stored in S, and the series coefficients are stored in 
the table, c.  As a quick check, let's make sure S is identical to the OPD:
> 
factor( expand(S-opd) );
0
Elimination of Coma, Due to a Mirror Displacement, by a Compensating 
Mirror Rotation
We can use the function ZernikeTerm() to access the individual components.  For 
example, the coma term is
> 
ZernikeTerm(3,1,c);
 + 
5
57344
C2
(
)
-
 + 
1106 1259 C d
f14
5
57344
 - 
 - 
 +   + 
1259 C4 3212 C3 7 C 70 1611 C2
f13 C
R11
-
 - 
1
1344
C2
(
)
-
 + 
295 286 C d
f12
1
2688
 - 
 + 
 - 
 + 
770 C2 1483 C3 572 C4 25 C 70
f11 C
R9
 + 
 + 
1
320
C2
(
)
-
 + 
140 111 C d
f10
1
320
 +   + 
 - 
146 C 15 111 C3 286 C2
f9
R7
 + 
-
 - 
7
80
C2
(
)
-  + 
8 5 C d
f8
1
80
 + 
 - 
 + 
35 C3 49 C 99 C2 9
f7
R5
 + 
 + 
1
24
C2
(
)
-  + 
17 8 C d
f6
1
48
(
)
 + 
4 C 1 (
)
 - 
 + 
4 C2 14 C 9
f5
R3
 + 
3
 + 
 + 
15
28672
C2
(
)
 - 
743 C 475 d
f13
5
57344
-
 + 
 + 
 + 
 - 
10342 C3 4458 C4 4290 C2 64 C 65
f12 C
R11