Idenso · latest
On this page

format_tensor

symbolica.community.tensor Function

format_tensor(expression: Expression, show_dimensions: Optional[bool] = None, *, settings: Optional[DisplaySettings] = None) -> str

Produce compact plain-text tensor notation.

Parameters

expression Expression

Symbolica tensor syntax or scalar algebra to display. For a TensorExpression or component Tensor, prefer its formatting methods.

show_dimensions bool, optional

Override settings.show_dimensions for this call. None retains the selected settings, whose default omits dimensions.

settings DisplaySettings, optional

Tensor notation and display choices. Defaults to DisplaySettings().

Returns

str

Readable tensor text, suitable for logs or terminal output.

Notes

Only ports layout and default spacing are supported in this source format. Use to_html() or to_svg() for other layouts and custom gaps.

Examples

from symbolica import S
expression = S("x") + 1
from symbolica.community.tensor import format_tensor
output = format_tensor(expression)