4

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

shrx
  • 7,807
  • 2
  • 22
  • 55
user201018
  • 61
  • 1
  • 6

2 Answers2

5

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}} *)
Teake Nutma
  • 5,981
  • 1
  • 25
  • 49
  • 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
0

please read the comment below the answer that I marked as solved

 (* 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]]
user201018
  • 61
  • 1
  • 6