Mathematica Applications for Tensor Analysis in Physics Classes

Hee-Joong Yun

Dept.of Optical & Electronic Physics
Mokwon University ,S.KOREA

heejy@mokwon.ac.kr
http://home.mokwon.ac.kr/~heejy

Why Tensor ?

Describing the Laws of Physics

∘ Abstact - 
      very formal
∘  Describe physics system completly
∘  The laws of  physics  should be  invariant - in tensor form

Tensor calculation with Mathematica

■  Tensor calculation in Mathematica

Tensor definition in Mathematica
A Tensor of rank k is essentially a k-dimensional table of values

t0 =  3

t1 = {1, 0, 3}

t23 = Table[i1 + i2 , {i1, 2}, {i2, 3}]

t234 = 
      Table[i1 + i2 + i3 , {i1, 2}, {i2, 3}, {i3, 
          4}]
% // MatrixForm

t5432 = 
      Table[i1 + i2 + i3 i4 , {i1, 5}, {i2, 4}, {i3, 3}, {i4, 
          2}]

    % // MatrixForm

Map[TensorRank, {t0, t1, t23, t234, t5432}]
Map[Dimensions, {t0, t1, t23, t234, t5432}]

Mathematica system check

s = a;
v = {a, b, c};
m = {{a, b}, {c, d}};
t1 = Table[i1 + i2  i3, {i1, 2}, {i2, 3}, {i3, 2}];
TensorRank[s]
TensorRank[v]
TensorRank[m]
TensorRank[t1]

■ Examples of tensor calculations with Mathematica

■Quadrupole Moment Tensor [Reitz p.48]

\(The\ quadrupole\ moment\ tensor\ \(Q\_ij\) \((Reitz\ 2 - 
          52)\)\ in\ the\ potential\ of\ the\ multipole\ expansion\ of\ electric\ field\ may\ be\ \ calculated\ in\ \(\(Mathematica\)\(\ \)\(.\)\)\)

Electric potential 

