Display

Display helpers for Jupyter notebooks — turn tensor objects into readable tables.

gravica.display.nonzero_components(tensor, coord_names)

Return list of (label, value) for non-zero components, auto-dispatched by tensor type.

Dispatches based on tensor class:

gravica.display.components_table(items, tensor=None, *, tensor_symbol=None, index_style=None)

Format a list of (label, value) pairs as an IPython Markdown table.

Parameters:
  • items (list of (str, expression))

  • tensor (tensor object, optional) – If provided, tensor_symbol and index_style are inferred from its type.

  • tensor_symbol (str, optional) – The symbol for the tensor, e.g. "g", "\\Gamma", "R". Used as fallback when tensor is None.

  • index_style (str, optional) – "sub" for subscript labels like \(g_{tt}\), "christoffel" for mixed like \(\Gamma^a_{\ bc}\), "riemann" for mixed like \(R^a{}_{bcd}\). Used as fallback when tensor is None.