Exact mathematics. Built from first principles.
By Umutcan EDIZASLAN
Python 3.11+ · Zero runtime dependencies · v0.2.0 alpha
Releases / Changes / Example / MIT license
- 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.
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).verifiedroots = 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
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.pyTests 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.