A symbolic algebra system built from scratch in C++ with a web interface. Solves systems of linear equations by performing symbolic substitution and algebraic simplification, showing step-by-step derivations.
algedemo.mp4
Live: algebra-solver-nine.vercel.app
- Equation Solving — Solve for any variable in a system of linear equations
- Step-by-Step Solutions — View the substitution and simplification steps
- Expression Simplification — Simplify algebraic expressions with like-term combining and constant evaluation
- Variable Isolation — Isolate variables in equations through algebraic manipulation
The solver uses a graph-based approach to resolve variable dependencies:
- Parsing — Equations are tokenized and parsed into an AST (Abstract Syntax Tree)
- Normalization — Equations are converted to standard form (LHS - RHS = 0)
- Dependency Resolution — A priority queue explores substitution paths, favoring equations with fewer unknown variables
- Symbolic Substitution — Known variables are substituted into equations containing the target variable
- Simplification — After each substitution, expressions are simplified (constant folding, like-term combining, distribution)
- Isolation — Once reduced to a single variable, the equation is solved by isolating the target
This approach handles systems where variables depend on other variables, automatically determining the order of substitutions needed.
Input:
x + a = b * c
a = b + 2
c = 3
b = 4
Solve for: x
Steps:
1. Start: (x + a) - (b * c) = 0
2. Substitute c: (x + a) - (b * 3) = 0
3. Substitute a: (x + 2) - (2 * b) = 0
4. Substitute b: x - 6 = 0
5. Solved: x = 6
├── services/CAS/ # C++ Computer Algebra System
│ ├── src/
│ │ ├── core/
│ │ │ ├── lexer/ # Tokenizer
│ │ │ ├── parser/ # AST construction
│ │ │ └── solver/ # Simplifier, Isolator, EquationSolver
│ │ ├── binding.cpp # Python bindings (pybind11)
│ │ └── ...
│ └── CMakeLists.txt
│
└── webserver/
├── backend/ # FastAPI server
└── frontend/ # React frontend
- CMake 3.18+
- C++17 compiler
- Python 3.10+
- Node.js 18+
cd services/CAS
mkdir build && cd build
cmake ..
make
cd ../../webserver/backend
pip install -r requirements.txt
uvicorn src.main:app --reloadcd webserver/frontend
npm install
npm run dev- Linear equations only (no quadratics, polynomials, or transcendental functions)
- No support for inequalities
- Circular dependencies return no solution
MIT