Tensor Operators

Tensor Operators

class sympy.tensor.toperators.PartialDerivative(expr, *variables)[source]

Partial derivative for tensor expressions.

Examples

>>> from sympy.tensor.tensor import TensorIndexType, TensorHead
>>> from sympy.tensor.toperators import PartialDerivative
>>> from sympy import symbols
>>> L = TensorIndexType("L")
>>> A = TensorHead("A", [L])
>>> i, j = symbols("i j")
>>> expr = PartialDerivative(A(i), A(j))
>>> expr
PartialDerivative(A(i), A(j))

The PartialDerivative object behaves like a tensorial expression:

>>> expr.get_indices()
[i, -j]

Indices can be contracted:

>>> expr = PartialDerivative(A(i), A(i))
>>> expr
PartialDerivative(A(L_0), A(L_0))
>>> expr.get_indices()
[L_0, -L_0]