Conveniently solving tensor equations in which the contained tensors have various symmetries

How do I conveniently solve tensor equations in which the contained tensors have various symmetries?

A convenient method for solving tensor equations in general, is to use structured (i.e., symmetrized) arrays in order to impose the symmetry conditions on them, without then needing to explicitly give these conditions in the Solve blocks. This becomes especially handy when the number of tensors and their symmetries get large, or complex tensor quantities are formed from symmetric tensors (such as the Riemann tensor formed from the symmetric metric). I do not presently know how this method would augment the solution of tensor equations when using xAct (have not used xAct much).

Use Notes:
* It is found that in order to preserve the symmetry of structured arrays when using a Solve block, it is important to name the arrays, and then apply the "Part" command to the array names within the Solve block to specify their components. It is also OK to use expressions originally formed outside the Solve block, so long as they are composed of "Part" obtained array components (evidently, the kernel keeps track of their structured array origins). In addition, "Part" obtained array components are also used when applying a Solve block solution (its rules) to an array to yield the solved array that is still symmetric.
* Note that "raw" (unstructured) and structured arrays may be mixed together.
* Even a tensor with no symmetries may be given as a structured array, in which case its symmetries are given as the empty set "{}".
* For the purposes of forming tensor identities, SolveAlways blocks may also be used with structured arrays to solve for parameters multiplying tensors.
* Outside of Solve blocks, structured arrays are treated as "Atoms", requiring temporary conversion into raw arrays for manipulation of their components. Alternately, a structured array may always be set up using array rules to give its values (which may be variables with indices used if desired such as the form "val[i,j,k]", as shown below), and then these values may be directly manipulated. For very large equations, manipulation of structured array values may be a good idea prior to Solve block use in order to provide simplified expressions within the Solve block. If only simplification is required, here is a nifty "one step" function for structured array simplification based on its rules (Thanks to @Druid with his answer to Simplify on a structured array):

fullSimplifyStruc[m_] := SymmetrizedArray[FullSimplify[SymmetrizedArrayRules[m]],
TensorDimensions[m], TensorSymmetry[m]]

This can also be used to simplify any raw array and then form its equivalent structured array.

Below is a routine to solve the equation $F^{l}{}_{i}S_{jl}{}^{k}-F^{l}{}_{j}S_{il}{}^{k}=0$, with $S_{ij}{}^{k}$ symmetrized in its first two indices. This is the equation evaluated in the Solving antisymmetric tensorial equation question, with the routine given here a modified version of the routine given by @Dr. belisarius (Thanks Doc).

(* setting up the symmetrized Subscript[s, i j]^k array *)
smat = SymmetrizedArray[
{i_, j_, k_} -> s[i, j, k],
{4, 4, 4},
Symmetric[{1, 2}]]
(* No "Table" needs to be set up, since indice assignments are made automatically. *)

(* solve block using the symmetrized Subscript[s, i j]^k array *)
f = Table[RandomInteger[{-1, 1}], {i, 4}, {j, 4}];(* Subscript[F^l, i] tensor specified *)
soln = Flatten@
Solve[
And @@
Flatten@Table[
Sum[f[[l, i]] smat[[j, l, k]] - f[[l, j]] smat[[i, l, k]], {l, 4}] == 0,
{i, 4}, {j, 4}, {k, 4}],
Flatten@Table[smat[[i, j, k]], {i, 4}, {j, 4}, {k, 4}]]
(* Note explicit use of the array name "smat" as opposed to using its values
s[i,j,k], as is required to preserve its symmetry. *)
(* Note explicit "solve for" variables using the array name "smat". *)

smat = Table[smat[[i, j, k]], {i, 4}, {j, 4}, {k, 4}] /. soln;
(* Note explicit use of the array name "smat" as opposed to using its
values s[i,j,k], as is required to preserve its symmetry. *)

Though a numerical array was given for $F^{l}{}_{i}$ in the above routine, $F^{l}{}_{i}$ can also be given as a purely variable array. The structured array based method demonstrated above, may be broadly applied then to tensor equations made up of either abstract or numeric tensors (or both), with either tensors solved for using "Solve" blocks, or tensor multiplicative parameters solved for using "SolveAlways" blocks in order to form tensor identities

• Thanks for posting. Was this related to another question? Maybe a link could be useful for completeness. Nov 25 '16 at 14:52
• @Mirko Aveta - Oops. I need to edit this to properly link to the question I referred to. Thanks for letting me know about this. Nov 25 '16 at 14:59