# How to solve a “tensor equation”?

I am trying to solve equations which looks like this:

$$T_{ab} - T_{bc} = a_1 T_{ab} + a_2 T_{ac} + a_3 T_{bc},$$

where $T_{xy}$ are tensors. I want to get the $a_i$'s (in this simple example $a_1=1$, $a_2=0$, $a_3=-1$).

The problem is that the Mathematica solving routines (Solve, LinearSolve) divide the equation by $T_{xy}$ to obtain a solution (or solutions), which is (or some of them are), in turn, not a solution (solutions).

What I tried to circumvent this problem: I know (from the construction of my equation) that all $a_i$'s are element $\{-1,0,1\}$. So I tried to set the domain to integers. But this gives me lots of condidtional solutions (like if Tab=integer, then...) which I don't want.

Of course I could solve the above example equation by hand, but in the end I will need to solve a few hundred equations of this type with 70 tensors or so.

Thanks in advance for any attempt to help me!

Anton

-
You appear to misunderstand basic Mathematica syntax. Start learning documentation on the new tensor functionality in ver.9. For earlier versions this post might be helpful: How to calculate scalar curvature Ricci tensor and Christoffel symbols in Mathematica?. For solving matrix equations see e.g. General form of a linear transformation. – Artes Nov 19 '13 at 10:53
No, I do not misunderstand basic Mathematica syntax. But, what you couldn't know: I am working with an older special package that forces me to use Mathematica 8 and a special syntax. (And I necessarily need that package.) – user201018 Nov 19 '13 at 12:03
Really ? So why don't you use correct Mathematica notation, but something like a_1 , a_2 etc? – Artes Nov 19 '13 at 12:22
In my Mathematica code I write T[a,b] and a[i] etc. I just wanted to give an as simple as possible example that illustrates my problem. In the future, I'll not change the notation, or should I? – user201018 Nov 19 '13 at 13:30
You should always provide valid Mathematica code. So if you have different notation in your notebook you can edit your question to make it correct. By the way I didn't vote down your question, I find questions on tensors interesting. – Artes Nov 19 '13 at 14:38

I don't think you need to use any specific tensor functionality. SolveAlways seems to suffice:

SolveAlways[ T1 - T3 == a1 T1 + a2 T2 + a3 T3, {T1, T1, T3} ]
(* => {{a1 -> 1, a2 -> 0, a3 -> -1}} *)

-
This solution works fine unless you have large equations. Then Mathematica needs an tremendous amount of memory. So you need to "help" Mathematica... the following worked for me (basically, I split up the "tensor" eq into one equation for each tensor): – user201018 Nov 25 '13 at 10:19
I created a new answer due to the length limit for the comments. – user201018 Nov 25 '13 at 10:26

 (* put all the terms to one side of the eq *)
tensorEq = -(T1 - T3) +
a1 T1 + a2 T2 + a3 T3
(* collect the terms that belong together *)
tensorTermsList =
Apply[List, Collect[tensorEq, {T1, T2, T3}]]
(* set the terms individually to 0 *)
tensorEqsList =
Table[tensorTermsList[[i]] == 0, {i, 1, Length[tensorTermsList]}]
(* now we can give the full list to SolveAlways, SolveAlways can
handle a large number of simple equations *)
sol =
SolveAlways[tensorEqsList, {T1, T2, T3}][[1]]

-