An interactive calculator and REPL built in Rust on top of the
Koto language, with an
Algebraeon module for exact algebra:
N (natural numbers), Z (integers), Q (rationals), Poly
(polynomials), Mat (matrices), Quat (Hamilton quaternions), Alg (real
algebraic numbers), ComplexAlg (complex algebraic numbers), Perm/Group
(group theory), FF (finite fields), CF (continued fractions), and more.
The compatibility aliases NN, ZZ, and ZZn remain available during the
0.2 transition, but new code should use N, Z, and Zn.
cargo build --release
# or to install globally:
cargo install --path .# Start the REPL
koto_calc
# Run a script
koto_calc examples/fibonacci.koto
# Evaluate an expression directly
koto_calc -e "print (1..10).sum()"
# Run tests embedded in a script
koto_calc -t script.kotoAlgebraeon is what turns koto-calc into more than a general-purpose REPL. It provides arbitrary-precision integers and rationals, exact algebraic numbers, polynomials, matrices, finite fields, permutations and groups, quaternions, continued fractions, and more — without hidden floating-point rounding.
from algebraeon import Q, Poly
print Q(1, 3) + Q(1, 6) # 1/2
print Poly([6, -5, 1]).factor() # [(-2 + x, 1), (-3 + x, 1)]
Explore the Algebraeon exact-algebra toolbox.
Full documentation is available at https://eloitor.github.io/koto-calc/.
- Algebraeon Overview
- Algebraeon Full Reference
- Language Guide
- Core Library Reference
- Library Modules
- CLI Reference
MIT
koto-calc is built on the Koto language (also MIT), with the Algebraeon module providing exact arithmetic.