Basics
Transformation
represents a transformation of expression; it is a super type for all transformations (e.g.
Expand or
EliminateMetrics).
Examples
Expand is a Transformation
that expands out product of sums:
println Expand > > '(a+b)*(c+d)' .t
|
Expression lhs = rhs
is both Tensor and Transformation
:
println 'f_a[x_a] = x_a' .t > > 'g^b[z_a] = f^b[z^i]' .t
|
Combine transformations using &
:
def tr = Expand & EliminateMetrics
println tr > > '(g_ab*g_cd + g_ac*g_bd)*g^bc' .t
|
One can define a custom transformation using closures:
def customTr = { expr - > 2 * expr } as Transformation
println customTr > > 'z + t' .t
|
Define transformation that inverts indices:
def tr = { expr - >
(expr .indices % expr .indices .inverted ) > > expr
} as Transformation
println tr > > 'f_ab^cd' .t
|
See also
-
Related reference material:
Tensor
-
-