Skip to content

Equation Solving

The pytanga.solver submodule converts geometric algebra product equations (A ∘ X = Y) into linear systems and solves them. The three solvers — solve, solve_lsq, and solve_mod — are free functions that derive blade masks automatically from the input multivectors, build a product matrix via the matrix primitives, and delegate to numpy.linalg for floating‑point systems or to C++ Gaussian elimination for modular integer systems. The blade mask pipeline explains how product_blade_mask and inverse_blade_mask determine the subspace of the unknown. EProduct and EInv enums control which GA product is used and whether involutions are applied.

from pytanga.solver.solve import solve, solve_lsq, solve_mod

Reference

Topic Guide
solve, solve_lsq, solve_mod — high‑level solver interfaces Solvers
product_blade_mask, inverse_blade_mask — automatic subspace derivation Blade Mask Pipeline
to_matrix, from_matrix, product_matrix — matrix building functions Matrix Primitives
EProduct, EInv enums and input coercion Enums & Coercion

Quick start

from pytanga import Algebra, BladeMask
from pytanga.basis import BasisE3
from pytanga.geometry import RndMV
from pytanga.solver.solve import solve
import numpy as np

alg = BasisE3(dtype="float64")

# Solve A * X = 1 (multiplicative inverse)
full = BladeMask.full(alg)
A = RndMV(full, [(-1.0, 1.0)] * len(full))(np.random.default_rng(42))
X = solve(A, 1.0, algebra=alg)

# Verify
check = A * X
check.prune()
print(check)   # "1.0"