Skip to content
All products

Open Source · Python · MIT

mathSteps

Every step explained. Every answer verified.

A step-by-step symbolic and numerical math solver — like Symbolab or Mathway, but local, scriptable and open-source. NumPy, SciPy and SymPy give you the answer; mathSteps shows you how it was reached.

terminal
$ pip install mathsteps
$ mathsteps root --function "cos(x) - x" --method newton --x0 0

Solver: newton_raphson

Step 1: f(x) = -x + cos(x), f'(x) = -sin(x) - 1, x0 = 0.0
Step 2: x_new = x - f(x)/f'(x) = 1.0
Step 3: x_new = 0.7503638678402439
Step 4: x_new = 0.7391128909113617
  …
Step 8: Converged: |delta x| = 0.0 <= tol

Final answer: 0.7390851332151607
Verification: PASS
Solvers
21
Problem domains
4
Python
3.10+
Tests
180+

Why mathSteps

Libraries compute. mathSteps explains.

A step-tracking and explanation layer on top of the scientific Python stack — built for students, teachers and anyone who needs to show their work.

  • Every step, recorded

    Each result carries a list of steps with a description, the state before and after, and structured data — row swaps, pivots, iterations, Runge-Kutta stages.

  • Every answer, verified

    Answers are checked against NumPy, SciPy or SymPy with tolerances derived from each method's truncation error. verified is True, False — or None, never a silent pass.

  • Exact where it can be

    Plain floats and NumPy arrays for computation, plus the exact SymPy form — rationals, matrices, a ± √b eigenvalues — in result.exact.

  • CLI or library

    One subcommand per problem type, a free-form solve that detects the problem, JSON problem files, and an interactive ask wizard. Add --pretty for Rich tables.

Python library

One function per problem, one Result back

Import it in a script or notebook. Every call returns the same Result object, so steps, exact forms and verification work the same way everywhere.

  • result.answerfloat, ndarray or callable polynomial
  • result.exactthe exact SymPy form, where one exists
  • result.stepslist[Step] — the full breakdown
  • result.verifiedTrue / False / None vs NumPy · SciPy · SymPy
  • result.convergediterative solvers: False if max_iter ran out
  • result.detailsextra outputs: ODE/BVP grids, shooting slope…
example.py
import mathsteps

# find x where cos(x) = x
mathsteps.root("cos(x) - x", method="newton", x0=0.0).answer

# dy/dx = -2xy with RK4, whole trajectory kept
r = mathsteps.ivp("-2*x*y", y0=1, x_end=2, h=0.1, method="rk4")
t, y = r.details["x"], r.details["y"]

# interpolation returns a callable polynomial
p = mathsteps.lagrange([[0, 1], [1, 2], [2, 5]]).answer
p(3)     # 10.0
p.expr   # x**2 + 1

# exact determinant
mathsteps.determinant([[6,1,1],[4,-2,5],[2,8,7]]).exact  # -306

Coverage

21 solvers across four domains

From a 2×2 system to adaptive Runge-Kutta. Large problems are summarised automatically with detail=“summary”, so a 40×40 elimination doesn't flood you with 800 steps.

Linear algebra

06
  • Gaussian elimination
  • Gauss-Jordan inverse
  • Cofactor determinant
  • LU decomposition (Doolittle)
  • Eigenvalues & eigenvectors
  • Cramer's rule

Numerical analysis

08
  • Bisection
  • Newton-Raphson
  • Secant
  • Fixed-point iteration
  • Finite differences
  • Trapezoidal & Simpson's rule
  • Lagrange interpolation
  • Newton divided differences

Initial value problems

05
  • Forward Euler
  • Heun (improved Euler)
  • Midpoint (RK2)
  • Classical RK4
  • Adaptive Dormand-Prince RK45

Boundary value problems

02
  • Shooting method (RK4 + secant)
  • Finite-difference discretisation

Command line

Explore from the terminal

Direct subcommands, free-form equations that auto-detect their type, scripted JSON problem files with mathsteps verify exit codes for CI, and an interactive wizard.

mathsteps --help
  • $mathsteps linear-system --A "1 2; 3 4" --b "5 11"
  • $mathsteps root --function "x**3 - x - 2" --method newton --x0 1.5
  • $mathsteps ivp --f-expr "-2*x*y" --y0 1 --x-end 2 --h 0.1 --method rk4
  • $mathsteps solve "x**2 - 4 = 0"
  • $mathsteps ask

Show your work, automatically.

$ pip install mathsteps

Built by Debojit Basak & Tonni Rani Dey · Contributions welcome