Symbolic Tensor

SymbolicTensor Module

This module offers classes for symbolic tensor manipulation using SymPy. It’s designed to handle various tensor operations in a symbolic manner, ideal for applications in physics, engineering, and related fields.

Classes:
SymbolicTensor:

A base class for symbolic tensors. It handles initialization with SymPy Array objects and provides basic tensor properties and operations, including checks for symmetry and shape.

SymbolicThreeByThreeTensor:

Inherits from SymbolicTensor, specifically representing a 3x3 symbolic tensor. Offers additional methods and properties tailored to the 3x3 tensor structure.

SymbolicSixBySixTensor:

Extends SymbolicTensor for 6x6 symbolic tensors. Includes specific functionalities for working with 6x6 tensor.

SymbolicSymmetricThreeByThreeTensor:

A specialization for 3x3 symmetric tensors. It incorporates Voigt mapping for tensor transformations and eigenvalue computations, focusing on symmetric properties.

The module emphasizes ease of use and flexibility in symbolic tensor computations, leveraging the power of SymPy for mathematical expressions.

class mechpy.core.symbolic.tensor.SymbolicTensor(data, name=None, tensor_params=None)

Bases: object

static notation_standard_map(n)

Create a dictionary with tuple (i, j) as key and index in the flattened list as value. The dictionary maps the position in an nxn symmetric matrix to its corresponding index in a flattened list.

Parameters:

n – Size of the matrix (nxn).

Returns:

Dictionary mapping (i, j) to index.

static notation_standard_inverse_map(n)

Create a dictionary with index in the flattened list as key and tuple (i, j) as value. The dictionary inversely maps the index in a flattened list to its corresponding position in an nxn symmetric matrix.

Parameters:

n – Size of the matrix (nxn).

Returns:

Dictionary mapping index to (i, j).

is_second_rank()
is_fourth_rank()
is_square()
is_symmetric()
to_matrix()
to_3x3()
to_sym_3x3(notation=None)
to_6x6()
classmethod from_list(components, shape)
classmethod create(shape, name)
subs_tensor_params(param_values)
subs_tensor_components(components_values)
subs(subs_dict)
eigenvalues()
eigenvectors()
diagonalize()
class mechpy.core.symbolic.tensor.SymbolicThreeByThreeTensor(data, name=None, tensor_params=None)

Bases: SymbolicTensor

shape = (3, 3)
classmethod from_list(components)
classmethod create(name)
to_symmetric(notation=None)
class mechpy.core.symbolic.tensor.SymbolicSixBySixTensor(data, name=None, tensor_params=None)

Bases: SymbolicTensor

shape = (6, 6)
classmethod from_list(components)
classmethod create(name)
class mechpy.core.symbolic.tensor.SymbolicSymmetricThreeByThreeTensor(data, name=None, notation=None, tensor_params=None)

Bases: SymbolicTensor

shape = (6,)
STANDARD_MAPPING = {(0, 0): 0, (0, 1): 1, (0, 2): 2, (1, 0): 1, (1, 1): 3, (1, 2): 4, (2, 0): 2, (2, 1): 4, (2, 2): 5}
INVERSE_STANDARD_MAPPING = {0: (0, 0), 1: (0, 1), 2: (0, 2), 3: (1, 1), 4: (1, 2), 5: (2, 2)}
VOIGT_MAPPING = {(0, 0): 0, (0, 1): 5, (0, 2): 4, (1, 0): 5, (1, 1): 1, (1, 2): 3, (2, 0): 4, (2, 1): 3, (2, 2): 2}
INVERSE_VOIGT_MAPPING = {0: (0, 0), 1: (1, 1), 2: (2, 2), 3: (1, 2), 4: (0, 2), 5: (0, 1)}
NOTATIONS = {'standard': {'inverse_map': {0: (0, 0), 1: (0, 1), 2: (0, 2), 3: (1, 1), 4: (1, 2), 5: (2, 2)}, 'map': {(0, 0): 0, (0, 1): 1, (0, 2): 2, (1, 0): 1, (1, 1): 3, (1, 2): 4, (2, 0): 2, (2, 1): 4, (2, 2): 5}, 'name': 'Standard notation'}, 'voigt': {'inverse_map': {0: (0, 0), 1: (1, 1), 2: (2, 2), 3: (1, 2), 4: (0, 2), 5: (0, 1)}, 'map': {(0, 0): 0, (0, 1): 5, (0, 2): 4, (1, 0): 5, (1, 1): 1, (1, 2): 3, (2, 0): 4, (2, 1): 3, (2, 2): 2}, 'name': 'Voigt notation'}, 1: {'inverse_map': {0: (0, 0), 1: (0, 1), 2: (0, 2), 3: (1, 1), 4: (1, 2), 5: (2, 2)}, 'map': {(0, 0): 0, (0, 1): 1, (0, 2): 2, (1, 0): 1, (1, 1): 3, (1, 2): 4, (2, 0): 2, (2, 1): 4, (2, 2): 5}, 'name': 'Standard notation'}, 2: {'inverse_map': {0: (0, 0), 1: (1, 1), 2: (2, 2), 3: (1, 2), 4: (0, 2), 5: (0, 1)}, 'map': {(0, 0): 0, (0, 1): 5, (0, 2): 4, (1, 0): 5, (1, 1): 1, (1, 2): 3, (2, 0): 4, (2, 1): 3, (2, 2): 2}}}
is_symmetric()
classmethod from_list(components, name=None, notation=None)
classmethod create(name, notation=None)
to_general()
eigenvalues()
eigenvectors()
diagonalize()