Metadata-Version: 2.4
Name: CPax
Version: 2026.10.0
Summary: CPax: A JAX-based computational physics library.
Author: Jan Lukas Späh
License: MIT
Project-URL: Source, https://github.com/JaLuka98/CPax
Project-URL: Tracker, https://github.com/JaLuka98/CPax/issues
Keywords: physics,computational,jax,autograd,ODE,PDE
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: diffrax<0.8,>=0.7.2
Requires-Dist: equinox>=0.13.8
Requires-Dist: jax>=0.11
Requires-Dist: numpy>=2.0
Requires-Dist: matplotlib>=3.7
Requires-Dist: pillow>=13.0.0
Dynamic: license-file

# CPax

**CPax** is an open-source, JAX-based library for computational physics.
It separates physical **systems**, **problems**, **solvers** and
**solutions** in reusable workflows. The current implementation supports
continuous-time initial-value problems and classical mechanics; additional
physical domains are planned, not yet implemented.

**[Documentation](https://cpax.readthedocs.io/en/latest/)** ·
**[Source](https://github.com/JaLuka98/CPax)** ·
**[Issues](https://github.com/JaLuka98/CPax/issues)**

## Installation

Clone the repository, then run `uv sync` to create a reproducible
development environment. CPax currently requires Python 3.12 or newer.

## Quickstart

```python
import cpax
from cpax.mechanics import NewtonianSystem, PhaseSpaceState

system = NewtonianSystem(potential=lambda q: q**2 / 2, mass=1.0)
problem = cpax.IVP(system, PhaseSpaceState(1.0, 0.0), (0.0, 10.0))
solution = cpax.solve(problem, saveat=cpax.SaveAt.linspace(500))

print(solution.ys.q)  # Position
print(solution.ys.p)  # Canonical momentum
```

The same workflow supports the conservative Duffing oscillator, the
built-in `cpax.dynamics.LorenzSystem`, and multibody Newtonian gravity.
See the [examples](examples/) and documentation for complete scripts,
plots, and the animated Sun–Earth–Mars–Jupiter–comet showcase.

The default `solver="auto"` currently selects Diffrax Tsit5 for IVPs.
It does not infer stiffness or symplectic structure. A standalone
symplectic leapfrog integrator is preserved in `cpax.ode`.

## Development

CPax uses **uv**, **Ruff**, and **ty**:

```shell
uv sync
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run ty check
uv run sphinx-build -W -b html docs/source docs/_build/html
```

Releases use calendar versions `YYYY.M.N`. The manual GitHub Actions
release workflow supports non-publishing previews and publishing from
`main`. See the workflow for its latest controls and validation. Publishing to PyPI\nis a separate, manually approved process described in\n[the release guide](docs/publishing.md).
