====== ExpandTensors ======
----
====Description====
* ''ExpandTensors'' expands out products of tensors leaving unexpended all symbolic terms.
* ''ExpandTensors[transformations]'' or ''%%ExpandTensors[[Simplifications: transformations]]%%'' applies ''transformations'' at each level of expand procedure.
* ''%%ExpandTensors[[LeaveScalars: true]]%%'' will not expand expressions like ''(A_a^a + B_a^a)*(C_b^b + D_b^b)''.
====Examples====
----
Expand tensors in expressions:
println ExpandTensors >> '(a+b)**10*(x_n + y_n)*(f_m - r_m)'.t
> (a+b)**10*x_{n}*f_{m}+(a+b)**10*f_{m}*y_{n}-(a+b)**10*r_{m}*y_{n}-(a+b)**10*x_{n}*r_{m}
println ExpandTensors >> '(1 + x)**4*(A_a + B_a)'.t
> (1 + x)**4 * A_a + (1 + x)**4 * B_a
println ExpandTensors >> '(1 + x)**4*(A_a + B_a)*(A^a + B^a)'.t
> (x+1)**4*B^{a}*B_{a}+2*(x+1)**4*B^{a}*A_{a}+(x+1)**4*A^{a}*A_{a}
----
Symbolic parts will be kept on all levels:
def t = '((a+b)*(c+d)*(f_a + (k+i)*t_a) + (a + c)*t_a)*(c+r)*((a+b)*f^a + (c+d)*t^a)'.t
println ExpandTensors >> t
> (c+r)*(c+d)*(a+b)**2*f_a*f^a + (c+r)*((a+b)*(c+d)*(k+i) +
(a + c))*(a+b)*t_a*f^a + (c+r)*(a+b)*(c+d)*(c+d)*f_a*t^a
+ (c+r)*((a+b)*(c+d)*(k+i) + (a + c))*(c+d)*t_a*t^a
----
Specify additional simplifications:
def simplify = 'f_a*f^a = a'.t & 'f_a*t^a = b'.t & 't_a*t^a = c'.t
def t = '(2*(c+a)-164*a)*(f_{a}+t_{a})*f^{a}'.t
println ExpandTensors[simplify] >> t
> a*(-164*a+2*(c+a))+b*(-164*a+2*(c+a))
====See also====
* Related guides: [[documentation:guide:applying_and_manipulating_transformations]], [[documentation:guide:list_of_transformations]]
* Related transformations: [[documentation:ref:expand]], [[documentation:ref:expandall]], [[documentation:ref:expandnumerator]], [[documentation:ref:expanddenominator]]
* JavaDocs: [[http://api.redberry.cc/redberry/1.1.9/java-api/cc/redberry/core/transformations/expand/ExpandTensorsTransformation.html|ExpandTensorsTransformation]]
* Source code: [[https://bitbucket.org/redberry/redberry/src/tip/core/src/main/java/cc/redberry/core/transformations/expand/ExpandTensorsTransformation.java|ExpandTensorsTransformation.java]]