# A physical singular XXX pair

This small NumPy experiment reproduces an established four-site singular Bethe
state and rejects the same formal pair on five sites. It compares stable
polynomial evaluation with direct binary64 evaluation and a wrong regularization.
Small cleared Bethe-equation residuals and the right energy expectation alone do
not certify an eigenvector. No completeness, novelty or infinite-chain claim is
made.

## Reproduce

The recorded run used Python 3.9.6 and NumPy 2.0.2, with complex128 matrices and
binary64 real arithmetic. The pinned NumPy release supports Python 3.9–3.12.
Download `experiment.py`, `inputs.json`, `results.json`, `requirements.txt` and
this file into one directory. From that directory:

```sh
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
.venv/bin/python experiment.py --check
```

On Windows use `.venv\Scripts\python.exe`. In the repository with NumPy installed:

```sh
python3 public/computations/singular-xxx/experiment.py --check
```

Expected output:

```text
Singular XXX: exact limits, stable regularization, independent Hamiltonians, odd-chain rejection and saved-result checks passed.
```

No flag prints fresh JSON. `--write` deliberately replaces `results.json` after
the mathematical checks pass. `--check` reads and compares the saved results
without writing any files. Paths are relative to the script, so the downloaded
folder works independently of the website. Routine site builds do not run this
experiment. Explore changed parameters in a separate copy.

## Operators and state conventions

The physical Hilbert space is `(C^2)^N` with up=(1,0), down=(0,1). Site 1 is the
leftmost binary digit; an auxiliary space, when present, is the first factor.
Let `|xy>` mean down spins at the distinct sites x,y and up spins elsewhere.
Use ordinary ungraded tensor products and periodic bonds:

```text
L_an(lambda) = (lambda - i/2) I + i P_an
T_a(lambda) = L_aN(lambda) ... L_a1(lambda)
B(lambda) = upper-right auxiliary block of T_a(lambda)
tau(lambda) = tr_a T_a(lambda)
H = (J/2) sum_n (I - P_(n,n+1)), J>0.
```

The vacuum is all up. The independent spin-matrix Hamiltonian is assembled as
`J sum_n (1/4 - S_n dot S_(n+1))`, using Pauli matrices divided by two. A third
construction acts directly on the two-down-spin basis with exact rational bond
coefficients. The latter calls neither the swap nor the spin-matrix helper.
Translation is independently defined by the bit rotation
`U|s1,...,sN> = |sN,s1,...,s(N-1)>`.

For N=4 take real positive epsilon and

```text
lambda1 = i/2 + epsilon + c*epsilon^4
lambda2 = -i/2 + epsilon
v_c(epsilon) = epsilon^(-4) B(lambda1) B(lambda2) |0>.
```

These finite-epsilon roots are a limiting prescription, not exact solutions of
the untwisted Bethe equations. The limiting vector in ordered pairs
`12,13,14,23,24,34` is `(2,0,i*c,-2,0,2)`. Its defect is

```text
(H/J-I) v_c(0) = -(1+i*c/2) (|13>+|24>).
```

With c=2i its norm is 4 and its normalized value is
`chi=(|12>-|23>+|34>-|14>)/2`. The calculation checks
`H chi=J chi`, `U chi=-chi`, `S_total^2 chi=0` and
`tau(lambda) chi=(2 lambda^4+3 lambda^2-3/8) chi`.
The transfer identity is checked coefficient by coefficient, as well as at two
nonreal spectral values. Direct substitution at the exact unregularized pair
gives the zero vector.

## Stable evaluation and exact arithmetic

For fixed c=0 or 2i, multiply the local matrices as polynomials in epsilon.
The local coefficient lists are `(iP,I,0,0,cI)` for lambda1 and
`(i(P-I),I)` for lambda2. The coefficients are Gaussian integers. The sum of
coefficient absolute row norms is bounded through the entire product by

```text
(2+abs(c))^4 * 3^4 <= 20736 < 2^53.
```

All real and imaginary integer intermediate sums and products therefore fit
exactly in binary64. This argument applies to these two fixed prescriptions,
not arbitrary c. The code verifies integral coefficients, the bound and exactly
zero coefficients at degrees 0,1,2,3. It removes that common epsilon^4 factor
before using Horner evaluation. Exact trailing zero coefficients are trimmed;
the remaining polynomial degree is 11 for c=2i and 2 for c=0. The largest
absolute real/imaginary coefficients are 40/56 and 2/4 respectively.

The polynomial coefficients are exact here; their evaluation at a binary64
epsilon remains floating-point arithmetic. Direct evaluation instead forms
lambda1 and lambda2 first, multiplies dense matrices and normalizes the tiny
unscaled vector. The c*epsilon^4 correction eventually disappears when added
to i/2, and subtractive cancellation further damages the result. Reducing epsilon
can thus improve the analytic limit while worsening the direct calculation.

## Norms and recorded results

For each available nonzero vector, let psi be its normalization to Euclidean
norm one. Report

```text
r_H = ||H psi - J psi||_2 / J
d = min_theta ||exp(i theta) psi - chi||_2
E_expect/J = real(psi^* H psi)/J.
```

The phase distance is computed by aligning the overlap and subtracting vectors,
not by the cancellation-prone expression `sqrt(2-2*abs(overlap))`. Raw norms are
reported separately: the stable vector has already been divided by epsilon^4;
the direct vector has not. Direct evaluation also reports its phase distance
from the stable normalized state. A zero vector has `available:false` and an
explanation, with no undefined normalized residual or NaN. Nonfinite direct
vectors cause a failed check.

