Skip to content
U-C4NPublic

About

Exact symbolic math library in pure Python with zero dependencies. A lightweight computer algebra system (CAS): solve equations & inequalities, find real polynomial roots, exact linear algebra & calculus, with independently verified results. Built for apps & AI agents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

MathForge

Exact mathematics. Built from first principles.
By Umutcan EDIZASLAN

Python 3.11+  ·  Zero runtime dependencies  ·  v0.2.0 alpha

Releases   /   Changes   /   Example   /   MIT license


New in v0.2

  • Exact algebra: polynomial division, gcd, square-free decomposition, and real roots with multiplicities.
  • More solvers: rational equations and inequalities that preserve excluded points, plus matrices and complete linear-system solutions.
  • Calculus and verification: repeated derivatives, polynomial integrals, independently checked results, and v2 JSON that preserves existing v1 records.

MathForge implements its own exact arithmetic with finite computation budgets. Verification is algorithmic, not formal proof. Complex roots, general transcendental calculus, and MCP are outside this alpha.

Quick start

From a local checkout:

python -m pip install -e .
import mathforge as mf

x = mf.symbol("x", domain=mf.Reals)
expression = x**2 - 2
result = mf.solve(mf.Eq(expression, 0), for_=x)

print(result.solution_set)         # {-sqrt(2), sqrt(2)}
print(mf.diff(expression, x))      # 2*x
assert mf.verify(result).verified

A taste of v0.2

roots = mf.real_roots(x**3 - x, x)  # -1, 0, 1 with multiplicities
rf = mf.rational_function(x**2 - 1, x - 1, variable=x)
assert mf.solve(mf.Eq(rf, 2), for_=x).outcome is mf.Outcome.NO_SOLUTION
assert mf.integrate(x**2, x, 0, 1) == mf.Rational(1, 3)
assert mf.det(mf.Matrix(((1, 2), (3, 4)))) == mf.Rational(-2)

Full workflow · Linear systems · Rational inequalities

Development

python -m unittest discover -s tests -v
python tools/check_docs.py
python -m pip install -r requirements-dev.txt
python -m build
python tools/check_distribution.py

Tests use Python's standard library. Build, schema, and typing tools are development dependencies only. docs/ is local working material and is excluded from Git and release packages.

About

Exact symbolic math library in pure Python with zero dependencies. A lightweight computer algebra system (CAS): solve equations & inequalities, find real polynomial roots, exact linear algebra & calculus, with independently verified results. Built for apps & AI agents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages