algebra-ai999x — offline, verified algebra solver with step-by-step answers
Install · Capability guide · ONNX models · Evaluation · AI999X on Hugging Face · Website · Support: Buy Me a Coffee
License: Apache-2.0 · Author: Ibnul Jaif Farabi (creator and engineer) · Organization: AI999X · Version 2.0.0
algebra-ai999x is an offline, deterministic Python solver that answers algebra questions with verified results from 56 certified capabilities, gives 230 documented answers identically on Windows and Linux, and refuses rather than guesses when an answer cannot be verified.
algebra-ai999x is a compact, deterministic algebra engine for Python. It reads a question in plain English (or a typed call), picks a certified algebra capability, computes the answer exactly, checks it, and returns the result with its steps, units, LaTeX and assumptions — or an honest refusal that says what is missing. It runs fully offline on any CPU, needs no GPU, no API key and no internet, and is built to give zero wrong answers: when it is not sure, it refuses instead of guessing.
Highlights
- Verified, not generated. Every answer is computed by a certified algebra capability and checked (substituted back, dimension-checked or compared with an independent computation) before it is returned.
- Zero wrong answers by design. Seven explicit outcomes — SOLVED, NEEDS_INPUT, AMBIGUOUS, INVALID_INPUT, OUT_OF_SCOPE, UNRECOGNIZED_FORMAT, INTERNAL_ERROR — never a silent guess. Every one of its 230 documented answers is reproduced exactly on every tested platform.
- Plain-English questions and a guaranteed typed interface.
ask() reads documented question forms; solve(capability_id, **inputs) always solves a supported task with valid inputs.
- Explains itself. Steps, formulas in LaTeX, units, assumptions and the model used, ready for notebooks, tutoring apps and homework checkers.
- ONNX included. 32 deterministic formula graphs (
onnx/formulas/, 11.4 KB) + decision model (onnx/decision.int8.onnx, 37.1 MB int8): run the exact formulas without Python — onnxruntime in C++, C#, Java, JavaScript or the browser; 1,200 of 1,200 checks agree with the Python engine.
- Small and portable. Pure Python (sympy, mpmath); identical answers on Windows and Linux (Python 3.10, 3.11, 3.12, 3.13, 3.14).
- Coverage: quadratic equations, linear equations and systems, inequalities and absolute value, functions and composition, exponents and logarithms, sequences and series, counting, matrices, and certified proofs of identities and theorems.
Model overview
| Property |
Value |
| Package |
algebra-ai999x 2.0.0 (import algebra_ai999x) |
| Type |
Deterministic neuro-symbolic algebra engine (rule-based reading + certified symbolic capabilities) |
| Capabilities |
19 certified derivations, 37 certified procedures |
| Knowledge pack |
version 0.3.0 |
| Golden answers |
230 documented answers, identical on every tested platform |
| Platforms tested |
Windows (Python 3.13), Linux x86-64 (Python 3.10, 3.11, 3.12, 3.13, 3.14) |
| ONNX |
32 deterministic formula graphs (onnx/formulas/, 11.4 KB) + decision model (onnx/decision.int8.onnx, 37.1 MB int8) |
| Runtime |
CPU only, offline; no GPU, no network, no API key |
| License |
Apache-2.0 |
| Creator / engineer |
Ibnul Jaif Farabi |
| Organization |
AI999X |
Quickstart
pip install algebra-ai999x
# or straight from this repository:
pip install https://huggingface.co/AI999X/algebra-ai999x/resolve/main/dist/algebra_ai999x-2.0.0-py3-none-any.whl
import algebra_ai999x as algebra
algebra.ask("Solve x^2 - 5x + 6 = 0.").show()
# -> SOLVED — x1 = 2, x2 = 3, discriminant = 1 (quadratic_roots)
algebra.solve("quadratic_roots", a=1, b=0, c=4).show()
# -> SOLVED — x1 = 2j, x2 = -2j, discriminant = -16 (quadratic_roots)
algebra.solve("linear_system_2x2", a=2, b=3, c=12, d=4, e=-1, f=10).show()
# -> SOLVED — x = 3, y = 2 (linear_system_2x2)
algebra.ask("Prove that (a + b)^2 = a^2 + 2ab + b^2.").show()
# -> SOLVED — 1. (a + b)**2 = (a + b) * (a + b) [definition of squaring] (perfect_square_trinomial)
algebra.solve("quadratic_roots", a=0, b=2, c=1).show()
# -> INVALID_INPUT — Roots of a quadratic equation: a must not be 0: with a = 0 the equation is linear, not quadratic.
algebra.ask("Who created you?").message
# -> algebra-ai999x was created and engineered by Ibnul Jaif Farabi at AI999X.
Command line: algebra-ai999x "<question>", algebra-ai999x --capabilities. The outputs above were produced by running this exact code on algebra-ai999x 2.0.0.
Find the right capability, and draw it
algebra.search() finds which certified capability a question is about — across every AI999X model, so a question for another model points you to it. It runs the AI999X capability encoder (a 4.9 MB ONNX model, offline): pip install "algebra-ai999x[search]". ask(question, suggest=True) adds the same pointers to a question it does not answer; an answer itself never changes.
import algebra_ai999x as algebra
algebra.search("Find both roots of a quadratic equation", k=2)
# -> Roots of a quadratic equation (algebra-ai999x, 0.87); Discriminant of a quadratic (algebra-ai999x, 0.81)
algebra.search("How much pressure is at the bottom of a 3 m deep pool?", k=2)
# -> Absolute pressure at a depth in a fluid (physics-ai999x, 0.61); Pressure of a column of fluid (physics-ai999x, 0.50)
How every answer is verified
- Reading — the question is turned into typed quantities (value, unit, kind, role) and one asked quantity; every stated number must be used or the question is refused.
- Planning — only certified capabilities may answer; a capability applies only under the conditions the wording states (for example a pendulum, a liquid at rest, boiling).
- Computing — exact symbolic or high-precision numeric evaluation.
- Checking — dimensions, substitution back into the defining equation, and agreement between independent readings; any disagreement becomes a refusal, never a number.
Capabilities are certified before they ship: each must reproduce hand-worked reference cases, reject a deliberately wrong variant (a control), and leave every benchmark answer unchanged.
Optional decision model (auto (gated) + suggest)
This repository also holds a compact ONNX decision model (onnx/, 37.1 MB int8, 33.4M parameters, CPU; fine-tuned from BAAI/bge-small-en-v1.5): it reads a question the rule-based reader refuses, names the capability it needs and copies the input values from the words (it never writes a digit itself).
When it answers by itself: only through a gate — confidence at or above the zero-wrong cut chosen on validation with this very file, every required input read, every number in the question used, and the engine's verification. The answer says it was read by the model. Otherwise it suggests the capability and a pre-filled call for you to check.
| Measured (held-out questions the rule-based reader refuses) |
Value |
| Right capability named |
15 of 15 answered (88 questions), 0 wrong |
| Input values copied |
11 of 15 exact, 0 wrong (4 incomplete: it asks) |
| CPU latency, p95 |
35.5 ms (4 threads) |
On the whole held-out test set it answered 364 questions with 0 wrong.
pip install "algebra-ai999x[onnx]"
hf download AI999X/algebra-ai999x --include "onnx/*" --local-dir algebra_model
import algebra_ai999x as algebra
reader = algebra.DecisionReader("algebra_model/onnx")
algebra.ask("Solve for x in the equation 3x - 7 = 14.", reader=reader).values # -> {'x': 7.0}, read by the model, verified by the engine
algebra.ask("checking my homework: 3x - 7 = 14, what is x?", reader=reader).message
# -> ... Suggestion (decision model, not verified): this looks like `linear_equation_root` ...
Why the gate: the engine verifies a computation, not a reading — a misread minus sign would be solved perfectly and still be wrong. The model answers by itself only because it copied every value exactly on held-out questions (signed spans); anything less confident stays a suggestion.
ONNX formula pack (deterministic, no Python needed)
onnx/formulas/ holds 32 tiny ONNX graphs (11.4 KB in total): every certified closed-form capability compiled from its exact formula — not learned, so there is nothing approximate in them. Float64, standard operators only; run them with onnxruntime in Python, C++, C#, Java or in the browser (onnxruntime-web).
Verified against the Python engine: 1,200 of 1,200 checks agree, worst relative error 8.9e-16. onnx/formulas/procedures.json lists each graph's inputs (SI units), outputs and, where a formula has several solution branches, which one to take.
import numpy as np, onnxruntime as ort
s = ort.InferenceSession("onnx/formulas/abs_value_inequality_lower_bound.onnx")
print(s.run(None, {"c": np.array(2.0), "d": np.array(2.0)}))
import * as ort from "onnxruntime-web";
const s = await ort.InferenceSession.create("onnx/formulas/abs_value_inequality_lower_bound.onnx");
const out = await s.run({ c: new ort.Tensor("float64", new Float64Array([2.0]), []), d: new ort.Tensor("float64", new Float64Array([2.0]), []) });
Find the exact formula, never guess (autocomplete): onnx/formulas/catalog.json is a search index of every graph (names, keywords, the unknown it solves for, inputs with SI units, LaTeX). formula-pack.js searches it, describes an entry and runs the exact graph with the branch rule; formula-pack.d.ts gives your editor every formula id and input name.
import { loadPack } from "./formula-pack.js";
const pack = await loadPack("https://huggingface.co/AI999X/algebra-ai999x/resolve/main/onnx/formulas");
pack.search("absolute value");
Guidebook: docs/algebra_ai999x_onnx_formulas.md (also HTML and PDF) documents every graph — LaTeX, inputs and units, branches, conditions — each with an example executed on the ONNX file and compared with the Python engine.
Reading questions in words stays in the Python package (and the optional decision model); the formula pack is the compute half, for apps, calculators and edge devices.
Capabilities
19 certified derivations, 37 certified procedures. A few of them:
- Derivations: area of rectangle; associative property of addition; cramer rule x solution; determinant cramer two variables; difference of cubes factorization; difference of squares; distributive property verification; elimination method identity; elimination solution two variables; linear equation solution formula; partial fraction decomposition linear factors; perfect square trinomial; product of sums; quadratic vertex form conversion; radical equation squaring; square of difference; substitution method identity; substitution solution two variables; sum of cubes factorization
- Procedures: Add rational expressions with same denominator; Asymptotes of a linear rational function; Average rate of change between two points; Average rate of change of a function between two inputs; Centre and radius of a circle from its general equation; Combinations and permutations; Composition of two linear functions; Compound interest; Determinant and inverse of a 2 by 2 matrix; Determinant of 2x2 matrix; Discriminant of a quadratic; Distance between two points; Doubling time of exponential growth; Factoring a monic quadratic; Line through two points; Matrix scalar multiple definition; Midpoint of a line segment; Multiply rational expressions; Perimeter of a rectangle; Product and modulus of complex numbers; Product of two binomials; Root of a linear equation; Roots of a cubic equation; Roots of a quadratic equation …
algebra_ai999x.templates() lists every question form ask() reads; the capability guide (PDF, every example executed) is included in this repository.
All 37 formulas
Matrices and linear systems
Determinant of 2x2 matrix
$$
\text{det} = a d - b c
$$
Matrix scalar multiple definition
$$
b_{11} = s a_{11},\quad b_{12} = s a_{12},\quad b_{21} = s a_{21},\quad b_{22} = s a_{22}
$$
Rational expressions
Add rational expressions with same denominator
$$
\text{sum num} = \text{num}{1} + \text{num}{2},\quad \text{sum den} = \text{den}
$$
Multiply rational expressions
$$
\text{prod num} = \text{num}{1} \text{num}{2},\quad \text{prod den} = \text{den}{1} \text{den}{2}
$$
Complex numbers
Product and modulus of complex numbers
$$
\operatorname{Re} = a c - b d,\quad \operatorname{Im} = a d + b c,\quad \text{modulus}^{2} = \left(a^{2} + b^{2}\right) \left(c^{2} + d^{2}\right)
$$
Conic sections
Centre and radius of a circle from its general equation
$$
\left(t - h\right)^{2} + \left(w - k\right)^{2} - \text{rad}^{2} = t^{2} + w^{2} + d_{d} t + e_{e} w + f_{f}
$$
Coordinate plane
Distance between two points
$$
\text{dist}^{2} = \left(x_{2} - x_{1}\right)^{2} + \left(y_{2} - y_{1}\right)^{2}
$$
Counting and probability
Combinations and permutations
$$
\binom{n}{k} = \frac{n!}{k!\,(n-k)!},\quad P(n,k) = \frac{n!}{(n-k)!}
$$
Exponential functions
Compound interest
$$
\ln\left(\text{amount}\right) = \ln\left(\text{principal}\right) + n t \ln\left(1 + \frac{r}{n}\right)
$$
Exponential models
Doubling time of exponential growth
$$
k t_{d} = \ln\left(2\right)
$$
Exponents and logarithms
Solution of an exponential equation
$$
x \ln\left(b\right) = \ln\left(y\right)
$$
Factoring
Factoring a monic quadratic
$$
\left(t + p\right) \left(t + q\right) = t^{2} + b t + c
$$
Functions
Average rate of change of a function between two inputs
$$
\text{arc} \left(x_{\text{end}} - x_{\text{start}}\right) = f_{x,end} - f_{x,start}
$$
Composition of two linear functions
$$
m t + k = a \left(c t + d\right) + b
$$
Inequalities
Solution of a linear inequality
$$
a x_{0} + b = c,\quad s \sqrt{a^{2}} = a
$$
Linear and absolute value inequalities
Solution interval of |x - c| < d
$$
\text{upper} - \text{lower} = 2 d,\quad \text{upper} + \text{lower} = 2 c
$$
Solution set of |x - c| > d
$$
\text{right limit} - \text{left limit} = 2 d,\quad \text{right limit} + \text{left limit} = 2 c
$$
Linear equations
Root of a linear equation
$$
a x + b = c
$$
Linear functions
Average rate of change between two points
$$
m \left(x_{2} - x_{1}\right) = y_{2} - y_{1}
$$
Line through two points
$$
m x_{1} + k = y_{1},\quad m x_{2} + k = y_{2}
$$
Slope of a perpendicular line
$$
m m_{\text{perp}} = -1
$$
y-intercept of a line from its slope and a point
$$
y_{1} = m x_{1} + b
$$
Logarithms
Solution of a basic logarithmic equation
$$
\ln\left(x\right) = c \ln\left(b\right)
$$
Matrices
Determinant and inverse of a 2 by 2 matrix
$$
\text{det} = a d - b c,\quad a i_{11} + b i_{21} = 1,\quad a i_{12} + b i_{22} = 0,\quad c i_{11} + d i_{21} = 0,\quad c i_{12} + d i_{22} = 1
$$
Other equations
Solutions of an absolute value equation
$$
a x_{1} + b = c,\quad a x_{2} + b = -c
$$
Polynomial equations / cubic and quartic equations
Roots of a cubic equation
$$
a x^3 + b x^2 + c x + d = 0
$$
Roots of a quartic equation
$$
a x^4 + b x^3 + c x^2 + d x + e = 0
$$
Polynomial equations / quadratic equations
Discriminant of a quadratic
$$
\Delta = b^2 - 4ac
$$
Roots of a quadratic equation
$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$
Polynomials
Product of two binomials
$$
p_{2} t^{2} + p_{1} t + p_{0} = \left(a t + b\right) \left(c t + d\right)
$$
Quadratic functions
Vertex form of a quadratic function
$$
a \left(t - h\right)^{2} + k = a t^{2} + b t + c
$$
Rational functions
Asymptotes of a linear rational function
$$
c v_{a} + d = 0,\quad c h_{a} = a
$$
Real numbers and algebraic expressions
Perimeter of a rectangle
$$
p - 2 h = 2 w
$$
Sequences
Term and partial sum of a geometric sequence
$$
g_{n} = g_{1} q^{n - 1},\quad s_{n} \left(1 - q\right) = g_{1} \left(1 - q^{n}\right)
$$
Term and partial sum of an arithmetic sequence
$$
a_{n} = a_{1} + \left(n - 1\right) d,\quad 2 s_{n} = n \left(a_{1} + a_{n}\right)
$$
Systems of equations
Solution of two linear equations in two unknowns
$$
a x + b y = c,\quad d x + e y = f
$$
The coordinate plane and graphs
Midpoint of a line segment
$$
2 m_{x} = x_{1} + x_{2},\quad 2 m_{y} = y_{1} + y_{2}
$$
Out of scope
- Open-ended explanation, essay writing or tutoring dialogue: it is a solver, not a chatbot.
- Questions outside its certified algebra capabilities, and any question whose stated numbers it cannot all use — it refuses with the reason instead.
- High-stakes engineering, medical or legal decisions without independent review.
Limitations
- It answers what its certified capabilities cover (quadratic equations, linear equations and systems, inequalities and absolute value, functions and composition, exponents and logarithms, sequences and series, counting, matrices, and certified proofs of identities and theorems); anything else is refused with a reason.
ask() reads documented question forms and common phrasings; unusual wording may be refused — use solve() for guaranteed results.
- Results are as correct as the certified relations and their stated conditions; a certified relation is a checked model, not a claim about every physical situation.
Citation
@software{algebra_ai999x_2_0_0,
title = {algebra-ai999x: an offline, verified algebra solver},
author = {Farabi, Ibnul Jaif}, organization = {AI999X},
year = {2026}, version = {2.0.0},
url = {https://huggingface.co/AI999X/algebra-ai999x}
}
Contact
Questions, bug reports and requests: open a discussion on https://huggingface.co/AI999X/algebra-ai999x/discussions or visit https://ai999x.com.
Support the project
algebra-ai999x is free and open source. If it helps you, you can support further development on Buy Me a Coffee.
Created and engineered by Ibnul Jaif Farabi · AI999X · ai999x.com