== Listing 2.1: finite groups and their representations ==
orders: C8 8, D4 8, S3 6, S4 24, octahedral 24
C8 on R^8 by cyclic shifts: homomorphism error 0.0e+00
octahedral on R^3 (x) R^3 by kron(g,g): homomorphism error 0.0e+00
octahedral: max |g g^T - I| = 0.0e+00, determinants = [1]
octahedral trace counts (class sizes by character value chi(g) = tr g): {-1: 9, 0: 8, 1: 6, 3: 1}

== Listing 2.2: equivariant linear maps (commutants) ==
case                                 nullity character
C8 shifts R^8 -> R^8                       8     8.000
S3 permutations R^3 -> R^3                 2     2.000
D4 on R^2 -> R^2                           1     1.000
octahedral R^3 -> R^3                      1     1.000
octahedral R^3 -> R (invariants)           0     0.000
octahedral R^9 -> R^9                      4     4.000
SO(2) on R^2 -> R^2                        2         -   (every basis element lies in span{I, J}: residual 1.7e-16)
SO(3) on R^3 -> R^3                        1         -
SO(3) on R^9 = R^3 (x) R^3                 3         -
SO(3) R^3 -> R (invariant covectors)       0         -

== Listing 2.3: equivariant versus unconstrained linear regression ==
d = 8: unconstrained map has 64 parameters, circulant map has 8
   n      in-sample general    in-sample circulant           test general         test circulant
  24                  63.76                   7.69                 4.2674                 0.3403
  48                  64.07                   8.13                 1.6694                 0.1756
  96                  63.46                   8.23                 0.7300                 0.0874
theory for the in-sample columns (Proposition 2.5): 64 and 8, i.e. p sigma^2 / n times n / sigma^2
known Gaussian-design value of the general test column: d*d*sigma^2/(n-d-1) = 4.2667, 1.6410, 0.7356

== Listing 2.4: symmetrization cannot hurt, and by how much it helps ==
test inputs: 2400 (100 clouds x 24 group elements), group order 24
equivariant f = f*
  energy: risk(f) 0.000000  risk(sym f) 0.000000  gap ||f - sym f||^2 0.000000  identity residual 1.5e-29
  force : risk(f) 0.000000  risk(sym f) 0.000000  gap ||f - sym f||^2 0.000000  identity residual 3.1e-31
f = f* + 0.3 * random MLP
  energy: risk(f) 0.047761  risk(sym f) 0.001295  gap ||f - sym f||^2 0.046465  identity residual 0.0e+00
  force : risk(f) 0.061200  risk(sym f) 0.003762  gap ||f - sym f||^2 0.057438  identity residual 1.4e-17
augmented loss = loss of symmetrized model + orbit spread (Proposition 2.4)
  energy: LHS 0.112282  RHS 0.112282  |diff| 0.0e+00
  force : LHS 0.257690  RHS 0.257690  |diff| 5.6e-17

== Listing 2.5: pairwise distances are a complete invariant ==
200 clouds of 6 points: max Procrustes residual after rebuilding from distances 4.4e-15
fraction whose rebuilt cloud is the mirror image of the original (needs det -1): 0.440
max |distance difference| between a cloud and its mirror image: 0.0e+00

== Listing 2.6: chirality ==
signed volume: variance 0.7378; correlation between target on a cloud and on its mirror image -1.0000
distances (cubic polynomial, 83 features)  test R^2 -0.0706   mean |pred(x) - pred(mirror x)| 0.0000
distances + one pseudoscalar feature       test R^2  1.0000   mean |pred(x) - pred(mirror x)| 1.0993

== Listing 2.7: point clouds with a pairwise potential ==
2000 clouds, 6 points each; minimum pair distance 0.750, median pair distance 1.919
energy: mean -7.775, std 1.703, range [-13.19, -2.70]; force components: std 1.057
max |F + dE/dx| by central differences (Proposition 2.7): 1.8e-09
ground truth under random orthogonal map incl. reflection 8.9e-15, translation 1.0e-14, permutation 3.6e-15

== Listing 2.8: model checks ==
parameters: E(3)-equivariant network 1505, MLP 6611
finite-difference gradient check (max relative error over sampled parameters):
  equivariant network 2.8e-07, MLP 1.6e-07
max deviation from equivariance of the untrained models (rotation incl. reflection, translation, permutation):
  equivariant network  4.3e-16  5.3e-16  2.2e-16
  MLP                  3.4e+00  2.7e-15  4.0e+00
graph layer silu(H W1 + A H W2) on a random graph with 7 nodes: permutation-equivariance error 3.6e-15

