Keecas Documentation

Symbolic and units-aware calculations for Jupyter notebooks

Welcome to Keecas, a Python package for symbolic and units-aware calculations in Jupyter notebooks, specifically designed for Quarto rendered documents (LaTeX PDF, HTML).

What is Keecas?

Keecas minimizes boilerplate for symbolic calculations in Jupyter notebooks by using Python dicts as its core container - keys represent left-hand side symbols, values represent right-hand side expressions. This natural mapping enables clean, readable code with dict comprehensions.

Built on SymPy (symbolic math), Pint (units), and Pipe (functional programming), Keecas provides a streamlined interface for unit-aware calculations with automatic LaTeX rendering.

Key Features

  • Symbolic Mathematics: Work with symbolic expressions and equations
  • Unit-Aware Calculations: Automatic unit conversion and dimensional analysis
  • LaTeX Output: Beautiful equation rendering for documents (amsmath)
  • Jupyter Integration: Seamless notebook workflow
  • Internationalization: Support for multiple languages and locales
  • Configurable: Flexible configuration system

Quick Example

from keecas import symbols, u, pc, show_eqn, generate_unique_label

# Define symbols with LaTeX notation
F_d, A_load, sigma = symbols(r"F_{d}, A_{load}, \sigma")

# Parameters with units
_p = {
    F_d: 10 * u.kN,
    A_load: 50 * u.cm**2,
}

# Expressions
_e = {
    sigma: "F_d / A_load" | pc.parse_expr
}

# Evaluate
_v = {
    k: v | pc.subs(_e | _p) | pc.convert_to([u.MPa]) | pc.N
    for k, v in _e.items()
}

# Description
_d = {
                F_d: "design force",
    A_load: "loaded area",
    sigma: "normal stress",
}

# Label (Quarto only)
_l = generate_unique_label(_d)

# Display
show_eqn(
    [_p | _e, _v, _d], # list of dict as main input
    label=_l # a dict of labels (key matching)
)

\[\begin{align} F_{d} & = 10{\,}\text{kN} & & \quad\text{design force} \label{eq-1kv2lsa6} \\[8pt] A_{load} & = 50{\,}\text{cm}^{2} & & \quad\text{loaded area} \label{eq-1qnugots} \\[8pt] \sigma & = \dfrac{F_{d}}{A_{load}} & = 2.0{\,}\text{MPa} & \quad\text{normal stress} \label{eq-27myzkyp} \end{align}\]

NoneLabels works!

The normal stress is shown in \(\eqref{eq-27myzkyp}\) is the result of the design force \(\eqref{eq-1kv2lsa6}\) divided by the loaded area \(\eqref{eq-1qnugots}\).

Getting Started

TipNew to Keecas?

Documentation Sections

Getting Started

Learn how to install and configure Keecas for your projects.

API Reference

Complete reference for all functions, classes, and modules.

CLI Reference

Command-line interface for configuration and Jupyter integration.

Community and Support

License

Keecas is released under the MIT License. See the LICENSE file for details.