| epsilon | Correct stable r_H | Correct direct r_H | Naive stable r_H |
|---:|---:|---:|---:|
| 1e-2 | 1.4140e-2 | 1.4140e-2 | 0.408194 |
| 1e-4 | 1.4142e-4 | 0.0378841 | 0.408248 |
| 1e-6 | 1.4142e-6 | 0.408413 | 0.408248 |
| 1e-8 | 1.4142e-8 | 0.671015 | 0.408248 |

These are rounded results, not certified bounds. The correct stable distance
is approximately 2 epsilon and its residual approximately sqrt(2) epsilon.
The direct column describes the recorded environment; cancellation-sensitive
values can differ on another platform. In the naive limit the raw norm is
sqrt(12), the Rayleigh energy is J, yet r_H=1/sqrt(6). This is a genuine
eigenvector failure despite the correct energy expectation.

The cleared equations used for the root diagnostic are

```text
F_j = (lambda_j+i/2)^4 (lambda_j-lambda_k-i)
      - (lambda_j-i/2)^4 (lambda_j-lambda_k+i), k != j.
r_B = max_j abs(F_j).
```

`r_B` is an absolute polynomial residual in the stated dimensionless spectral
convention, not a normalized rational-equation residual. The code evaluates its
polynomial coefficients with the common epsilon^4 removed, and records both
`r_B` and `r_B/epsilon^4`. The naive case has exactly `r_B=2 epsilon^4`;
the correct case has `r_B=8 epsilon^5+O(epsilon^7)`. At epsilon=1e-8 the correct
value is approximately 8e-40, but its state residual is approximately 1.4142e-8.
These quantities answer different questions.

Every exact four-site state check and each transfer-polynomial coefficient
check returned zero. The largest relative generic transfer-vector residual
was 7.98e-17 (rounded upward), using
`||tau chi-Lambda chi||_2/max(1,||tau chi||_2,abs(Lambda))`.
The independent Hamiltonian entry discrepancies, in units J, were zero.

## The odd-chain negative control

For N=5 the formal Baxter candidate from `Q(lambda)=lambda^2+1/4` is

```text
Lambda_N(lambda) = (lambda+i/2)^(N-1) (lambda-3i/2)
                 + (lambda-i/2)^(N-1) (lambda+3i/2).
```

At lambda=i/2 it would give the translation eigenvalue
`Lambda_N(i/2)/i^N=-1`. That is impossible for N=5 since U^5=I.
The code evaluates this candidate and checks the exact bit-rotation identity.
Independently, Fraction arithmetic gives `det(H/J-I)=-1/256` in the
ten-dimensional two-down-spin block, proving there is no energy J there.
Numerical diagonalization corroborates this: the nearest energy distance from
J, in units J, is 0.118033988749895. The exact determinant, rather than a tiny
numerical eigenvalue gap alone, supplies this finite-sector rejection.

## What --check compares

The complete input object must equal the saved input object exactly. Stable
results and exact checks are compared with absolute tolerance 2e-12 and relative
tolerance 1e-8; independent identity checks also require residuals at most
2e-12. Runtime version strings are informational. The naive limit must reproduce
both r_H=1/sqrt(6) and energy expectation J; the exact five-site determinant must
equal -1/256.

The fields under `direct_unscaled_vector` are explicitly excluded from strict
saved numerical comparison because their purpose is to exhibit ill-conditioning.
They are recomputed, retained in fresh output, and required to be finite before
normalization. A zero vector is reported as unavailable. For each regulator at
least 0.01, fresh direct evaluation must be nonzero and its normalized state must
agree with the stable calculation within phase distance 1e-8. No lower bound on
small-epsilon direct error is imposed: a platform computing it more accurately
should pass. This exemption does not apply to stable results, exact identities,
negative controls or inputs.

## Figure generation

The Research article plots three saved residual series with
`figures-src/singular-xxx/regularization.py`. From the repository root, with
Matplotlib 3.9.4 installed, run:

```sh
python3 figures-src/singular-xxx/regularization.py
```

This reads `results.json` without recomputing or smoothing its samples and
regenerates `public/figures/singular-xxx/regularization.svg`. Both axes are
logarithmic; distinct line styles and markers identify the three calculations.
Matplotlib is needed only to regenerate the figure, not to run the experiment.

## Source convention

Rafael I. Nepomechie and Chunguang Wang, *Algebraic Bethe ansatz for singular
solutions*, Journal of Physics A: Mathematical and Theoretical 46 (2013),
325002. [DOI:10.1088/1751-8113/46/32/325002](https://doi.org/10.1088/1751-8113/46/32/325002),
[arXiv:1304.7978v3](https://arxiv.org/abs/1304.7978v3),
[PDF](https://arxiv.org/pdf/1304.7978v3), §§1–2 and Appendix. The HTML rendition
uses different equation numbering from this PDF.

The source uses `B_NW(lambda)=(lambda+i/2)^(-N) B_site(lambda)` and
`H_site=-J H_NW`. A nonzero scalar changes an unnormalized Bethe vector but not
its normalized state up to phase at finite epsilon. At the singular limit that
scalar can vanish or diverge, so limiting unnormalized vectors cannot be
compared without translating conventions. The polynomial construction, checks
and rational determinant here are original implementations of this finite
reproduction. The accompanying articles explain the source derivation and
the distinction between a known baseline, a bounded extension and a novelty
claim.
