SageMath and Scientific Computation
SageMath 10.9 ran a focused exact symbolic check in a pinned Docker image, while the engine still has no Sage adapter or claim-bound result.
The engine’s host probe says SageMath is absent:
sagemath available: False | reason: none of sage was found on PATH
And yet this chapter shows SageMath output. That is not a contradiction. The probe
checks the host PATH; the run below happened inside the official Docker image.
Being available in a container is not the same as being integrated into the
engine. The engine’s sagemath.probe.v1 registry entry still says “SageMath
capability only; no evidence”, and the manual sagemath-lane remains unrun in the
hosted record.
The failure to keep in view is subtler than a missing tool. A tool can run and produce a correct-looking expression while the claim, the domain and the evidence record remain unbound. A successful Sage process is not a successful investigation.
SageMath is a candidate computer-algebra system for the book. This chapter
records a reproducible SageMath 10.9 run in a pinned container, and what it does
and does not add. There is still no Sage EvidenceResult, no claim ID and no
cross-system binding. The chapter builds on the status ladder
(Chapter 3) and the SymPy chapter (Chapter 9).
The run
The script is ch14_sagemath_demo.sage. It repeats the algebra already shown in Chapter 9 and Chapter 20, namely the gamma residual
sagemath 10.9
ch14 gamma residual (symbolic v): 0
ch14 same residual at v=2 (outside |v|<1): 0
ch14 gamma^2(1-v^2)-1 at v=2 directly: 0
ch14 algebraic residual, factored: -(g^2*v^2 - g^2 + 1)*(t + x)*(t - x)
ch14 shear residual, factored: -(tt*vv + 2*xx)*tt*vv
ch14 shear residual at t=1, x=0, v=1/2: -1/4
ch14 exact rational check: 5/6
No new mathematical claim is introduced.
What the output means
The gamma residual simplifies to $0$ for symbolic $v$. The algebraic residual factors, up to Sage’s sign and ordering, as
The $v=2$ line is the important one. Sage returns $0$ there, even though $\lvert v\rvert<1$ is false and the real square root is not defined. Like SymPy, the simplification works over a complex square root and does not enforce the physical side condition. The domain warning from Chapter 9 is not hypothetical.
What is still missing
- The
sagemathExternalToolSpechas no source path, command or claim ID, so it cannot produce anEvidenceResult. - The script is an illustrative teaching example. It is not a versioned claim and does not appear in a case manifest.
- The false-shear residual is a negative control at the level of an expression, not an adapter’s negative-control record.
- No claim has a Sage binding, so there is no L0–L4 correspondence audit.
- No human review of the script or its mathematical interpretation is recorded.
A future Sage adapter would be a computational system, not a kernel. Its strongest
appropriate status would be computation_verified_within_stated_domain, never
formally_verified.
Where Sage would matter
The book’s longer-term plan needs tools beyond a handful of real variables. None of these topics is in this edition:
| Planned topic (old outline chapter) | Why SymPy alone may not be enough |
|---|---|
| Lorentz group and rotations in 3+1 dimensions (23) | Matrix groups, exact linear algebra |
| Tensors and index notation (24) | Tensor algebra at scale |
| Curvature of a metric (25) | Symbolic differential geometry |
| Numerical comparison with data (28, 34) | Floating point, with error control |
Only the scalar residual check has been tried. Whether Sage is the right tool for tensor, geometric or numerical work remains open, and the decision whether to reuse Physlib (the MATH04 milestone) is a separate gate.
What this establishes
Sage and SymPy agree on the gamma residual and on the shape of the algebraic and shear factorizations at this scale. That is an informal comparison of two teaching scripts, not a cross-system claim contract; no L0–L4 result is claimed.
A computer-algebra system is most dangerous exactly where it is most helpful: it returns confident closed forms for expressions whose side conditions it never checked. Sage’s $v=2$ result shows the SymPy lesson again, concretely. That is why the book treats Sage as a computational tool, not as physical validation or a proof kernel. The script is short enough to check by hand, but no human review is recorded.
Try it yourself
docker run --rm -v "$PWD:/work" -w /work \
sagemath/sagemath:10.9 \
sage /work/content/examples/math/tool-chapters/ch14_sagemath_demo.sage
Run it from the repository root. The host probe can be rerun too:
PYTHONPATH=src uv run python content/examples/math/tool-chapters/ch13_16_probe_and_audit_demo.py
It will still report sagemath available: False, because Docker does not put
sage on the host PATH. That is a fact about the host, not the container.
Turning this into an engine result, rather than an illustrative run, would take five steps:
- Add a Sage adapter with a source path, command, claim ID and encoded domain.
- Add a negative control that the adapter must reject or mark as a mismatch.
- Run it through the case runner (Chapter 16) and record the
EvidenceResult. - Compare the factorization with SymPy under the cross-system contract (Chapter 15).
- Decide how numerical error bounds would be represented if Sage is used for floating-point work.
Open questions.
- Does Sage add a kind of evidence the engine lacks, or only a faster path to
computation_verified_within_stated_domain? - Is one exact scalar example enough to justify the chapter, or should it wait for an adapter and a claim-bound result?
- How should a Sage result record its ring or field (
QQ,RR,AA, the symbolic ring) alongside the computation?
Evidence record
Executed, illustrative. The recorded command, run on 2026-11-09, was:
docker run --rm -v "C:/Projects/math:/work" -w /work \
sagemath/sagemath:10.9 \
sage /work/content/examples/math/tool-chapters/ch14_sagemath_demo.sage
The image was pulled as sagemath/sagemath:10.9, digest
sha256:e068670ae5863b54b2550e72437ec637b0283acb0dc712c8584c124dbf44e667,
SageMath version 10.9. This is not an engine evidence bundle. The host probe
still reports SageMath as not_installed, and the manual sagemath-lane remains
skipped in hosted runs.
Sources
- The Sage Developers, SageMath, the Sage Mathematics Software System (2025), https://doc.sagemath.org/
In the repository: src/math_engine/adapters/external.py (the sagemath spec),
docs/architecture/adapter-registry.md,
docs/research/formalization-landscape.md and the example script. The image tag
and digest are part of the execution record, not a mathematical citation.