This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
documentation:ref:expandtensors [2015/11/20 20:38] poslavskysv created |
documentation:ref:expandtensors [2015/11/21 12:33] (current) |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ---- | ---- | ||
| ====Description==== | ====Description==== | ||
| - | * ''ExpandTensors'' expands out products leaving unexpended symbolic terms. | + | * ''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[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)''. | + | * ''%%ExpandTensors[[LeaveScalars: true]]%%'' will not expand expressions like ''(A_a^a + B_a^a)*(C_b^b + D_b^b)''. |
| ====Examples==== | ====Examples==== | ||
| Line 22: | Line 22: | ||
| </sxh> | </sxh> | ||
| <sxh plain; gutter: false> | <sxh plain; gutter: false> | ||
| - | > (1 + x)**4*A_a + (1 + x)**4*B_a | + | > (1 + x)**4 * A_a + (1 + x)**4 * B_a |
| </sxh> | </sxh> | ||
| - | |||
| - | ---- | ||
| <sxh groovy; gutter: false> | <sxh groovy; gutter: false> | ||
| - | println Expand >> '(1 + x)**4'.t | + | println ExpandTensors >> '(1 + x)**4*(A_a + B_a)*(A^a + B^a)'.t |
| </sxh> | </sxh> | ||
| <sxh plain; gutter: false> | <sxh plain; gutter: false> | ||
| - | > x**4+1+4*x**3+6*x**2+4*x | + | > (x+1)**4*B^{a}*B_{a}+2*(x+1)**4*B^{a}*A_{a}+(x+1)**4*A^{a}*A_{a} |
| </sxh> | </sxh> | ||
| - | |||
| ---- | ---- | ||
| - | <sxh groovy; gutter: false> | ||
| - | println Expand >> '(x + y)/z'.t | ||
| - | </sxh> | ||
| - | <sxh plain; gutter: false> | ||
| - | > x/z+y/z | ||
| - | </sxh> | ||
| - | ---- | + | Symbolic parts will be kept on all levels: |
| - | ''Expand'' relabels dummies when necessary: | + | |
| <sxh groovy; gutter: false> | <sxh groovy; gutter: false> | ||
| - | println Expand >> '(A_m^m + 1)**3'.t | + | 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 | ||
| </sxh> | </sxh> | ||
| <sxh plain; gutter: false> | <sxh plain; gutter: false> | ||
| - | > 3*A_{m}^{m}*A_{a}^{a}+A_{m}^{m}*A_{a}^{a}*A_{b}^{b}+1+3*A_{b}^{b} | + | > (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 | ||
| </sxh> | </sxh> | ||
| - | |||
| ---- | ---- | ||
| + | Specify additional simplifications: | ||
| - | |||
| - | ''Expand'' does not go inside functions and denominators; ''ExpandAll'' does: | ||
| <sxh groovy; gutter: false> | <sxh groovy; gutter: false> | ||
| - | println Expand >> 'f[(x + y)**2]'.t | + | 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 | ||
| </sxh> | </sxh> | ||
| <sxh plain; gutter: false> | <sxh plain; gutter: false> | ||
| - | > f[(x + y)**2] | + | > a*(-164*a+2*(c+a))+b*(-164*a+2*(c+a)) |
| </sxh> | </sxh> | ||
| - | <sxh groovy; gutter: false> | ||
| - | println ExpandAll >> 'f[(x + y)**2]'.t | ||
| - | </sxh> | ||
| - | <sxh plain; gutter: false> | ||
| - | > f[x**2 + 2*x*y + y**2] | ||
| - | </sxh> | ||
| - | |||
| - | |||
| ====See also==== | ====See also==== | ||
| * Related guides: [[documentation:guide:applying_and_manipulating_transformations]], [[documentation:guide:list_of_transformations]] | * 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]] | * Related transformations: [[documentation:ref:expand]], [[documentation:ref:expandall]], [[documentation:ref:expandnumerator]], [[documentation:ref:expanddenominator]] | ||
| - | * JavaDocs: [[http://api.redberry.cc/redberry/1.1.8/java-api/cc/redberry/core/transformations/expand/ExpandTensorsTransformation.html|ExpandTensorsTransformation]] | + | * 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]] | * Source code: [[https://bitbucket.org/redberry/redberry/src/tip/core/src/main/java/cc/redberry/core/transformations/expand/ExpandTensorsTransformation.java|ExpandTensorsTransformation.java]] | ||
| + | |||