Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:1kbgz Tributary Symbolic Computation Stack

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Symbolic
Last Updated 2026-10-14 09:15 GMT

Overview

Python environment with SymPy, NumPy, and SciPy for symbolic expression parsing and compilation to tributary graphs.

Description

This environment provides the mathematical computing stack used by tributary's symbolic module. SymPy is used to parse string expressions into symbolic expression trees, which are then compiled into lazy or streaming tributary graphs via `sympy.utilities.lambdify`. The lambdify function uses NumPy and SciPy as backend modules for numerical evaluation. Graphviz is used for visualizing the expression tree.

Usage

Use this environment when constructing tributary graphs from symbolic mathematical expressions. It is the mandatory prerequisite for the Symbolic_Expression_Compiler implementation, which provides `parse_expression`, `construct_lazy`, and `construct_streaming` functions.

System Requirements

Category Requirement Notes
OS Linux, macOS, or Windows No platform-specific requirements
Hardware Any CPU NumPy/SciPy benefit from BLAS/LAPACK
Disk 200MB SciPy and SymPy are large packages

Dependencies

System Packages

  • `graphviz-dev` (for expression tree visualization)

Python Packages

  • `sympy` >= 1.5.1 (symbolic expression parsing)
  • `numpy` >= 1.15.3 (numerical backend for lambdify)
  • `scipy` > 1.2.0 (scientific computing backend for lambdify)
  • `graphviz` >= 0.10.1 (expression tree visualization)

Credentials

No credentials are required for this environment.

Quick Install

# Install symbolic computation stack
pip install sympy>=1.5.1 numpy>=1.15.3 "scipy>1.2.0" graphviz>=0.10.1

Code Evidence

SymPy imports and lambdify from `tributary/symbolic/__init__.py:5-13`:

from sympy.utilities.lambdify import lambdify
from sympy.parsing.sympy_parser import (
    parse_expr,
    standard_transformations as _st,
    implicit_multiplication_application as _ima,
)
from sympy import init_printing, dotprint, preorder_traversal
from graphviz import Source

Default modules for lambdify from `tributary/symbolic/__init__.py:67`:

modules = modules or ["scipy", "numpy"]

Lazy graph construction from `tributary/symbolic/__init__.py:75`:

self._function = lambdify(syms, expr, modules=modules)

Common Errors

Error Message Cause Solution
`TributaryException: Must provide input source for: {name}` Missing keyword argument for a symbol in the expression Pass all free symbols as kwargs to the Streaming constructor
`SympifyError` Invalid expression string passed to `parse_expression` Ensure the expression uses valid SymPy syntax
`NameError` from lambdify Unknown function in expression not in numpy/scipy modules Pass custom `modules` list to `construct_lazy` or `construct_streaming`

Compatibility Notes

  • Module selection: Lambdify defaults to `["scipy", "numpy"]`. Alternative modules include `["math", "mpmath", "sympy"]` (commented out in source).
  • Unicode printing: `init_printing(use_unicode=True)` is called at module import time, affecting SymPy's output format globally.
  • Expression parsing: Uses `implicit_multiplication_application` transformation, so `2x` is parsed as `2*x`.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment