Geometrix
LLM-assisted LaTeX-first differential geometry renderer for Jupyter/Colab. Ask for symbolic solutions (with full derivations), then graph them immediately.
Flagship: LLM → Graph
From
examples/14_llm_assist2.py.
import sympy as sp
from google.colab import userdata
from geometrix import llm_solve, latex, show
from geometrix.api import SceneBundle
from geometrix.sample.domains import Domain
from geometrix.sample.surface import sample_surface_grid
from geometrix.scene.build import build_surface_scene
from geometrix.symbolic.compile import compile_vector
from geometrix.symbolic.llm import LLMConfig
config = LLMConfig(
provider="gemini",
model="gemini-3-flash-preview",
api_key=userdata.get("GEMINI_API_KEY"),
)
live = llm_solve(
"x^2 + y^2 + z^2 = 1",
config=config,
response_type="full",
wants_graph=True,
graph_dim=3,
)
graph_latex = live.data.graph # e.g., "z = \\sqrt{1-x^2-y^2}"
_, rhs = graph_latex.split("=", 1)
x, y = sp.symbols("x y")
z_expr = latex(rhs.strip())
domains = [Domain("x", -1.0, 1.0), Domain("y", -1.0, 1.0)]
compiled = compile_vector([x, y, z_expr], [x, y])
surface = sample_surface_grid(compiled, domains, [80, 80])
scene = build_surface_scene(surface.positions, surface.grid_shape)
show(SceneBundle(scene=scene, arrays={"positions": surface.positions}))
LaTeX-first differential geometry renderer for Jupyter/Colab. Write math in LaTeX, sample it numerically, and render with an interactive Three.js viewer.
Install
pip install geometrix
Quickstart (Notebook)
from geometrix import geom
scene = geom("""
coords: u v
X(u,v) = (u, v, 0)
render: surface X domain u:[0,1] v:[0,1] res 30 30
""")
scene.show()
LaTeX-First Workflow
import sympy as sp
from geometrix import latex, show
from geometrix.api import SceneBundle
from geometrix.sample.domains import Domain
from geometrix.sample.surface import sample_surface_grid
from geometrix.scene.build import build_surface_scene
from geometrix.symbolic.compile import compile_vector
u, v = sp.symbols("u v")
x = latex("u", show_latex_expr=True)
y = latex("v", show_latex_expr=True)
z = latex("\\sin(u)\\cos(v)", show_latex_expr=True)
compiled = compile_vector([x, y, z], [u, v])
surface = sample_surface_grid(
compiled,
[Domain("u", -sp.pi.evalf(), sp.pi.evalf()), Domain("v", -sp.pi.evalf(), sp.pi.evalf())],
[60, 60],
)
scene = build_surface_scene(surface.positions, surface.grid_shape)
show(SceneBundle(scene=scene, arrays={"positions": surface.positions}))
Viewer Controls
- Toggle axes, grid, gizmo, legend, and light mode.
- Drag gizmo arrow tips to move the locator; coordinates update in the panel.
- Grid planes and tick labels adapt to the data range.
Input Types
- LaTeX expressions via
latex()(math-first workflow). - DSL blocks via
geom(...)for quick parametric surfaces. - Python arrays for points/lines/meshes (via
points(),line(),mesh()).
Symbolic Utilities
import sympy as sp
from geometrix import canonicalize, simplify, solve
x = sp.symbols("x")
expr = (x**2 - 1) / (x - 1)
print(canonicalize(expr))
print(simplify(expr, mode="factor"))
print(solve([x**2 - 1], [x], dict=True))
Coordinate Helpers
import numpy as np
from geometrix import cylindrical_to_cartesian, spherical_to_cartesian, lorentz_metric
r, theta, z = np.array([1.0]), np.array([0.5]), np.array([0.0])
xyz = cylindrical_to_cartesian(r, theta, z)
metric = lorentz_metric()
Notes
- LaTeX parsing uses a safe allowlist of commands; unknown commands are rejected.
- Indices use the symbols
i, j, k, l, m, n, a, b, c, dby default. - The HTML renderer loads Three.js from a CDN (no widget install needed).
Examples
See examples/ for points, lines, surfaces, DSL, and LaTeX demos.
Metadata
Release files for geometrix 0.1.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| geometrix-0.1.17.tar.gz | 412.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geometrix-0.1.17-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 453.2 kB
Release files / geometrix-0.1.17.tar.gz
| Download URL | geometrix-0.1.17.tar.gz |
|---|---|
| Size | 412.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aca557bfa360e35f05f3010c0fcb8af73ec551e77614733ba8cb4a2bf732302d
|
|
BLAKE2b-256 checksum How to use checksums |
3e11f2278ccbbbaefff86c7603b25a4f26a53a59ab859f46e327a448605e8a1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / geometrix-0.1.17-py3-none-any.whl
| Download URL | geometrix-0.1.17-py3-none-any.whl |
|---|---|
| Size | 40.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0b89a7927dfd4943d83ffc9fe0d2996227047dd28f0966ca5507f1e2225f3bd
|
|
BLAKE2b-256 checksum How to use checksums |
357f7e008d134d9a5bba0c09099ccc7c4d6976f570b5c08d40a1fc312e4e5859
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|