An interactive bc-style calculator with rationals, complex numbers, matrices,
user-defined functions and degree-2 equation solving. All numeric types are
written from scratch: no native complex, no external library. A 42 Abu Dhabi project.
python3 computorv2.py
Then type expressions. exit, quit or EOF ends the session.
python3 test_computorv2.py
- Supports
+ - * / %, integer power^, matrix multiplication**against term-to-term*, parentheses, unary minus and implicit multiplication (4x,2i,2(...)). - Known gap: function display constant-folds but does not combine like terms
across a symbolic term, so
funC(x) = 4x + 5 - 2prints as written rather than4 * x + 3. Numeric evaluation is exact; only the printed form differs. - Matrix power via
^is not implemented. PROGRESS.mdis the development log.
- Function display only constant-folds. Collect the body as a polynomial form
before printing, so
funC(x) = 4x + 5 - 2shows as4 * x + 3. - Implement matrix power via
^. - Support
= ?to echo a stored variable or function.