Rich display in Jupyter
In a Jupyter notebook or Colab, panchi's objects render as typeset LaTeX instead of plain text — and every result object shows its full step-by-step derivation the way you'd write it on paper.
This is pure progressive enhancement. In a terminal or a script, print(...) and str(...) are exactly as before; the LaTeX only appears when a notebook asks for it, and the core library takes on no extra dependency.
Objects
Displaying a Vector, Matrix, or VectorSpace as the last line of a cell renders it as math:
import panchi as pan
pan.Matrix([[1, 2], [3, 4]])
renders as
Exact arithmetic pays off here — fractions typeset as fractions, with no floating-point noise:
pan.exact_matrix([["1/2", "1/3"], ["1/4", "1/5"]])
A VectorSpace renders as the span of its generators.
Operations show their work
Result objects render the derivation, not just the answer. A row reduction becomes the sequence of matrices it passes through, each arrow labelled with the row operation:
from panchi.algorithms import rref
rref(pan.Matrix([[1, 2], [3, 4]]))
The same holds across the library:
solve(A, b)renders the solution vector, or the full general solutionx = x_p + t\,vwhen there are infinitely many.lu(A)andqr_decomposition(A)render the factorizationA = LU/A = QR.inverse(A)rendersA^{-1} = ….eigen(A)renders the characteristic polynomial, its factored form, and each eigenspace;eigen_qr(A)renders each numerical eigenvalue with its eigenvector.
Visualizations
Plots and animations display inline in a notebook automatically — no save_path needed:
from panchi.visualizations import Animator2D
Animator2D().plot_vectors([pan.Vector([2, 1]), pan.Vector([1, 3])])
Animations play as inline players (via matplotlib's own HTML animation), so you can scrub through a transformation without leaving the notebook. Set a save_path to write files to disk instead, exactly as in a script.
The manim backend plays inline too. It renders to a file as usual, and when a manim call is the last line of a cell the notebook embeds that file: an .mp4 as a looping video player, a .gif as an image.
from panchi.visualizations import Animator2D
animator = Animator2D(backend="manim", quality="low", output_format="gif")
animator.animate_transform(pan.Matrix([[0, -1], [1, 0]]))
The file is embedded into the notebook itself, so the notebook still shows the animation after the file is moved or deleted. Use quality="low" while exploring to keep notebooks small and renders quick.