Repository navigation
Pycodemath 0.2.0 — first public release
Token-efficient exact math for AI agents — one short command in, one exact SymPy/NumPy result out. Built as a disciplined layer over SymPy + NumPy, with an MCP server so any agent (Claude Code included) can plug it in.
Highlights
- Full ODE suite — symbolic
dsolve; fixed-step RK4; adaptive Dormand–Prince 5(4); dense output (callablesol(t)); event detection with terminal events; stiff solvers (BDF2 + Newton) incl. variable-step BDF2; backward integration everywhere. Singularities/divergence raise a readable error — never NaN/garbage. - ODE codegen — standalone RK4 / DOPRI5 / dense-output integrators, bit-for-bit identical to the engine.
- Second-order optimization —
min/min_ndwithmethod newton|bfgs+ Armijo line search (converges on Rosenbrock where gradient descent stalls). - Symbolic extensions — limits (one-sided, at
oo), Taylor/Laurent series, finite & symbolic summation (divergent sums refuse cleanly). - Hardened parser — whitelist-only function resolution;
__import__/eval/open, string literals and attribute access rejected; bounded evaluation cost.
Quality
230 tests passing on Ubuntu + Windows (Python 3.11 / 3.12), mypy clean.
Install
pip install -e . # core
pip install -e .[mcp] # + MCP server for AI agents
See the README for the Claude Code skill guide and full command table.