pystein.utilities module

Miscellaneous symbolic utilities

pystein.utilities.boundary_filter(df: pandas.core.frame.DataFrame, **kwargs)
pystein.utilities.clean_expr(e: sympy.core.expr.Expr, natural: bool = True) sympy.core.expr.Expr

Helper function to compute clean expression

Parameters

e – Expr, expression to clean

Returns

Expr, cleaned expression

pystein.utilities.concat_latex(exprs: List[sympy.core.expr.Expr], labels: Optional[List[str]] = None, label_names: Optional[List[str]] = None, display=False)
pystein.utilities.full_simplify(x)
pystein.utilities.matrix_to_twoform(matrix: sympy.matrices.dense.MutableDenseMatrix, base_forms: Tuple[sympy.core.expr.Expr, ...]) sympy.core.expr.Expr

Logical inverse of sympy.diffgeom.twoform_to_matrix

Parameters
  • matrix – Matrix, the matrix representation of the twoform to produce

  • base_forms – Tuple[Expr], tuple of oneforms representing a basis of the cotangent bundle

Returns

Expression of the twoform of the matrix in terms of the base oneforms

pystein.utilities.tensor_pow(x: sympy.tensor.tensor.Tensor, n: int) sympy.tensor.tensor.Tensor

Shorthand for computing reflexive tensor products of order n

Parameters
  • x – Tensor, to be raised to power

  • n – int, power to raise tensor

Returns

Tensor, T^n

pystein.utilities.unwrap_latex(s: str) str
pystein.utilities.wrap_latex(s: str, style: str = '') str