▮ In  a continuous charge distribution at (OverVector[r])  
\(φ \((r\&⇀)\) = \(1\/\(\(4  π\)\( ∈ \_0\)\)\) \(∫\_v\(\( ρ \((\(r'\)\&⇀)\)\)\/\(\(|\)\(r\&⇀ - \(r'\)\&⇀\)\(|\)\)\) dv'\)\)
         =(1/(4  π (Subscript[∈ , 0])))   {\(\(1\/r\) \(∫\_\(\(v\)\(\ \)\)ρ \((\(r'\)\&⇀)\) dv'\)\)
              + \(\(\(r\&⇀\)\(\ \)\)\/r\^3·\(∫\_\(\(v\)\(\ \)\)r' ρ \((\(r'\)\&⇀)\) dv'\)\)
              +\(\(\(\ \)\(∑\)\)\+\(i = 1\)\%3\)(∑_(j = 1)^3) (1/2)(((Subscript[x, i]) (Subscript[x, j]))/(r^5))  (Underscript[(Underscript[({{\(∫\_v\((3  x\_i' 
                                        x\_j' - \(δ\_ij\) 
                                        r'\^2)\) ρ \((\(r'\)\&⇀)\)\), dv'}}), ⎵]), \(Q\_\(\_ij\)\)])              
                        }                                                                                                                         

         Quadrupole moment tensor     (Subscript[Q, ij]) 

          (Subscript[Q, ij]) =  ({{\(∫\_v\((3  x\_i' x\_j' - \(δ\_ij\) 
                            r'\^2)\) ρ \((\(r'\)\&⇀)\)\), dv'}})                          \(\((Reitz\ 2 - 
                  52)\)\(.\)\(\ \)\(
\)\(
\)\)

▮  In  a discrete  charge distribution 

φ ((Overscript[r, ⇀]))=(1/(4  π (Subscript[∈ , 0])   ))   {   \(\(1\/r\)\_\ \) (Underscript[(Underscript[({{(∑_k), (Subscript[q, k])}}), ⎵]), monopoles])+ (((Overscript[r, ⇀]) )/(r^3))·(Underscript[(Underscript[({{(∑_k) (Subscript[(((Overscript[(r'), ⇀]))), k]), (Subscript[q, k])}}), ⎵]), dipoles])
                                   +\(\(\(\ \)\(∑\)\)\+\(i = 1\)\%3\)(∑_(j = 1)^3)   (1/2)(((Subscript[x, i]) (Subscript[x, j]))/(r^5)) (Underscript[(Underscript[({{\(∑\+k\((3  x\_i' x\_j' - \(δ\_ij\) 
                                      r'\^2)\)\), (Subscript[q, k])}}), ⎵]), \(\(quadrupole\)\(\ \ \)\(moment\)\(\ \)\(tensor\)\(\ \ \ \ \)\(Q\_ij\)\(\ \)\)])}       
                                                                                                                                                                        
          Quadrupole moment tensor     (Subscript[Q, ij]) 

          (Subscript[Q, ij]) =  ({{\(∑\+k\((3  x\_i' x\_j' - \(δ\_ij\) 
                        r'\^2)\)\), (Subscript[q, k])}})                             (Reitz 2 - 
                52' ).

Continuous charge distribution

Quadrupole moment tensor is calculated  in Mathematica   following as

kdel[i_, j_] := 1 /; i == j;
kdel[i_, j_] := 0 /; i! ≠ j;
quadrupoleij = 
      Table[Integrate
[ ρ (3 (Subscript[x, i]) (Subscript[x, j]) -  
                  kdel[i, j] (∑_(k = 1)^3) 
                      ((Subscript[x, k])^2)) , {(Subscript[x, 1 ]), 0, 
              1}, {(Subscript[x, 2 ]), 0, 1}, {(Subscript[x, 3 ]), 0, 
              1}] , {i, 3}, {j, 3}] // MatrixForm

Example of the discrete charge distribution  

 ■  Three charges  distribution , 
 -2 q (0, 0, 0),q (0, 0, l),q (0, 0, -l) 
\(Find\ the\ quadrupole\ moment\ tensor\ Q\_ij\ \ in\ the\ charge\ \(\(distribution\)\(.\)\(\ \ \ \)\)\)

Fig  .1   Three charges are arranged in a linear array .  The charge  
-2 q is placed at the origin, and two charges, 
      each of  + 
        q,   
   are placed at (0, 0, 
          l) and (0, 0, -l) respectively.

(Underscript[(Underscript[({{(1/r) (∑_k), (Subscript[q, k])}}), ⎵]), monopoles])=({{(1/r) (∑_k), (Subscript[q, k])}})=(1/r) (-2 q  + q  + q) = 0
(Underscript[(Underscript[({{\(\(\(r\&⇀\)\(\ \)\)\/r\^3·\(\(∑\+k\)\(\ \)\(\((\(r'\)\&⇀)\)\_k\)\(\ \)\)\), (Subscript[q, k])}}), ⎵]), dipoles])       =({{\(\(\(r\&⇀\)\(\ \)\)\/r\^3·\(\(∑\+k\)\(\ \)\(\((\(r'\)\&⇀)\)\_k\)\(\ \)\)\), (Subscript[q, k])}})
                                        \(\(=\)\(\(\(r\&⇀\)\(\ \)\)\/r\^3·\([\((0, 0, 
                      0)\) \((\(-2\) q)\) + \((0, 
                      0, \(-l\))\) \((q)\) + \((0, 0, l)\) \((q)\)]\) = 
            0\)\)

However, quadrupole moment tensor
\(\(\(\ \ \)\(Q\_ij = ∑\+\(k = 1\)\%3\(\((3  x\_i' 
                  x\_j' - \(δ\_ij\) 
                  r\_k'\^2)\) \(q\_k\)\(\ \ \ \ \ \ \ \ \ \ \ \)\)\)\)\)

kdel[i_, j_] := 1 /; i == j;
kdel[i_, j_] := 0 /; i != j;
xvalues = {(Subscript[x, 1]) -> 0, (Subscript[x, 2]) -> 0, (Subscript[x, 3]) -> l};
triquadij = 
Table[
          2 q (3 (Subscript[x, i]) (Subscript[x, j]) -  kdel[i, j]  (l^2)) , {i, 3}, {j, 
            3}] // MatrixForm
% /. xvalues // MatrixForm

Therefore 
φ ((Overscript[r, ⇀]))=(1/(4  π(Subscript[ℰ, 0])))   {   \(\(1\/r\)\_\ \) (Underscript[(Underscript[({{(∑_k), (Subscript[q, k])}}), ⎵]), monopoles])+ (((Overscript[r, ⇀]) )/(r^3))·(Underscript[(Underscript[({{(∑_k) (Subscript[(((Overscript[(r'), ⇀]))), k]), (Subscript[q, k])}}), ⎵]), dipoles])
                                   +\(\(\(\ \)\(∑\)\)\+\(i = 1\)\%3\)(∑_(j = 1)^3)   (1/2)(((Subscript[x, i]) (Subscript[x, j]))/(r^5)) (Underscript[(Underscript[({{\(∑\+k\((3  x\_i' x\_j' - \(δ\_ij\) 
                                      r'\^2)\)\), (Subscript[q, k])}}), ⎵]), \(\(quadrupole\)\(\ \ \)\(moment\)\(\ \)\(tensor\)\(\ \ \ \ \)\(Q\_ij\)\(\ \)\)])}       
        \(\(=\)\(1\/\(4  πℰ\_0\)\ \ \ \({\_\ \)0 + 0\  + \(\(\(\ \)\(∑\)\)\+\(i = 
                      1\)\%3\) \(∑\+\(j = 1\)\%3\(\(\ \ \ \)\(\(1\/2\) \(\(x\_i\) x\_j\)\/r\^5\ Q\_ij\)\)\)}\)\)       
        \(\(=\)\(\(\(q\)\(\ \)\(l\^2\)\(\ \)\)\/\(4  πℰ\_0\)\ \ \(\((\_\ \)2\ x\_3\^2\  - \((\ 
                  x\_1\^2\ \  + \ x\_2\^2)\))\)\)\)    
     
        \(Not\ zero\ in\ general \((except\ r \((0, 0, 
                0)\))\) . \ \ 
We\ see\ here\ \ that\ \ the\ potential\ at\ r\ shoud\ be\ described\ with\ \(\(tensor\)\(.\)\(
\)\(\ \)\)\)

■Moment of Inertia Tensor[ Marion p364]