tensors can be manipulated by a computer. A C- tween Cartesian coordinate systems, which have
preprocessor has been implemented for this pur- orthonormal basis vectors, while a generalized
pose, which converts embedded Einstein summa- tensor is transformed in non-orthonormal coor-
tion notation expressions into C Language expres- dinates.
sions. The components of a Cartesian tensor are magni-
In conventional matrix and vector notation, the tudes projected onto the orthogonal Cartesian ba-
multiplication order contains critical information sis vectors three dimensional N -th order Carte-
for the calculation. In the Einstein subscript sian tensors are represented in terms of 3N com-
1
Barr, Extending the Einstein Summation Notation, 2.05 2
tions may be found in textbooks describing ten- to obtain the numerical representations of
sor analysis and three-dimensional mechanics (see the same object in another coordinate sys-
SEGEL], and MISNER,THORNE,WHEELER]). tem. That rule is described in section 3.
Generalized tensors are outside the scope of this
document. 1.1 Example 1:
For example, let us consider the component-by-
component description of the three-dimensional
matrix equation
a=b+M c
(we utilize one underscore to indicate a vector,
two for a matrix, etc. We will occasionally use
boldface letters to indicate vectors or matrices.)
The above set of equations is actually a set of
three one-component equations, valid in any co-
ordinate system in which we choose to represent
the components of the vectors and matrices.
Figure 4: Normal vectors are covariant tensors
they are transformed by the inverse transpose of Using vertical column vectors, the equation is:
the stretching transformation matrix.
0 a 1 0 b 1 0 m m m 10 c 1
For Cartesian transformations, such as pure ro- @ a12 A = @ b12 A+@ m11 12 13 1
tation, tangent vectors transform via the same 21 m22 m23 A @ c2 A
a3 b3 m31 m32 m33 c3
matrix as the normal vectors there is no di
er-
ence between the covariant and contravariant rep- which is equivalent to:
resentations. Thus, subscript indices suce for
Cartesian tensors. a1 = b1 + m11 c1 + m12 c2 + m13 c3
A zero-th order tensor is a scalar, whose sin- a2 = b2 + m21 c1 + m22 c2 + m23 c3
gle component is the same in all coordinate sys- a3 = b3 + m31 c1 + m32 c2 + m33 c3
tems, while rst order tensors are vectors, and
second order tensors are represented with matri- The above equations condense into three in-
ces. Higher order tensors arise frequently intu- stances of one equation,
itively, if a mathematical object is a \k-th order
Cartesian tensor," in an N dimensional Cartesian X
3
lent. Thus, we are limited to two instances of any Thus, the even permutations are (1,2,3), (2,3,1),
particular subscript index in a term in order to and (3,1,2), while the odd permutations are
retain the associative property of multiplication (2,1,3), (3,2,1), and (1,3,2).
in our algebraic expressions.
Unlike conventional matrix notation, Esn factors 2.1 Preliminary simplication rules
are both commutative and associative within a
term. For beginners it is particularly important The free-index operator of a vector, matrix or
to check Esn expressions for validity with respect tensor converts a conventional vector expression
to rule 3 and the number of subscript instances into the Einstein summation form. It is indicated
in a term. by parentheses with subscripts on the right. Vec-
tors require one subscript, as in
2 A Few Esn Symbols (b)i = bi
The Kronecker delta, or identity matrix, is rep- which is verbosely read as \the i-th component
resented with the symbol with subscripts for the of vector b (in the default Cartesian coordinate
rows and columns of the matrix. system) is the number b sub i."
( Two subscripts are needed for matrices:
ij = 0 i=j
6
ijk = jki 3e. In other words, each basis vector has unit
length, is perpendicular to the other basis vectors,
The order-3 epsilon-delta rule and the 3D vectors are named subject to the right
hand rule.
The order-3 - rule allows the following subscript Right handed unit basis vectors satisify:
simpli
cation (when the
rst subscript of two per-
mutation symbols match: e 2 e = 3e
1
e 3e = 1e, and
i jk i pq = jp kq ; jq kp
2
2
A)
Rot(B)
Ro
=
B)
and 2
e 3 e = 1 e, and
Rot(2 e) = ; sin 1e + cos 2 e: 3
e 1e = 2e:
Thus, We have a right-handed system of basis vectors.
Unfortunately, we can't divide out the aj term, In this case 1 e is the
rst column vector of the
because j is involved in a sum, from 1 to 3. How- matrix E , 2 e is the second column, etc. 4
ever, since the above equation is true for all val-
ues of aj , then the esn factor on the left must be (2) The dot product of two vectors a and b is
zero. (For instance, we could let aj = 1j , 2j expressed via: a b = ai bi = a i b i :
and 3j in sequence.)
Thus, putting Rij to the other side of the equa- (2a) The outer product of two vectors a and b
tion, the ij th components of the rotation matrix is expressed via: (a b)ij = ai bj :
are given by:
(3) In 3-D the vector cross product of two vec-
Rij = cos (ij ; ri rj ) + sin ikj rk + rj ri tors a and b is expressed via:
You can reverse the sign of the permutation sym- (a b)i = ijk aj bk
bol to get:
or, putting boxes on the matching sets,
Rij = cos (ij ; ri rj ) ; sin ijk rk + rj ri (a b)i = i j k a j b k
or
5 Summary of Manipulation (a b)1 = a2 b3 ; a3 b2
Identities (a b)2 = a3 b1 ; a1 b3
In this section, a series of algebraic identities are (a b)3 = a1 b2 ; a2 b1
listed with potential applications in multidimen-
sional mathematical modeling. (in which the free index of the output cross prod-
uct vector becomes the
rst subscript of the per-
mutation symbol, while two new bound indices
List of Einstein Summation Identities: are created).
(1) The free-index operator of a vector, matrix (4) ij jk = i j j k = ik = ki .
or tensor converts a conventional vector expres-
sion into the Einstein form. It is indicated by Note that i e 6= (e)i . The right hand side is an i-th
4
Expanded, the above relation becomes: Please note that the numerator of the above ex-
pression involves an enormous number of individ-
ual components when written out in a conven-
M11 = r1 r1 + cos (1 ; r1 r1 ) tional form. The above expression exhibits an
M21 = r2 r1 ; cos r2 r1 + r3 sin incredible economy.
M31 = r3 r1 ; cos r3 r1 ; r2 sin (25b) The three by three matrix inverse is
given by:
M12 = r1 r2 ; cos r1 r2 ; r3 sin
qnp Mjn Mkp
M22 = r2 r2 + cos (1 ; r2 r2 ) (M ;1 )qi = ijk 2 det M :
M32 = r3 r2 ; cos r3 r2 + r1 sin
The algebraically simpli
ed terms of the above
M13 = r1 r3 ; cos r1 r3 + r2 sin
M23 = r2 r3 ; cos r2 r3 ; r1 sin 5
The author hesitates to expand this daunting expres-
sion out!
M33 = r3 r3 + cos (1 ; r3 r3 )
From identity 17, the determinant cancels out and + 3!1 Fi jkp (x0 )(xj ;x0j )(xk ;x0k )(xp ;x0p )+
the above simpli
es to:
qnp rnp (29) Multidimensional Newton's Method
2 can be derived from the linear terms of the multi-
which, by the epsilon-delta rule, becomes dimensional Taylor series, in which we are solving
F (x) = 0, and letting Jij = Fi j :
pqn prn = qr nn ; qn nr
2 2 xj = x0j ; (J ;1)ji Fi (x0 ):
3qr ; qr
= 2 = qr
(30) Orthogonal Decomposition of a vector v
which veri
es the relation. in terms of orthonormal (orthogonal unit) vectors
1 e, 2 e, and 3 e:
(26) From the preceding result, we can see that
in 3 dimensions: v = (v j e)j e:
;1
ijk Mjr Mks = 2 det M (M )qi qrs : (31) Change of Basis: we want to express vj j e
in terms of new components times orthonormal
(27) The Multidimensional Chain Rule in- basis vectors j e^. A matrix T re-expresses the
cludes the eects of the summations automati- numerical representation of a vector relative to
cally. Additional subscript indices are created as the new basis via
necessary. For instance,
vj = Tij v^j
(F (G(x(t))))i t = Fi j (G(x(t)))Gj k ( x(t))xk t : where
Barr, Extending the Einstein Summation Notation, 2.05 15
Tij = ( e e^):
i j
cos = Rii2 1 :
;
sin
Likewise, Otherwise, if = , then since the original rota-
Z Z tion matrix
n esn-expressioni d = esn-expressioni i dv
@R i R Rij = 2ri rj ij
;
then
(34) Multiplying by matrix inverse: if
Rij + ij
Mij xj = esn-expressioni r i rj = 2
then Letting
R +
; ; Mij = ij 2 ij
(M )pi Mij xj = (M )pi esn-expressioni
1 1
we can solve for ri , by taking the ratio of non-
or, simplifying and renaming p back to j , diagonal and square roots of nonzero diagonal
xj = (M ;1 )ji esn-expressioni terms, via
M
Note the transpose relationship of matrices M ri = q ij ]
and M (;1) in the rst and last equations. Mj ]j ]
Note that we are using j ] to be an independent
(35) Conversion of Rotation matrix Rij to index as dened near the bottom of page 3. We
the axis-angle formulation: choose the value of j to be such that Mj ]j ] is
We rst note that any collection of continuously its largest value.
varying axes r and angles produces a continuous
rotation matrix function, via identity 22. How-
ever, it is not true that this relation is completely 6 Extensions to the tensor no-
invertible, due to an ambiguity of sign: the same tation for Multi-component
matrix is produced by dierent axis-angle pairs.
For instance, the matrix produced by r and is equations
the same matrix produced by r and . In fact,
; ;
if = 0 then there is no net rotation, and any In this section, we introduce the no-sum notation
unit vector r produces the identity matrix (null and special symbols for quaternions.
rotation).
Since
R
sin = ijk2 ij , and
j j
j j
Barr, Extending the Einstein Summation Notation, 2.05 16
6.1 The \no-sum" operator into matrix and vector notation for interpreta-
tion. Sometimes, however, there is no convenient
The classical summation convention is incomplete way to express the result in conventional matrix
as it usually stands, in the sense that not all notation.
multi-component equations (i.e, those involving
summation signs and subscripted variables) can
be represented. In the scalar convention, the de- 6.2 Quaternions
fault is not to sum indices, so that summation The other proposed extensions to the notation aid
signs must be written explicitly if they are de- in manipulating quaternions. For convenience,
sired. Using the classical summation convention, a few new special symbols are dened to take
summation is the default, and there is no con- quaternion inverses, quaternion products, prod-
venient way not to sum over a repeated index ucts of quaternions and vectors, and conversions
(other than perhaps an awkward comment in the of quaternions to rotation matrices. A few iden-
margin, directing the reader that the equation is tities involving these symbols are also presented
written with no implicit summation). in this section.
Thus, an extension of the notation is proposed
in which an explicit \no-sum" or \free-index" op-
erator prevents the summation over a particular 6.2.1 Properties of Quaternions
index within aPterm. The no-sum operator is rep- A quaternion is a four dimensional mathematical
resented via i
or (which is easier to write) a object which is a linear combination of four inde-
subscripted prex parenthesis (i ). This modi-
6
cation extends the types of formulations we can pendent basis vectors: 1, i, j, and k, satisfying
represent, and augments algebraic manipulative the following relations:
skills. Expressions involving the no-sum operator
are found in calculations which take place in a i2 = j2 = k2 = ; 1
particular coordinate system without the exten- ijk = ; 1
sion, all of the terms are tensors, and transform By pre- and post-multiplying by any of i, j, or k,
correctly from one coordinate system to another. it is straightforward to show that
For instance, a diagonal matrix
0 1
a1 0 0 ij = k
M =B @ 0 a2 0 CA jk = i
0 0 a3 ki = j
is not diagonal in all coordinate systems. ji = k
;
diagonal.
X Thus, a quaternion
Mij = (ai ij ) = (i ai ij ) 0 1
BB qq01 CC
6
Note that
pq = (p0 + p1 + p2 + p3 )(q0 + q1 + q2 + q3 ) ! ! ! !
i
= p0 (q0 + q1 + q2 + q3 )
j k i j k
s1 s2 = s2 s1
i
+p1 (q0 + q1 + q2 + q3 )
i i
j
j
k
k
v1 v2 6
v2 v1
+p2 (q0 + q1 + q2 + q3 )
j i j k With this notation, quaternion-vector, vector-
+p3 (q0 + q1 + q2 + q3 )
k i j k quaternion, and vector-vector multiplication rules
= p0 q0 + p0 q1 + p0 q2 + p0 q3
i j k
become clear: to represent a vector, we set the
+p1 q0 + p1 q1 ( ) + p1 q2 ( ) + p1 q3 ( )
i ii ij ik
scalar part of the quaternion to zero, and use the
+p2 q0 + p2 q1 ( ) + p2 q2 ( ) + p2 q3 ( )
j ji jj jk
above relation to perform the multiplications.
+p3 q0 + p3 q1 ( ) + p3 q2 ( ) + p3 q3 ( )
k ki kj kk
= p0 q0 ; p1 q1 p2 q2 ; p3 q3
+ (p1 q0 + p0 q1 + p2 q3 ; p3 q2 )
i
Quaternion Inverse:
+ (p2 q0 + p0 q2 + p3 q1 ; p1 q3 )
j
+ (p3 q0 + p0 q3 + p1 q2 ; p2 q1 )
k
The inverse of a quaternion q is another quater-
nion q;1 such that q q;1 = 1. It is easily veried
that
6.2.2 The geometric interpretation of a !
quaternion q;1 = s =(s2 + v v):
v ;
A quaternion can be represented as a 4-D com- Rotating a vector with quaternions is achieved by
posite vector, consisting of a scalar part s and a pre-multiplying the vector with the quaternion,
three dimensional vector portion v : and postmultiplying by the quaternion inverse.
! We use this property to derive the conversion for-
q = vs : mula from quaternions to rotation matrices.
A quaternion is intimately related to the axis-
angle representation for a three dimensional rota- Quaternion Rotation:
tion (see Figure 1). The vector portion v of a unit (Rot(v))i = (qvq;1 )i i = 1 2 3:
quaternion is the rotation axis, scaled by the sine
of half of the rotation angle. The scalar portion, With this identity, it is possible to verify the ge-
s is the cosine of half the rotation angle. ometric interpretation of quaternions and their
! relationship to the axis-angle formulation for ro-
cos( =
q = sin(=2)r 2) tation.
The most straightforward way to verify this re-
where r is a unit vector, and q q = 1 lation is to expand the vector v into components
Thus, the conversion of a unit quaternion to and parallel to r and those perpendicular to it, plug
from a rotation matrix can be derived using the into the rotation formula, and compare to the
axis-angle formulas 22 and 35. Remember that equation in section 4.5.
the quaternion angle is half of the axis-angle an- i.e., to evaluate
gle.
(Rot(v )) = (q((v r) + r)q;1 )
n
Quaternion Product:
A more compact form for quaternion multiplica- 6.3 Extended Symbols for Quaternion
tion is Manipulations
! ! ! The author has developed a few special symbols
s1 s2 = s v s1+ss2 v v 1+ vv2 v ;
: to help write and manipulate quaternion quanti-
v1 v2 1 2 2 1 1 2 ties more conveniently. We dene all quaternion
Barr, Extending the Einstein Summation Notation, 2.05 18
components as going from 0 to 3, with the vec- ijk = ij k0 + ik j 0 i0 jk + 00ijk;
tor part still going from 1 to 3, with zero for the
scalar component. The quaternion-vector product structure con-
If we are not using the full range of a variable stant ki` allows us to multiply a quaternion q
v
(going, say from 1 to 3 when the original goes and a vector v via
from 0 to 3), we need to explicitly denote that. (qv)k = ki` qi v` v
(i, j, k = 1 . . . 3)
00 = 1
and i0k = ik
v
0jk = jk
v
;
0i = 0 i = 0: 6
ijk = ijk
v
permutations. ;
qI;1 =
ij qj =(qK qK ): a quaternion q via
(vq)k = k`i v` qiv
where
8 where the nonzero components are given by:
>
< 1 i = j = 0
v
ij = > 1 i = j = 0 : (i, j, k = 1 . . . 3)
: 0 otherwise
; 6
0jk = jk
v
;
ij = 2i0 j 0 ij : ; ijk = ijk
v
The quaternion product structure constant Note, using the full range for i, j, and k that
Kij allows us to multiply two quaternions p and
q via v
ijk = ij k0 i0 jk + 00ijk
;
(pq)K = K ij pi qj
The vector-vector product is the conventional
where the nonzero components are given by: (i, cross product.
j, k = 1 . . . 3) The quaternion to rotation matrix structure
000 = 1 constant
ijk` allows us to create a rotation6 ma-
ij 0 = ij trix R
i0k = ik Rij =
ijk` qk q` =(qN qN ):
0jk = ; jk
ijk = ijk It is straightforward to express
in terms of the
's:
Note, using the full range, for i, j, and k that 6
Note that qN qN = q q in the following equation.
Barr, Extending the Einstein Summation Notation, 2.05 19
ijk` = ikp pj N
N `v
!
q = 21
0 0
! q
To derive this relation, we note that the i-th com-
ponent of the rotation of vector a is given by: (i,
j, k = 1 . . . 3)
Denition of angular velocity in three
dimensions
(Rot(a))i = (qaq;1 )i i = 1 2 3:
= ikp qk (aq;1 )p Consider a time varying rotation Rot(t), (for in-
= ikp qk pj N aj (q;1 )N
v stance, represented with a matrix function or
= ikp qk pj N aj
N ` q` =(q q)
v quaternion function), which brings an object from
body coordinates to world coordinates.
= (ikp pj N
N ` ) qk q` =(q q)aj
v
angular velocity vector !, the rotation itself, and for either representation method.
the derivative of the rotation.
Matrix Eqn: Matrix representation
m =! m
0
Let M (t) be a time varying rotation matrix which
or takes us from body coordinates to world coordi-
nates, and let N (t h) be the relative rotation from
m =! m 0 M(t) to M(t+h).
In other words, since N takes us from M(t) to
where M(t+h),
(! )ik = ijk !
M (t + h) = N (t h) M (t)
j
Quaternion Eqn:
Barr, Extending the Einstein Summation Notation, 2.05 20
N (t h) = M (t + h) M (t) T
multiplying both sides by ijk .
Nij (t h) = Mip (t + h) (M )pj (t) T
Nij (t h) = M
ip (t + h) Mjp (t) 2
!j = 12 pqj Mps (t) Mqs (t) 0
= Mip (t) + hMip + (h ) Mjp (t)ijk !j = 12 ijk pqj Mps (t) Mqs (t)
0
O
0
! = lim0
SinAxis(N (t h)) Quaternion representation
h
Npq (t h)
h!
Thus
h!
tion from q(t) to q(t+h).
!i = 12 ipq Mps (t) Mqs (t)
0
In other words, since p takes us from q(t) to
q(t+h),
Note that the SinAxis operator is described in
identity 21 also note that q(t + h) = p(t h) q(t)
!i] = M i + 1]s Mi + 2]s )
0
so
RelRot(t h) = p(t h)
p(t h) = p(t + h) p 1 (t) ;
or
!1 = M 2s M3s 0
!2 = M 3s M1s 0
Expressing ! in terms of q and q'
!3 = M 1s M2s 0
However, as in the case with the matrices, a sim- nitude m, and q is a unit quaternion).
pler method is available. We note that as h ! 0,
Angle(N) ! sin(Angle(N)). Thus, as before, the
product of the matrix Axis operator and the An- Q0 = (mq)0
gle operator in the limit will equal twice the = mq0 + m0 q
quaternion VectorPart operator which returns the = m 12 !q + qd=dt(Q Q)1 2 =
= 12 !Q + Q Q0 Q=Q Q
VectorPart(p(t h)) So
! = 2 lim
!0 VectorPart
h
( ( + ) ;1 )
h
= 2 lim !0 q t h q
(I ; QQ)Q0 = 21 !Q
= 2VectorPart(1 + q0 (t)q;1 )
h h
so ! or
0 = 2q0 (t)q;1
! Q0 = 21 (I + (1; ) )!Q
QQ
Q Q
or So
e0p = !j p
e M 0ij = Aik Mkj
The VectorPart operator can be thought of as a Half-
7
In N dimensions, the antisymmetric matrix A
SinAxis operator on the unit quaternion. takes the place of the angular velocity vector !.
Barr, Extending the Einstein Summation Notation, 2.05 22
Thus,
i
0 1
X X a 1 0 0
s = c=2 ( ij ai ) = ( ij aj ) = (B @ 0 a2 0 CA)ij
and 0 0 a3
6 6
i j
X X
v = s=2 r: bi ( ij ai ) = (aj bj )
6 6
The rotation X X i j
bj ( ij ai ) = (ai bi )
! X X
6 6
0 ;1
i i
X k j
= vs 0 s 1i ( ai bi ) = ai bi
! a ;v !
6
0 1
a 1 b 1 Z
(i ai bi ) = (B
@ a2 b2 CA)i (I body
)ij = (x y z )(ij xk xk ;xi xj ) dx dy dz:
a3 b3 body
0 1 A point in the body b transforms to the point
body
a 1 0 0
(i ij ai ) = (j ij aj ) = (B
@ 0 a2 0 CA)ij in space b through the following relation:
0 0 a3 bi = Mij (bbody
)j + xi
bi (i ij ai ) = (j aj bj )
bj (i ij ai ) = (i ai bi ) 9 References
plk (k kj gk ) = (j plj gj )
Segel L., (1977) Mathematics Applied to
1i (i ai bi ) = ai bi Continuum Mechanics, Macmillan, New York
Please note that many of the above algebraic sub- Misner, Charles W., Kip S. Thorne, and John
expressions are not tensors | they do not follow Archibald Wheeler, Gravitation, W.H. Freeman
the tensor transformation rules from one coordi- and Co., San Francisco, 1973.
nate system to another.