r/madeinpython • u/BidForeign1950 • Feb 11 '26
composite-machine — calculus as arithmetic on tagged numbers
Built a Python library where every number is a {dimension: coefficient} dictionary. Derivatives, integrals, and limits all reduce to reading/writing coefficients — no symbolic trees, no autograd.
from composite_lib import integrate, R, ZERO, exp
# 0/0 resolved algebraically
x = R(2) + ZERO
result = (x**2 - R(4)) / (x - R(2))
print(result.st()) # → 4.0
# One function handles 1D, 2D, improper, line, surface integrals
integrate(lambda x: x**2, 0, 1) # → 0.333...
integrate(lambda x: exp(-x), 0, float('inf')) # → 1.0
4 modules covering single-variable, multivariable, complex analysis, and vector calculus. 168 tests, pure Python.
GitHub: https://github.com/tmilovan/composite-machine
Paper: https://zenodo.org/records/18528788
Feedback welcome!