== Listing 2.9: trained models at n = 80 (one seed) ==
model             E RMSE    F RMSE |   rotation translation permutation | octahedral g
mlp               2.1739    1.3301 |    8.0e+00    5.0e-15    8.0e+00 |      6.1e+00
mlp+sym           1.4758    0.8778 |    9.6e-01    2.7e-15    1.2e+00 |      3.6e-15
mlp+rot           0.7146    0.8827 |    1.2e+00    6.2e-15    1.9e+00 |      1.3e+00
mlp+rot+perm      0.5905    0.8682 |    1.1e+00    6.2e-15    9.2e-01 |      1.1e+00
equivariant       0.1103    0.2399 |    4.0e-15    7.5e-15    1.8e-15 |      0.0e+00

== Listing 2.10: sample complexity (5 seeds, mean +- 95% t-interval) ==
test set: 200 fresh clouds x 24 octahedral images; training labels carry 10% noise; clean test labels
energy RMSE
n                             20                40                80               160
mlp               2.252 +- 0.253    2.200 +- 0.233    2.147 +- 0.211    1.770 +- 0.167
mlp+sym           1.686 +- 0.145    1.640 +- 0.102    1.476 +- 0.052    1.109 +- 0.136
mlp+rot           1.075 +- 0.194    0.828 +- 0.143    0.684 +- 0.035    0.626 +- 0.030
mlp+rot+perm      0.639 +- 0.065    0.595 +- 0.018    0.595 +- 0.013    0.587 +- 0.015
equivariant       0.248 +- 0.116    0.150 +- 0.034    0.122 +- 0.022    0.091 +- 0.011
log-log slope of mean RMSE against n: mlp -0.11, mlp+sym -0.20, mlp+rot -0.26, mlp+rot+perm -0.04, equivariant -0.46
force RMSE
n                             20                40                80               160
mlp               1.360 +- 0.063    1.325 +- 0.066    1.331 +- 0.049    1.173 +- 0.024
mlp+sym           0.918 +- 0.008    0.885 +- 0.010    0.873 +- 0.011    0.860 +- 0.006
mlp+rot           0.933 +- 0.023    0.896 +- 0.012    0.879 +- 0.005    0.873 +- 0.004
mlp+rot+perm      0.877 +- 0.009    0.869 +- 0.002    0.868 +- 0.002    0.867 +- 0.002
equivariant       0.212 +- 0.062    0.212 +- 0.030    0.206 +- 0.035    0.205 +- 0.044
log-log slope of mean RMSE against n: mlp -0.06, mlp+sym -0.03, mlp+rot -0.03, mlp+rot+perm -0.01, equivariant -0.02
constant predictors on the test set (mean energy, zero force): energy RMSE 1.691, force RMSE 1.088
equivariant network at n = 20 versus best MLP variant at n = 160: energy 0.248 vs 0.587, force 0.212 vs 0.860
force RMSE ratio (MLP rot+perm / equivariant) at n = 20, 40, 80, 160: 4.33, 4.14, 4.27, 4.33

== Listing 2.11: training-budget check at n = 160 (2 seeds) ==
model                                 E RMSE    F RMSE
equivariant, 1500 steps                0.096     0.229
MLP rot+perm, 1500 steps, width 64     0.585     0.866
equivariant, 4000 steps                0.089     0.072
MLP rot+perm, 6000 steps, width 128     0.448     0.828

== Listing 2.12: group-averaging a trained MLP ==
    n |   MSE_E f MSE_E sym     gap_E   resid |   MSE_F f MSE_F sym     gap_F   resid | seeds improved (E, F)
   20 |    5.1055    2.8540    2.2514   7e-16 |    1.8530    0.8424    1.0105   4e-16 | 5/5, 5/5
   40 |    4.8672    2.6961    2.1711   9e-16 |    1.7582    0.7835    0.9746   2e-16 | 5/5, 5/5
   80 |    4.6345    2.1786    2.4559   9e-16 |    1.7726    0.7629    1.0097   3e-16 | 5/5, 5/5
  160 |    3.1478    1.2394    1.9085   2e-16 |    1.3754    0.7402    0.6353   1e-16 | 5/5, 5/5
(means over 5 seeds; 'resid' is the largest |MSE(f) - MSE(sym f) - gap| over seeds)

== Listing 2.13: imposing a symmetry the task does not have ==
trap strength kappa = 0.3: label std energy 2.291, force 1.154
floor for any octahedral-invariant model (RMSE of target to its orbit average): energy 0.553, force 0.230
n = 160, 2 seeds, test RMSE against the full (trapped) target
  equivariant  energy 0.576   force 0.318
  mlp          energy 2.030   force 1.121
  mlp+rot      energy 0.887   force 0.833
