TensoriaCalc: Mathematica Package for Tensor Calculus
TensoriaCalc: Mathematica Package for Tensor Calculus
物 理 學 系
碩 士 論 文
研 究 生 : 陳 威 澔
指 導 教 授 : 瞿 怡 仁 教 授
中 華 民 國 一 百 一 十 二 年 六 月
n
National Central University
1090326
TensoriaCalc, an user-oriented Mathematica package to
tackle semi-Riemannian tensor calculus problems
by
Wei-Hao Chen
Submitted to the Department of Physics
in partial fulfillment of the requirements for the degree of
Master of Physics
at the
Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wei-Hao Chen
Department of Physics
August 15, 2023
Certified by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Yi-Zen Chu
Professor
Thesis Advisor
Accepted by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
使用者導向 Mathematica 套件
摘要
瞿怡仁所建構的,並且由我顯著地擴展套件。經由使用者提供度量張量以及坐
標系,可以快速算出重要的幾何張量如克里斯多福符號、愛因斯坦張量等,微
分幾何及張量分析中的常見運算如: 張量收縮、座標轉換、投影、偏導數、協
變導數、外微分、李導數亦是可使用的功能。在本文中,我將解釋
TensoriaCalc 的基本運作及使用方式,並展示新添加的功能與建構的思路。最
的問題。
ii
TensoriaCalc, an user-oriented Mathematica package to
tackle semi-Riemannian tensor calculus problems
by
Wei-Hao Chen
Submitted to the Department of Physics
on August 15, 2023, in partial fulfillment of the
requirements for the degree of
Master of Physics
Abstract
TensoriaCalc is an user-oriented Mathematica package developed to tackle tensor cal-
culus problems. By giving a metric tensor and the coordinate set, the users can rapidly
obtain tensor components of geometric objects such as Christoffel symbols, Einstein
tensors, etc. Operations in tensor calculus and differential geometry, such as contrac-
tion, coordinate transformation, projection, partial derivative, covariant derivative, ex-
terior derivative, Lie derivative, etc., are also available. In this paper, I will explain the
basic structure of this package, firstly constructed by Yi-Zen Chu and significantly ex-
panded by me. Also, the track of thought of my newly added functionality or structure
will be presented. Eventually, I will show how to use TensoriaCalc to calculate several
classic problems in General Relativity and Differential Geometry.
iii
Acknowledgements
I especially thank to my advisor, Yi-Zen Chu, who has guided me in the field of the-
oretical physics for five years. He is an advisor who genuinely cares about his stu-
dents. His open and approachable nature has made it easy for me to discuss not only
physics-related questions but also has provided me robust suggestions for challenges
I have faced in both my personal life and career. Additionally, he has offered valuable
guidance on expanding TensoriaCalc.
I would like to extend my appreciation to Vaidehi Verma for her valuable sugges-
tions in improving the code.
Furthermore, I would like to express my gratitude to my father, Zheng-Cheng
Chen, for his hard work and dedication to family.
Last but not least, I thank my friends, Yu-Hao Yao, Wei-Ming Chen, and Kai-Chieh
Ma, who provide me with mental support throughout my master career.
v
Writing Tool
I used LaTeX to write this paper, modifying the NCU Thesis LaTeX Template. Addi-
tionally, I utilized ChatGPT to assist in polishing the text. However, this does not imply
that I overly relied on it. All the knowledge, paper writing, and underlying work are
my own, with guidance from my advisor.
vi
Contents
1 Introduction 1
1.1 Development History and Advantage . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Development History . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.2 Advantage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Basic Structure and Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3.1 Tensor Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.2 Geometrical Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Metric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Christoffel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Riemann . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Ricci, and the first glimpse of TensorComponents . . . . . . . . . 12
RicciScalar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Einstein, and the first glimpse of TensorIsZero . . . . . . . . . . 13
Story: Vacuum Solutions of Einstein field equations . . . . . . . . 14
Weyl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Determinant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.3.3 NonMetricTensor . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.3.4 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
PartialD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
CovariantD and the first glimpse of CovariantHodgeDual . . . . 22
vii
1.3.5 Tensor Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Einstein summation . . . . . . . . . . . . . . . . . . . . . . . . . . 26
TensorsProduct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Evaluating abstract indices at specific coordinates/values . . . . 32
MoveIndices, RaiseAllIndices and LowerAllIndices . . . . . . . 33
SwapIndices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Function Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
UniqueIndices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
1.3.6 Geodesic related object . . . . . . . . . . . . . . . . . . . . . . . . . 41
GeodesicSystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
GeodesicLagrangians . . . . . . . . . . . . . . . . . . . . . . . . . 43
GeodesicHamiltonianDynamics . . . . . . . . . . . . . . . . . . . 44
2 Advanced Functionality 47
2.0.1 Declare Inverse Metric with Quadratic form . . . . . . . . . . . . 47
Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.0.2 OrthonormalFrameField and transformation into orthonormal
basis through MoveIndices . . . . . . . . . . . . . . . . . . . . . . 48
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
orthonormal basis . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.0.3 Second strategy of calculating OrthonormalFrameField and
EigenSystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.0.4 Series expansion on OrthonormalFrameField . . . . . . . . . . . 66
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
viii
2.0.5 TooltipStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
2.0.6 TooltipDisplay→TensorComponents . . . . . . . . . . . . . . . . 68
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
2.0.7 Extract Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
The first benefit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
The second benefit . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
The third benefit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
2.0.8 Endow Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
2.0.9 PartialD now become more flexible . . . . . . . . . . . . . . . . . 80
Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
2.0.10 Partial Derivative with specific coordinate or variable (PD) . . . . 82
2.0.11 ∇g = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
2.0.12 CovariantBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
2.0.13 Auxiliary Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Declare NonMetricTensor in ExpressionForm with Wedge . . . 85
Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
WedgeProductExpand . . . . . . . . . . . . . . . . . . . . . . . . . 87
ToTensorComponents . . . . . . . . . . . . . . . . . . . . . . . . . 87
Declare NonMetricTensor in ExpressionForm with ⊗ or sym-
metric objects . . . . . . . . . . . . . . . . . . . . . . . . . 88
ToExpressionForm . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
ix
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
2.0.14 CoordinateTransformation . . . . . . . . . . . . . . . . . . . . . . 90
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
CoordinateTransformation into a new coordinateset, but share
with same symbol and meaning . . . . . . . . . . . . . . 93
CoordinateTransformation into a new coordinate, but share with
symbols and meanings, to deal with ExpressionForm . 103
CoordinateTransformation into a new coordinate set, with dif-
ferent symbols and meanings . . . . . . . . . . . . . . . 104
CoordinateTransformation into a new coordinate, with different
symbols and meanings, to deal with ExpressionForm . 107
CoordinateTransformation for Christoffel . . . . . . . . . . . . . 108
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
code and usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Projection into (hyper)surface: Induced Tensor other than Christof-
fel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Indices in orthonormal basis won’t be transformed . . . . . . . . 115
Development History . . . . . . . . . . . . . . . . . . . . . . . . . 116
2.0.15 TensorEquations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
2.0.16 LieDerivative and LieBracket . . . . . . . . . . . . . . . . . . . . 118
Killing tensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Development History . . . . . . . . . . . . . . . . . . . . . . . . . 123
x
2.0.17 TensorSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
2.0.18 SymmetrizeIndices and AntiSymmetrizeIndices . . . . . . . . . 126
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
2.0.19 ExteriorD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
2.0.20 PotentialForm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
2.0.21 LeviCivita . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Development History . . . . . . . . . . . . . . . . . . . . . . . . . 139
2.0.22 CovariantHodgeDual . . . . . . . . . . . . . . . . . . . . . . . . . 140
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Development History . . . . . . . . . . . . . . . . . . . . . . . . . 143
Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
2.0.23 TensorWedge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
2.0.24 SymmetrizedArray . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
2.0.25 Declare NonMetricTensor with SymmetrizedArray or
SparseArray TensorComponents . . . . . . . . . . . . . . . . . . 145
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
2.0.26 Normal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
2.0.27 InteriorProduct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
xi
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
2.0.28 MetricOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
2.0.29 TensorAssumption . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
2.0.30 TensorOperator and TensorIsZeroOperator . . . . . . . . . . . . 155
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
2.0.31 TensorDivision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
2.0.32 SphericalHarmonicYTensor . . . . . . . . . . . . . . . . . . . . . 159
2.0.33 VectorSphericalHarmonic . . . . . . . . . . . . . . . . . . . . . . 160
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
2.0.34 OperatorDistributeOverPlus and OperatorProductRule . . . . . 163
Development History . . . . . . . . . . . . . . . . . . . . . . . . . 165
2.0.35 TensorsProduct, TensorComponents and Operators’ Rules . . . 169
2.0.36 Declare scalar as Tensor after operation . . . . . . . . . . . . . . . 180
2.0.37 Conjugate for Tensor . . . . . . . . . . . . . . . . . . . . . . . . . 182
2.0.38 TensorComponentsManipulation . . . . . . . . . . . . . . . . . . . 183
2.0.39 error Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
2.0.40 ElectromagneticStressEnergyTensor . . . . . . . . . . . . . . . . 186
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
xii
3.3 Story: Maxwell’s equations: From 3D vector calculus to 4D tensor cal-
culus in the differential form language . . . . . . . . . . . . . . . . . . . . 202
3.4 Story: Kerr-Newman black hole . . . . . . . . . . . . . . . . . . . . . . . . 208
3.4.1 Kerr–Newman metric is an solution of Einstein-Maxwell equations208
3.4.2 Constants of Motion of a free-falling particle around
Kerr–Newman black hole . . . . . . . . . . . . . . . . . . . . . . . 213
3.5 Story: Linearized gravity . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
3.5.1 Newtonian gravity . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
3.5.2 Gravitoelectromagnetism . . . . . . . . . . . . . . . . . . . . . . . 232
3.6 Story: de Sitter spacetime . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
3.6.1 FLRW metric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
3.6.2 de Sitter metric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Einstein field equations . . . . . . . . . . . . . . . . . . . . . . . . 244
de Sitter spacetime is conformally flat . . . . . . . . . . . . . . . . 245
de Sitter spacetime is maximally symmetric . . . . . . . . . . . . . 248
3.7 Story: Scalar and Vector Basis and more on S2 . . . . . . . . . . . . . . . . 251
3.7.1 scalar basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
3.7.2 vector basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
3.7.3 coordinate systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
3.7.4 Ladder operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
3.7.5 EigenSystem of Spherical Harmonic . . . . . . . . . . . . . . . . . 257
3.7.6 EigenSystem of Vector Spherical Harmonic . . . . . . . . . . . . . 258
3.7.7 Plot of Vector Spherical Harmonic . . . . . . . . . . . . . . . . . . 260
3.8 Story: Conformal Invariance
Maxwell’s Equations in 4D . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
3.9 Story: More example on CoordinateTransformation . . . . . . . . . . . . 269
3.9.1 Monopole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
3.9.2 Coordinate Systems of Kerr black hole . . . . . . . . . . . . . . . . 272
3.9.3 r + SD−1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
xiii
3.10 Story: 3D Weyl Tensor is Zero . . . . . . . . . . . . . . . . . . . . . . . . . 277
5 Appendix 293
5.0.1 Appendix A: FullForm of a 2-Sphere Metric . . . . . . . . . . . . 293
5.0.2 Appendix B: FullForm of a Faraday Tensor declared by Non-
MetricTensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
5.0.3 Appendix C: Solve Hamilton-Jacobi equation of particles around
the Kerr–Newman black hole . . . . . . . . . . . . . . . . . . . . . 294
5.0.4 Appendix D: orthogonality of SphericalHarmonicY . . . . . . . . 296
5.0.5 List of available Functions in TensoriaCalc . . . . . . . . . . . . . . 296
5.0.6 List of Tensor properties . . . . . . . . . . . . . . . . . . . . . . . . 297
5.0.7 List of TensorTypes . . . . . . . . . . . . . . . . . . . . . . . . . . 298
5.0.8 List of OptionValues of Functions and their default values . . . . 298
Bibliography 301
xiv
Notations
Notation and definitions used in this work follow the Math book by Yi-Zen Chu [1]. I
have cited several equations and examples from this textbook as references throughout
this thesis.
In this paper, Latin letters (i, j, k, ...) represent spatial coordinates (1 ∼ D), while
Greek letters (α, β, γ, ...) represent spacetime coordinates (0 ∼ D). Capital Latin letter
(A, B, C, ...) represent indices in (hyper)surface. Normally d is the number of spacetime
dimension, and D = d − 1. We follow natural units, where speed of light c is set to 1.
examples are given with a specific metric tensor in the mostly minus convention. σg
represents metric signature. σg = 1 for mostly plus, σg = −1 for mostly minus. The
D+1 dimension spacetime represent D-dimensional space plus 1-dimensional time. â
indicates a is a index in orthonormal basis.
g normally stands for metric. Γ for Christoffel Symbols, R for Riemann tensor, Ricci
tensor or Ricci scalar. G for Einstein tensor, C for Weyl tensor, | · | for determinant,
ε for orthonormal frame field, ϵ for Levi-Civita symbols or infinitesimal quantity in
perturbation theory, J for Jacobian, T for stress–energy tensor, and F for Faraday tensor.
∇ for covariant derivative. d for infinitesimal quantities or exterior derivative. £ for
Lie derivative. L for Lagrangian. L for Lagrangian density
GN is Newton constant.
≡ represents definition, =
˙ means "be presented as"
Curly bracket in indices indicates symmetrization. Here is an example: T{ij} = Tij +Tji .
Square bracket in indices indicates anti-symmetrization. Here is an example: T[ij] =
Tij − Tji . It is important to note that there is no factorial normalization involved for
both symmetrization and anti-symmetrization, which may differ from some textbooks.
Bold text indicates the corresponding word is a built-in function or object in Mathe-
matica or TensoriaCalc.
xv
In this thesis, some equations and definitions related to tensors and operations may be
presented with Latin alphabet. This is for convenience because we will use a purely
spatial example to demonstrate soon after introducing the equation. For example, in
eq.(1.2), since I use 2-Sphere (pure space) as the first example, before that, I also intro-
duce the metric compatibility with Latin alphabet.
∇k gij = 0 (1)
∇α gµν = 0 (2)
xvi
Chapter 1
Introduction
TensoriaCalc was initially developed by Yi-Zen Chu sometime during 2011-2012. Dur-
ing that time, it included functions for calculating geometrical tensors and
partial/covariant derivatives. In 2016, an additional code section was added by Yi-
Zen Chu to assist in finding solutions to (astrophysical) ideal Magnetohydrodynamics
model under curved spacetimes[4]. Concurrently, the version zero of TensoriaCalc was
released.
1
In 2019, Vaidehi Verma joined the team to help write the electronic manual for Ten-
soriaCalc. In 2020, I joined the team to initiate the expansion of its functionality.
We plan to release version 1 of TensoriaCalc hopefully towards the end of Fall 2023.
1.1.2 Advantage
1.2 Installation
Here, I will provide an example to demonstrate how to include and run the Tensori-
aCalc package. For more detailed information and requirements, please refer to the
official TensoriaCalc manual.
Firstly download TensoriaCalc.nb from the official TensoriaCalc website or any other
reliable internet resource. Open the file and save it again (Ctrl+S). By doing so, Math-
ematica will automatically generate TensoriaCalc.m in the same folder. If done cor-
rectly, you should now have the following two files in your folder.
2
F IGURE 1.1: TensoriaCalc.m should be generated
Then, use the Get(<<) command and specify the location of TensoriaCalc.m. Exe-
cute the command.
Type Tensor in your notebook. If the text color is black instead of blue, it means
you have successfully accessed the functions in TensoriaCalc.
This color distinction is also a method for verifying if you have correctly input any
built-in function of TensoriaCalc.
In this section, I will introduce the most basic structure of TensoriaCalc, created by Yi-
Zen Chu. Readers will also know a few of the most basic functions that will be used
often and have an initial big picture to TensoriaCalc.
3
1.3.1 Tensor Objects
The central concept revolves around a built-in type of object in TensoriaCalc, called
Tensor1 .
You can think of a Tensor as a new type that is built into TensoriaCalc, similar to how
object-oriented programming languages introduce new types. In the terminology of
Mathematica, a Tensor is the the key Head in TensoriaCalc. All information in a tensor
will be stored as a Sequence of Rules2 inside the Tensor, as shown in the following
example.
When you hover your mouse to the output gij , it shows its Tooltip, including the
display of TensorComponents and CoordinateSystem. The text
g2s =Metric[...TooltipStyle→"Large"] is the input part of code. gij and the tooltip box
are output. The SubMinus3 on i− indicates it is a lower Indices. A SuperMinus4 , for
example, i− will represent it is a upper Indices.
Another example: a vector Tensor:
1
In this paper, I will use Bold text to indicate the corresponding word is a built-in function or object
in Mathematica or TensoriaCalc.
2
In Mathematica, a Rule has the form (left-hand side→right-hand side)
3
In Mathematica, to type i− , after you type the letter i, and then press Crtl+_. An sub-script block
will appear on i, and you can fill it with the minus sign -. This is equivalent to SubMinus [i]
4
In Mathematica, to type i− , after you type the letter i, and then press Crtl+ˆ. An super-script block
will appear on i, and you can fill it with the minus sign -. This is equivalent to SuperMinus [i]
4
Properties
There are several essential properties in TensoriaCalc with specific built-in meanings.
Indices, TensorComponents, CoordinateSystem, and StartIndex 5 are the most critical
properties for a tensor. The absence of any of these properties may hinder proper
calculations. Additionally, there are optional properties in TensoriaCalc with built-in
meanings. Readers can refer to all OptionValues and their default value in Sec.(5.0.8).
Format
5
An example for a vector Tensor (rank-1). There is Tooltip when you hover your
mouse on V i .
An example for a rank-2 Tensor. There is Tooltip when you hover your mouse on
V i.
However, whenever there is a rank-≥ 3 Tensor, when user hover the mouse on it,
there is no Tooltip. Here is a more complex rank-4 Tensor.
6
This section demonstrates how information of Tensor objects is stored. However,
it does not imply that users need to declare Tensors by inputting all the information
manually. We have built functions that allow users to quickly declare a Tensor and
calculate relevant properties by providing only the essential arguments. The starting
point for users is to use the Metric (See here: 1.3.2) and NonMetricTensor Functions
(See here: 1.3.3).
Metric
In Einstein General Relativity, the metric tensor/orthonormal frame field contains all
the information about the geometry of spacetime. By having one of them, you can
calculate other important tensors with geometrical meanings. For example, Christoffel
Symbols, Riemann tensor, Ricci tensor, Ricci scalar, Einstein tensor, Wyel tensor, and so
on. In most modern modified gravity theories, based on differential geometry, there is
at least one metric involved.
The definition of all geometrical objects in TensoriaCalc is followed by classical Einstein
General Relativity. Metric has a geometric interpretation related to the length element,
which describes how distances are measured in the spacetime.
Here, dl2 represents what we call ExpressionForm of Metric gij 7 . xi represents the
CoordinateSystem. The Metric also satisfies an important condition that determine
other geometrical objects or operators, known as metric compatibility.
∇k gij = 0 (1.2)
7
Although I use Latin letters in the introduction, it does not mean that TensoriaCalc can only handle
Riemann tensor problems. Users can still input metrics with temporal coordinates. As promised in the
title, TensoriaCalc can handle semi-Riemannian tensor calculus problems.
7
Now, let’s declare a 2-Sphere metric.
1 0
gij =
(1.3)
2
0 sin [θ]
In, TensoriaCalc you have 2 ways to declare an Metric Tensor. Here is the first way.
F IGURE 1.3: g2s: A 2-Sphere metric. it will be used as example frequently in this thesis.
The first 2 arguments are Indices. The third argument is TensorComponents. Ten-
sorComponents could be in the form of MatrixForm or List of Lists. The rest are as
shown in the left-hand side of the Rules.
In TensoriaCalc, the first few arguments of any Function are mandatory. The remaining
input, in the form of Sequence of Rules, represents OptionValues of that Function.
All the Rules in Functions and Tensors are Orderless, which means users can input
them in any desired order. However, this flexibility does not apply to the mandatory
arguments.
Here is the second way to declare a Metric.
(1.4)
That is, user can choose to input TensorComponents in ExpressionForm. That is,
the line element of 2-Sphere.
8
dl2 = dθ2 + sin2 [θ] dϕ2 (1.5)
Notice that the output of these 2 approaches is exactly the same (probably up to a
Simplify8 ).
A technique that user can employ is to apply FullForm to a Tensor when they want
to view all its information. However, it is generally not recommended to do so, as the
output layout may become cluttered.
Here, in Appendix 5.0.1, I provide the FullForm of a 2-Sphere Metric as an example
offering readers have a big picture about what Metric does.
From this example, you can observe that TensoriaCalc have already calculated most of
the important geometrical objects’s TensorComponents’ quantities and stored them
into a newly declared Tensor. To extract them, I’m going to introduce the remaining
geometrical objects’ Functions.
Christoffel
In gravitational theories, connection like Christoffel Symbols determine the the defi-
nition of covariant derivative and geodesic equations. The definition of TensoriaCalc’s
Christoffel is,
1
Γijk ≡ g il (∂j gkl + ∂k gjl − ∂l gjk ) (1.6)
2
Which satisfies eq.(1.2) (metric compatibility) and the following symmetric prop-
erty.
The Christoffel Symbols here is the unique connection in General Relativity (Torsion-
less) given the metric, also known as the Levi-Civita connection in Einstein-Cartan
8
Simplify is a Mathematica built-in Function that searches for all ExpressionForm objects in the
input and returns the output with more compact ExpressionForm.
9
theory. Physicists who incorporate spin into their gravitational theories can construct
their own custom connections.
To declare a Christoffel Symbols or read its TensorComponents, we can call the
Function Christoffel and provide indices and metric. This will generate a Christoffel
Symbolswith the Head Tensor with the TensorType "ChristoffelSymbols". It is impor-
tant to note that although the Head is Tensor, Christoffel Symbols does not follow the
transformation rule of tensors (a rank-3 array, not tensor).
Riemann
In General Relativity, The Riemann tensor directly plays a role in the analysis of tidal
forces.
The Riemann tensor implies a non-zero change of a vector V i or a general tensor
T k1 ...kN l1 ...lM after an infinitesimally small closed loop parallel transport. That is, the
commutator of covariant derivative is not zero. covariant derivative serves as the gen-
erator of parallel transport.
= Rk1 aij T ak2 ...kN l1 ...lM + Rk2 aij T k1 ak3 ...kN l1 ...lM + . . . + RkN aij T k1 ...kN −1 a l1 ...lM (1.8)
10
The definition of Riemann is,
In the language of differential forms, the Riemann tensor is generated by the exte-
rior covariant derivative of Christoffel Symbols.
R i j = DΓ Γ i j (1.10)
where,
DΓ ≡ d · +Γ ∧ · (1.11)
The geometrical objects extract Functions in TensoriaCalc not only allow users ex-
tract geometrical objects Tensors with all lower Indices but also helps calculate if users
want to have any upper index.
11
Ricci, and the first glimpse of TensorComponents
The Ricci tensor Rij is defined as the trace of the Riemann tensor.
l (1.12)
Rij = Rilj
RicciScalar
R = Rii (1.13)
12
Einstein, and the first glimpse of TensorIsZero
1
Gµν ≡ Rµν − gµν R (1.14)
2
It’s an essential component that always appears on left-hand side of Einstein field
equations. Here is an Einstein field equations without the cosmological constant Λ.
p R
LGR = |g| σg + LM (1.16)
16πGN
(1.17)
There is a quick way to test/judge whether a Tensor is a zero tensor or not. We can
use the TensorIsZero Function9 .
9
TensorIsZero returns True if input is a zero Tensor. Return False if input is not a zero Tensor.
13
Story: Vacuum Solutions of Einstein field equations
Vacuum solutions are the most simplest or purest solutions people can find for Einstein
field equations. By setting Tµν = 0, Einstein field equations (eq.(1.15)) become the
vacuum ones.
Gµν = 0 (1.18)
In code.(1.17), we can see that the 2-Sphere S2 is vacuum, even though its Ricci
Tensor is not a zero tensor. In fact, all 2-dimensional spacetimes are locally conformally
flat. This fact implies that the 2D gravitational theorem cannot be described by the
Einstein field equations. The geometric part (left-hand side) is always 0, while we can
have a non-vacuum field in the right-hand side.
Example 1: No General Relativity in 2D spacetime.
Here, we can use TensoriaCalc to show any arbitrary 2D spacetime is vacuum, by
brute force. Declare a general 2D Metric.
(1.19)
14
Let’s move on to higher dimension, firstly 3D. The most trivial case is a 3D Eu-
clidean space or 2+1 Minkowski spacetime. Here I provide slightly more non-triavial
example, 3D spherical coordinate, a classic example of curvilinear coordinate.
By observing the Einstein field equations, we can discover that if the Ricci tensor is
zero, then the Einstein tensor must also be zero. Conversely, the opposite is not neces-
sarily true. In other words, a spacetime with zero Ricci tensor must be vacuum.
Now, let’s proceed with the direct calculation of the Ricci Tensor.
rs rs −1
dτ 2 = 1 − (dt)2 − 1 − (dr)2 − r2 (dΩS2 )2 (1.21)
r r
15
(dΩS2 )2 = dθ2 + sin2 [θ] dϕ2 (1.22)
The code:
(1.23)
rs = 2GN M (1.24)
16
rs r Σ
2
dτ = 1 − (dt)2 − (dr)2 − Σ (dθ)2 +
Σ ∆
(1.25)
2
2rs ra sin2 [θ]
rs ra
r 2 + a2 + sin2 [θ] sin2 [θ] (dϕ)2 + (dt) (dϕ)
Σ Σ
∆ = r2 − rs r + a2 (1.27)
rs r
a, Σ and ∆ are length scales. Σ = 0 and 1 − ∆
= 0 determine the locations of the
two event horizons and two ergospheres, respectively. The ergospheres are significant
boundaries when discussing the frame-dragging effect on free-falling particles, while
the event horizons contribute to the coordinate singularity surfaces of the spacetime.
The Kerr parameter a is determined by the angular momentum angular momentum.
The code:
J
a= (1.28)
M
17
This shows that Kerr black hole is a vacuum solution.
I will not discuss the charged (either non-rotating or rotating) black hole at this point,
but will do so later once I have introduced sufficient functionality (in Sec.(3.4.1))
Weyl
1 gµ[α gβ]ν
Cµναβ ≡ Rµναβ − Rα[µ gν]β − Rβ[µ gν]α + R (1.29)
d−2 (d − 2) (d − 1)
While
Cµναβ = 0 (1.30)
18
Λ
H2 = (1.32)
3
Although it might not looks conformally flat, we can still calculate its Weyl to judge
if it can be transformed into a conformally flat form.
The code:
Determinant
p
dV = |g|dx1 dx2 · · · dxd (1.33)
19
where volume element in spherical coordinate is:
1.3.3 NonMetricTensor
The NonMetricTensor Function helps users declare desired tensors quickly and easily.
Similarly to Metric, user should still provide mandatory arguments Indices, Tensor-
Components, TensorName, CoordinateSystem.
20
1.3.4 Operators
PartialD
21
The first argument is index of partial derivative ∂. The second is the Tensor on
which you want to act. The third is Metric Tensor.
∇k T i1 i2 ...iN j1 j2 ...jM
= ∂k T i1 i2 ...iN j1 j2 ...jM
(1.35)
+ Γikl1 T li2 ...iN j1 j2 ...jM + Γikl2 T i1 l...iN j1 j2 ...jM + ... + ΓiklN T i1 i2 ...iN −1 l j1 j2 ...jM
− Γlkj1 T i1 i2 ...iN lj2 ...jM − Γlkj2 T i1 i2 ...iN j1 l...jM − . . . − ΓlkjM T i1 i2 ...iN lj2 ...jM −1 l
∇k T i j = ∇k g il Tlj
(1.36)
il
= g ∇k (Tlj )
That is, the action of raising or lowering indices commutes with CovariantD.
Additionally, it defines a Tensor that obeys the transformation rule (which PartialD
does not obey) after this derivative.
∇k T i1 i2 ...iN j1 j2 ...jM ξ⃗
(1.37)
iN bM
= (∇c T a1 a2 ...aN
b1 b2 ...bM (⃗x)) J ck J i1a1 J i2a2 ...J b1 b2
aN J j1 J j2 ...J jM
(gradf )i ≡ ∇i f = ∂ i f = g ij ∂j f (1.38)
22
In S2
The first argument is index of covariant derivative ∇. The second is the Tensor on
which you want to act. The third is Metric Tensor.
Users can choose to input it in ExpressionForm or in Tensor form if they want to act
on a scalar.
In form language, the gradient (in 1-form but not 1-vector) is also denoted as:
23
Where the star ⋆ represents Hodge Dual (See here: 2.0.22). d here represents exterior
derivative (not to be confused with infinitesimal change) (See here: 2.0.19).
The indices notation is
In this piece of code, I also show the orthogonality of d̃f and d̄f . i.e.,
ϵ̃ij ∇i f ∇j f = 0 (1.43)
24
The divergence in curved spacetime is defined:
∇i V i (1.44)
This show the equivalece of 2 ways to calculate divergence. One involves PartialD,
while the other involves CovariantD.
1 p
∇i V i = p ∂i |g|V i (1.45)
|g|
25
ϵ̃ijk ∇j Vk (1.46)
Einstein summation
F IGURE 1.4: When the result of contraction is a scalar, the output will be in Expres-
sionForm rather than a Tensor form.
26
F IGURE 1.5: After doing contraction on the first 2 indices, the rank-3 tensor becomes a
rank-1 tensor. The only remaining abstract index is k− . The indices is will be marked
with an UnderBar to indicate that they have been contracted.
I will utilized the Metric declared here (code.(1.19)) to have some examples in this
section.
Example 10: The trace of any metric equals its dimension.
g ii = δ ii = tr(Id×d ) = d (1.47)
Rii = R (1.48)
13
Caution: CoordinateDimension might be an internal Function that we haven’t decided to make it
public.
27
Let’s show it (g2D is declared here code.(1.19)):
1.
3 . This show a way to change indices to a declared Tensor, regardless of the Indices
that the Tensor originally contains.
4. We can call the Indices endow Function. The endow Functions are introduced
in Sec.(2.0.8).
h 1i
∂i ln |g| 2 = Γsis (1.49)
28
Let’s show it:
∇µ Tµν = 0 (1.50)
29
Gµν − Λgµν = 8πGN Tµν (1.51)
p R − 2Λ
LGR = |g| + LM (1.52)
16πGN
Apply CovariantD on left-hand side of eq.(1.51) and recall the metric compatibility
(eq.(1.2)).
∇µ Gµν − Λ
∇µ µ
= 8πG ∇
gµν N Tµν = 0
(1.53)
However, this is not a calculation can be done easily14 . So I only show an arbitrary
diagonalized 3D Metric’s energy/momentum conservation.
14
Caution: This calculation is time-consuming.
30
You might want to ask: Inner contraction within a single Tensor? How about con-
traction between multiple Tensors. This is taken care by TensorsProduct.
TensorsProduct
Users have the option to input either Times of Tensors or List of Tensors. However,
when using the first strategy, it’s important to note that the order of tensors may be re-
arranged due to the Orderless property of Mathematica Times Function. The solution
is discussed in Sec.(2.0.35).
15
Regarding the TensorsProduct Function, please note that there is an extra "s" in comparison to
Mathematica’s TensorProduct function. Please be careful not to confuse the two.
31
When there is at least one pair of repeated indices, after combining into a single Ten-
sor using TensorsProduct, it will automatically trigger Einstein summation Sec.(1.3.5)
Example 14: g −1 g = I
Here I will perform this contraction of metrics.
g ij gjk = δ ik (1.54)
code:
32
After evaluating, it adds an UnderBar to the specified coordinate to indicate that it
is a concrete index. If all the coordinates are specified, the output will become a single
component represented in ExpressionForm.
MoveIndices allows users to freely raise or lower indices. The first argument is the
original Tensor on which the operation is performed. The second argument specifies
the target Indices and the third argument is the Metric used for raising or lowering
the Indices.
For example, let’s consider a Faraday tensor F µν in flat spacetime:
33
To use MoveIndices, we need to declare the Metric in this case, the flat spacetime
Metric ηµν (Minkowski spacetime).
This performs
34
Fµ ν = ηµα η νβ F αβ (1.55)
More example:
(1.56)
35
More example:
Note that if you want to move the indices of a Metric. the Metric itself provides
the information to move itself. Therefor, you do not need to use MoveIndices,
RaiseAllIndices or LowerAllIndices. Metric itself has a built-in functionality to move
its indices.
36
SwapIndices
The first argument is the Tensor to be swapped, and the second argument is the
target Indices order.
After swapping this rank-2 anti-symmetric tensor, we can observe the TensorCom-
ponents become opposite.
37
Function Operator
On the other hand, if users provide RiemannOperator option, the CPU Timing16
16
The Timing is a Mathematica Function returns both the CPU calculation time and the original out-
put. The output List is returned in the form {CPU time, original output} .
38
will be significantly reduced when calculating the Metric. However, the output will
remain unchanged, without undergoing the Simplify.
Series
39
This is equivalent to the first three term of
l
∞
h i 0 −1 X 1 0 −1
ˆ
exp −iθJ = exp θ
= θ (1.58)
l=0
l!
1 0 1 0
code:
Dimensions
40
UniqueIndices
UniqueIndices is a Function that converts every index in the input Tensor into a
unique one.
I have covered a lot about describing the geometry of curved spacetime. At this point,
let me quote one of the most famous sentences in General Relativity by J.A. Wheeler
Spacetime tells matter how to move; matter tells spacetime how to curve.
The Einstein equations are the part that describe how "matter tells spacetime how
to curve". On the other hand, the dynamics or path of particles in General Relativity
follows straight lines in curved spacetime, known as geodesics. This dynamics can be
determined by solving the geodesic equations.
A straight line in curved spacetime corresponds to minimizing the length of path
taken by particles. The length, denoted as l, is given by the integral:
r
λ2
dz α (λ) dz β (λ)
Z
l= dλ gαβ (z (λ)) (1.59)
λ1 dλ dλ
41
where gαβ (x(λ)) is the metric tensor, z α (λ) are the position of the path, and the
fictitious time λ parametrizes the path between the starting point x1 and the end point
x2 .
z µ (λ1 ) = x1
(1.60)
µ
z (λ2 ) = x2
The non-affinely parametrized Lagrangian associated with this length is given by:
r
dz α (λ) dz β (λ) (1.61)
L′g = gαβ (z (λ))
dλ dλ
The equations of motion for this Lagrangian are the non-affinely parametrized
geodesic equations.
d
q
µ
z̈ + Γµαβ ż α ż β µ
= ż ln gαβ ż α ż β (1.62)
dλ
At this point, you can see "Spacetime tells matter how to move". We can always
find an affine parameter λ′ such that
q
gαβ ż α ż β = constant along geodesic (1.63)
1
Lg = gαβ ż α ż β (1.64)
2
z̈ µ + Γµαβ ż α ż β = 0 (1.65)
v σ ∇σ v µ = 0 (1.66)
42
GeodesicSystem
A example with S2 .
GeodesicSystem returns a List output containing four Parts: the first Part is the
affine parameter (eq.(1.64)). The second Part is the non-affinely parametrized La-
grangian (eq.(1.61)). The third Part is the affinely parametrized geodesic equations
(eq.(1.65)). The fourth Part is the non-affinely parametrized geodesic equations
(eq.(1.62)).
GeodesicLagrangians
If you only want to calculate the Lagrangian, you can use GeodesicLagrangians.
example:
43
In GeodesicSystem and GeodesicLagrangians, users can input the OptionValue
AffineParameter and NonAffineParameter to specify the symbols for the affine and
non-affine parameters, respectively.
GeodesicHamiltonianDynamics
∂Lg
pµ ≡ = gµν ż ν (1.67)
∂ ż µ
1
H (z, p) ≡ pµ ż µ (z, p) − L (z, p) = g αβ (z (λ)) pα (λ) pβ (λ) (1.68)
2
∂H
ż µ (λ) = = g µν pν (1.69)
∂pµ
∂H 1 ∂ αβ
ṗµ (λ) = − µ = − g pα pβ (1.70)
∂z 2 ∂µ
code:
Users should provide the Metric Tensor, the conjugate momenta in the form of
Rules with the corresponding coordinates, and the affine parameter.
44
The output is a List. The first Part is the Hamiltonian. The second Part consists of
four sub-Part s, each corresponding to one of Hamilton’s equations of particles’ motion
in S2 . (2d equations for d-dimensional spacetime) The last Hamilton’s equation implies
a constant of motion in S2 since ϕ is absent in 2-Sphere metric (caused by eq.(1.70)).
1 ∂ αβ
ṗϕ (λ) = − gS2 pα pβ = 0 (1.71)
2 ∂ϕ
45
Chapter 2
Advanced Functionality
We have covered the basic usage and examined a few examples. In this chapter, I
will introduce the advanced functionality that has been expanded by me, including
the thought process behind the development of these functions. Additionally, I will
include a code section to explain the expansion of the respective Function if the process
is not straightforward. If there is overlap between my contributions and Yi-Zen’s, I will
include a Development History section as well.
Motivation
47
Solution
Note that although d also has Mathematica built-in meaning for Integrate and total
derivative, there is no strict restriction on its usage, unlike ∂.
Definition
The orthonormal frame field εα̂β transforms a tensor from the coordinate basis to the
orthonormal basis, or its inverse transformation. For example, transform a rank-2 ten-
sor from the coordinate basis to the orthonormal basis
48
The definition of orthonormal frame field is
Usage
(2.5)
49
The output is a List. The first Part is the orthonormal frame field Tensor.
The reason why I call it the inverse orthonormal frame field is because it’s the in-
verse of orthonormal frame field, with respect to the first and third indices, and the
second and fourth indices.
50
The third Part of code.(2.5) is a Metric Tensor that contains the calculation results
of the OrthonormalFrameField and InverseOrthonormalFrameField.
51
Comparing to code.(2.5), if users do not specify the OptionValue Orthonormal-
FrameFieldOperator, the square root operation may not be canceled with square in-
side it in this example. Additionally, if user do not specify the OrthonormalFrame-
FieldIndices, TensoriaCalc will automatically generate 2 Unique Indices, which may
result in a slightly messy output.
If users initially declare a Metric Tensor without specifying the FlatMetric. They
can use OrthonormalFrameField to recalculate it.
52
User can provide either the OrthonormalFrameField or the InverseOrthonormal-
FrameField. If the OrthonormalFrameField is provided, we will calculate Inverse-
OrthonormalFrameField using the following relationship:
ˆ
εâb = ηad εdc g cb (2.8)
code:
ˆ
εdc = η da εâb gbc (2.9)
53
If users are unsure whether they have correctly input the OrthonormalFrameField
or InverseOrthonormalFrameField, they can include the OptionValue CheckOrthonor-
malFrameField→True when declaring the Metric. This will perform a check to ensure
the consistency of the provided frame field.
The output List would have two additional outputs, making a total of five outputs.
The fourth is the check of eq.(2.3). The fifth is the check of eq.(2.4).
Example 16: counter example for CheckOrthonormalFrameField.
Users are encouraged to endow an OrthonormalFrameField to Metric Tensor with
the first strategy if they already know the correct OrthonormalFrameField, and then
TensoriaCalc will help calculate the InverseOrthonormalFrameField. However, if users
are not sure whether they have provided a correct OrthonormalFrameField. CheckO-
rthonormalFrameField to initially check its validity. For a diagonal metric, in current
version, we do not allow users to input an OrthonormalFrameField. Here, I will use
a non-diagonal metric as an example. Although I mentioned that users are not sug-
gested to use the first strategy to deal with a non-diagonal metric, I will firstly obtain
the correct OrthonormalFrameField with the first strategy. The following result is still
correct since two coordinates are symmetric and have the same dimension. The reason
why these two properties are important in this example will be discussed in the second
strategy part.
54
Here is a non-diagonal example that will be further discussed in eq.(3.119).
2
2 2
(dl) = dzdz̄ (2.10)
1 + z z̄
55
Code
In eq.(2.3), it implies how to calculate orthonormal frame field, by given Metric and
FlatMetric.
First, we utilize Mathematica Function EigenSystem which returns the eigenval-
ues λ(M M A) a and eigenvectors of the Metric Tensor. Second, we normalize the eigen-
vectors and combine them to obtain a normalized rotational matrix Oab .
The obtain the square root of eigenvalues. Note that Mathematica assumes every-
thing in flat space. That’s why users should provide th FlatMetric to multiply back to
Mathematica’s eigenvalues.
1
λa 2 = square root of every components in ηab λ(M M A) b (2.11)
1
εâb = λa 2 Oab (For specified a, no sum on the right-hand side.) (2.12)
orthonormal basis
To transform a Tensor from the coordinate basis to the orthonormal basis, like eq.(2.2),
we can use MoveIndices. MoveIndices can not only raise or lower Indices, but also
add OverHat on Indices.
example:
56
The first argument is the Tensor we want to transform. The Tensor is allowed to
be in mixed indices of OverHated2 or Un-OverHated. The second argument is target
Indices List, which can also have mixed indices of OverHated or Un-OverHated. The
third argument is the Metric with the OrthonormalFrameField.
By input OrthonormalBasis or CoordinateBasis as the second argument, users can
use this shortcut where they do not need to specify target Indices List.
2
In Mathematica, to type î, you can select the letter i you typed, and then press Crtl+&. An Over
block will appear on the selected i, and you can fill it with the caret symbol ˆ. This is equivalent to
OverHat [i]
57
Example 17: Tensor in orthonormal basis of spherical coordinate
(See here: 3.2)
Example 18: Tidal force around a Schwarzschild black hole
Before calculating the Riemann Tensor, we should first obtain the Metric with cal-
culated OrthonormalFrameField.
58
OrthonormalFrameField:
InverseOrthonormalFrameField:
The tidal force is described by the Riemann Tensor. For example, a particle (or ob-
ject, or point) deviates from the center of mass of a free-falling particle with a geodesic
field U µ . By choosing the Fermi Normal Coordinate (FNC) system at the center of mass,
the tidal force (imaginary force) acting on the deviated particle at ξ µ compared to the
center of mass is described by the geodesic deviation equation in the FNC system:
d2 ξ µ (2.13)
U α U β ∇α ∇β ξ µ = = −Rµ 0ν0 ξ ν
dτ 2
59
Consider a radial direction deviation ξ µ̂ = δ µ̂r̂ .
rs
Rr̂ 0̂r̂0̂ = − (2.14)
r3
The minus sign in − rrs3 implies that the tidal force is a repulsive force between the
deviated point and the center of mass.
d2 ξ µ̂ rs (2.15)
2
= −Rµ̂ 0̂r̂0̂ ξ r̂ = 3 r̂
dτ r
rs
where r3
> 0.
Consider angular directions deviation ξ µ̂ = δ µ̂θ̂ and ξ µ̂ = δ µ̂ϕ̂ .
60
There is no minus sign. In angular direction, the tidal force is an attractive force.
Consider the three directions of the tidal force, and this is the reason for Spaghetti-
fication when a large enough object gets close to the event horizon of a Schwarzschild
black hole. The shape of the object will be distorted and become lengthy in the radial
direction but squeezed in the angular direction. The shape will become more and more
like Spaghetti, a line, when it gets close to the coordinate singularity of a black hole (For
Schwarzschild black hole, both coordinate singularity and tidal force singularity are at
r = 0).
rs
Notice that, the tidal force is proportional to r3
, while the Newtonian gravitational
rs
attractive force is proportional to r2
. While the total mass of source rs is not large
enough (For example the mass of Moon as the source), for a small size of object like
the human body at the Earth surface, it is not easy to discover the tidal force on human
body. Notice that the Schwarzschild radius of the Earth is about the size of a coin,
and the moon’s rs is even smaller. It is much smaller than the Earth-Moon distance r.
However, when the object is large enough, the deviation ξ µ is significant, and the tidal
force can be discovered. The ocean on the Earth’s surface is widely distributed, which
is why it is easy to observe the tidal force effect on the shape of the ocean. It distorts the
ocean’s shape from a spherical surface to ellipsoid surface, aligned on the Earth-Moon
direction.
However, when the rs is large enough, for example, around a black hole, even a
human body can easily feel the effects of the tidal force. A free-falling human in the
high sky of the Earth may die at the moment they arrive at the floor. For a free-falling
61
human around a black hole, they could even die before reaching the event horizon
because their body gets distorted due to the tidal force.
EigenSystem
In the previous section, we dicussed the first strategy to calculate the Orthonormal-
FrameField. However, it seems that in many scenarios, the result OrthonormalFrame-
Field’s rows are swapped.
Let’s take the orthonormal frame field of Schwarzschild black hole in ingoing
Eddington-Finkelstein coordinates as an example.
In this example, you can observe that ϵ1̂3 = ir is swapped from the third row and
accidentally multiplied by i since the FlatMetric is multiplied by the wrong term. This
problem cannot be discovered if we only see the result of CheckOrthonormalFrame-
Field. However, it will become apparent when users try to transform a tensor into
orthonormal basis, as the physicla dimensions will not be correct.
62
The reason for this problem is the random sorting property of the EigenSystem
output.
Now, EigenSystem can not only accept List of Lists as input but also accept Tenso-
riaCalc’s Tensor objects. I use this Function as an intermediate step if users provide an
non-diagonal metric.
Here is the output of EigenSystem on a Schwarzschild Metric in ingoing Eddington-
Finkelstein coordinates.
The order is swapped. However, there is be a correct order to need to be figure out
by the user. Otherwise even the physical dimensions of the eigensystem may not be
correct. Fortunately, the eigenvalues always correspond to correct eigenvectors.
Now, let’s try to do the analysis. Because the 2-Sphere is the subspace of this metric,
the first eigenvalue −r2 must correspond to the θ-th (3rd) orthonormal frame field ϵθ̂β .
63
The forth eigenvalue −r2 sin2 [θ] must correspond to the ϕ-th (4th) orthonormal frame
field ϵϕ̂β . Both have physical dimensions of [L]2 . This can be even easier to judge from
the eigenvectors since their eigenvectors are not even mixed with other coordinates.
The v and r’s eigenvectors are mixed with each other in coordinates. From FlatMet-
ric {1,-1,-1,-1}, we can know that one eigenvalue that corresponds to the 1st orthonor-
mal frame field ϵ1̂β should be positive. The other one that corresponds the the 2nd
orthonormal frame field ϵ2̂β should be negative. Both of their eigenvalues are dimen-
√
sionless. Fortunately, this is easy to analyze in this case. 5r2 − 2rrs + rs 2 is positive
since 5r2 − 2rrs + rs 2 ∝ 4 + (1 − rs /r)2 > 0. It is obvious that the second eigenvalue
is negative and the third eigenvalue is positive, since we can directly compare their
quantities.
In this case, we know the correct order should be {3,2,1,4}. The 3 at the first place
here means the first orthonormal frame field should correspond to the 3rd output of
EigenSystem es.
However, doing this analysis for any arbitrary Metric automatically by computer,
without human brain, could be very challenging. The Metric could be even higher
dimension with multiple times. One can imagine that it is hard to build a general steps
to find the correct order.
As a result, we have no choice but ask users to follow a 2-step process to obtain
the orthonormal frame field. The first step is what we have done above. Obtain the
output of EigenSystem[Metric] and save it (es). Users should perform some analysis
to obtain the order.
The second step is utilizing OrthonormalFrameField Function. The first argument
is the Metric. The second argument is the es saved in the first step. The third argument
is the correct order provided by users. The fourth argument is the FlatMetric. Users
can also provide OrthonormalFrameField’s OptionValue.
64
OrthonormalFrameField:
InverseOrthonormalFrameField:
65
2.0.4 Series expansion on OrthonormalFrameField
Usage
2.0.5 TooltipStyle
You may have noticed that I have set property TooltipStyle→{”Large”}3 multiple
times. This is done to adjust the size of Tooltip box to match the typesetting of this
thesis. TooltipStyle is an OptionValue of the Mathematica Function Tooltip.
3
TooltipStyle→{”Large”} is equivalent to TooltipStyle→{Large}
66
Usage
When a Tensor is not provided with a specific TooltipStyle, the default value is Tooltip-
Style→{}. In Mathematica, this is equivalent to TooltipStyle→{Small}.
Or TooltipStyle→{Large}.
67
Or change the font color and make it Bold.
2.0.6 TooltipDisplay→TensorComponents
Usage
example:
Consider a rank-4 Tensor.
68
When you hover your mouse over it, there is no Tooltip, since a rank-≥ 3 Tensor
won’t display it by default.
However, by assigning TooltipDisplay→TensorComponents to Tensor, it will dis-
play all the non-zero TensorComponents of the Tensor as a Listwhen hovering over
it.
Motivation
This piece of code was inspired by Yi-Zen’s "Tooltip for Christoffel" code. Normally,
reading the TensorComponents of a rank-≥ 3 Tensor can be difficult, so we choose to
69
hind them. Despite this, Yi-Zen create a code to display all non-zero TensorCompo-
nents of Christoffel. However, there was a problem. When we applied a PartialD to
the Christoffel. The Tooltip didn’t updated to a new one in the output. Even though
the TensorComponents is calculated already for ∂Γ (rank-4), the Tooltip still showed
the non-zero TensorComponents of Γ (rank-3).
I found a way to extend the method for finding all the non-zero TensorCompo-
nents of any rank Tensor. I created the Format to handle this. Right now, TooltipDis-
play→TensorComponents is set as the default value for Christoffel. The result is as
shown in code.(2.19).
Here are a few ways we can utilize TooltipDisplay with Christoffel in spherical
coordinate.
The default one:
70
Say users want to display TensorComponents in MatrixForm.
(2.16)
71
2.0.7 Extract Functions
Motivation
However, others properties of Tensors have not been taken into consideration. Now
we also have extract Function: StartIndex, TensorName, TensorType, TooltipDisplay,
TooltipStyle, TensorAssumption and TensorOperator. The last 2 properties will be
introduced later. TensorAssumption is introduced in Sec.(2.0.29). TensorOperator is
introduced in Sec.(2.0.30).
There are three benefits to creating extract Functions for all properties.
72
The first benefit
The first benefit is that it improves code clarity and speed. For example, when we
want to test if a Tensor is a Metric Tensor, we extract its TensorType, and this is the
way how we originally did.
(2.17)
The second benefit is that it helps programmers establish a unified way of generating
output for scalar ExpressionForms. In operation such as PartialD, CovariantD, and
others that I have not yet introduced, like LieDerivative (See here: 2.0.16), ExteriorD
(See here: 2.0.19) and OutputBecomesOneTensor (See here: 2.0.35), there are cases
where we need to extract scalars’ properties. However, scalars in ExpressionForm are
not a Tensor object, there is no relevant information we can extract. Therefore, we need
to generate a default output in such a situation. Here is an example to demonstrate
how we generate default answers to a scalar ExpressionForm:
73
We recommend that programmers avoid extracting StartIndex and CoordinateSys-
tem from a scalar ExpressionForm. In the case of StartIndex, the default value 0 may
lead to inconsistency if user’s StartIndex is a different number. As for CoordinateSys-
tem, there is no way an ExpressionForm to store such information. Therefore, we have
no choice but to print an error message as output.
Here is an example that we can see how the default value of TensorName works.
Consider a divergence of Faraday Tensor in curved spacetime, say conformally flat
(3+1)D spacetime.
1 p
∇i F ij = p ∂i |g|F ij (2.18)
|g|
74
This resulting output may appear somewhat messy. We recommend that users de-
clare a scalar ExpressionForm as a scalar Tensor if it is not a simple expression. Here
is the demonstration:
75
This may be the first time reader is encountering a combination of scalars and Ten-
sors, with the Head Times or Plus. This is the approach used to calculate TensorCom-
ponents of a collection of objects.
The third benefit is that we can easily and consistently change the level of Cases or
make other adjustments in a single sentence. In Comparison to the code.(2.17), all the
Cases in the extract function are set to level 1. This is done with future development
in mind. Although TensoriaCalc currently does not generate, and we do not recom-
mend declaring Nested Tensors, if in the future we allow it, this will be an important
consideration.
76
2.0.8 Endow Functions
Usage
Consider a Tensor that hasn’t declared its TensorType. When we try to extract its
TensorType, you can see the output is part one of a Null List, indicating that there is
no TensorType assigned to it. By using endow Function TensorType, we can append
a TensorType to the Tensor. This time, when we extract the TensorType, we can see
the newly assigned value.
77
This is useful when one wants to change TooltipStyle or TooltipDisplay.
78
Motivation
You can see the benefits of borrowing a structure. The new Tensor inherits other
properties from the old Tensor, such as TooltipStyle→{"Large"} in this case. However,
commend need to be made can be quite lengthy.
Now we can use endow Functions to achieve the same result rapidly and intu-
itively.
79
Please note that TensorComponents does not have its own endow Function, but
4
only the extract one.
Motivation
4
For programmer: The reason for this is because it will mis-trigger OperatorDistributeOverPlus (See
here: 2.0.34) and cause a bug.
80
Since a lower index PartialD doesn’t involve the inverse Metric, all we need is the
CoordinateSystem, which can already be extracted from Tensor t without the need for
the Metric Tensor m. Users can choose to provide an additional CoordinateSystem or
Metric. If they do so, TensoriaCalc will use the coordinate information provided by the
users.
For a lower index PartialD ∂k acting on a scalar ExpressionForm, we must provide
either CoordinateSystem or Metric. However, if users declare it as a scalar Tensor
first, TensoriaCalc can extract CoordinateSystem from it automatically.
Again, since a lower index PartialD doesn’t involve the inverse Metric, the fol-
lowing shortcut contains all the necessary information we need. However, it is only
available for lower index PartialD and not for upper index PartialD.
81
2.0.10 Partial Derivative with specific coordinate or variable (PD)
PD will act as a derivative on a Tensor t (the first argument) with respect to a variable
v (the second argument). The output will remain the same rank without extra index.
example:
This is equivalent to these 2 ways that utilize PartialD and then project to θ coordi-
nate. The later one requires more calculations.
More example:
82
You can do it multiple times.
(2.19)
This example shows we can apply PD to a scalar Tensor, and the variable can be a
non-coordinate variable.
2.0.11 ∇g = 0
83
Metric Tensor. Of course, if you use Christoffel to construct its definition and calculate
it, you can prove it is really zero.
2.0.12 CovariantBox
Definition
The CovariantBox applies the box operator on a Tensor in curved spacetime and is
defined as follows:
The box operator is also known as d’Alembert operator and wave operator.
Usage
The first argument represents the object on which you want to apply the box oper-
ator. The second argument represents the Metric Tensor.
Apply on a Tensor:
84
An application of wave operator on a higher rank tensor can be found in Sec.(3.8).
Motivation
which is the simplest example that satisfies symmetry properties of Riemann tensor.
Usage
85
2 more example:
86
WedgeProductExpand
ToTensorComponents
ToTensorComponents is the second step. This requires Indices to read the position of
indices and the coordinates List.
Let’s apply it on Rotimes:
87
Declare NonMetricTensor in ExpressionForm with ⊗ or symmetric objects
88
ToExpressionForm
Usage
89
2.0.14 CoordinateTransformation
Definition
V = V i ∂i (2.22)
90
An upper index corresponds to an infinitesimal displacement basis.
This is a 1-form.
W = Wi dxi (2.23)
T = T a1 a2 ...aN b1 b2 ...bM [⃗x] ∂a1 ⊗ ∂a2 ⊗ . . . ⊗ ∂aN ⊗ dxb1 ⊗ dxb2 ⊗ ⊗ . . . ⊗ dxbM (2.24)
Here is where the coordinate transformation comes into play a role. When we
change from one d-dimensional coordinates ⃗x into another d-dimensional coordinates
⃗ the basis is transformed by:
ξ,
∂ξ i
i
∂a = a
∂ξi ≡ J −1 a ∂ξi
∂x
b (2.25)
∂x
dxb = j
dξ j ≡ J bj dξ j
∂ξ
The J and J −1 are known as Jacobian and inverse Jacobian. They are inverses of
each other.
Substitute the basis transformation rule eq.(2.25) into eq.(2.24).
J J −1 = I (2.26)
91
h h ii
T ⃗x ξ⃗
From the fourth equality, we can see how the tensors transform under coordinate
transformations.
h i
T i1 i2 ...iN j1 j2 ...jM ξ⃗
h h ii (2.28)
i i i
=T a1 a2 ...aN
b1 b2 ...bM ⃗x ξ⃗ J −1 1 a1 J −1 2 a2 . . . J −1 N a J b1j1 J b2j2 . . . J bNjN
N
92
the same coordinate set. This type of transformation corresponds to continuous or
incontinuous symmetries and allows for the transformation of tensors into another ob-
server’s perspective. For example, in Minkowski spacetime, there are 10 transforma-
tions with SO(3,1) symmetry, including 4 spacetime translations, 3 spatial rotations and
3 boosts. The CoordinateSystem involved in this transformation are from {t, x, y, z} to
{t′ , x′ , y ′ , z ′ }
The second type of transformation involves a change to a completely different co-
ordinate set while describing the same physical phenomena from the same observer’s
perspective. For example, transforming from 3D Cartesian coordinates to 3D spherical
coordinates. The CoordinateSystem involved in this transformation are from {x, y, z}
to {r, θ, ϕ}
The third type is to coordinate transform Christoffel.
The forth type is to calculate induced tensors.
These four types of CoordinateTransformation serve different purposes and re-
quire different input arguments in TensoriaCalc.
r′ r
= R
θ′ =θ (2.29)
ϕ′
=ϕ
93
For the first type of CoordinateTransformation, you only need to provide the Ten-
sor t that you want to transform as the first argument, and the transformation Rules
ct as a List. t is T a1 a2 ...aN b1 b2 ...bM in eq.(2.28). TensoriaCalc will calculate Jacobian and in-
verse Jacobian with ct that users input through derivative. The output will be eq.(2.28).
94
Let’s recall the definition of Christoffel (eq.(1.6)). Christoffel symbols are com-
posed of terns involving g −1 ∂g. This implies that the factor 1
R2
will be canceled out.
In this case, the re-scaling of r causes the constant re-scaling on metric, which can be
viewed as a constant Weyl transformation. Geometrical objects except the metric, in-
verse metric, Weyl tensor, orthonormal frame field, and determinant of the metric, are
invariant under the constant Weyl transformation.
The Weyl transformation is to re-scale the metric with a spacetime-dependent factor
Ω [x]2
ḡµν describes the original spacetime, and gµν describes the new spacetime after the
Weyl transformation.
The relationship between Christoffel symbols after and before the Weyl transfor-
mation is:
The Γµαβ [g] represents Christoffel symbols after the Weyl transformation, and Γ̄µαβ [ḡ]
represents Christoffel symbols before the Weyl transformation.
1
In this case, it is a constant Weyl transformation Ω2 = R2
, where R is a constant. All
derivative of Ω vanish.
95
Γµαβ [g] = Γ̄µαβ [ḡ] + ∂ lnΩ δ µβ} − ḡαβ µ (2.32)
(∂ ln Ω)
{α
That’s why Christoffel Symbolsare invariant under the constant Weyl transforma-
tion, i.e., Γµαβ [g] = Γ̄µαβ [ḡ].
Similarly, if you observe the Riemann tensor Rµ ναβ , Ricci tensor Rµν , Ricci scalar R,
Einstein tensor Gµν (with correct indices position) under the Weyl transformation, all
the changes are contributed by the derivatives of Ω, which vanishes under a constant
Ω.
Here is an example that we can see the difference in geometrical objects, a confor-
mally flat coordinates of 2-Sphere (χ, ϕ). More discussion about this coordinates could
be found in eq.(3.118) in Sec.(3.7.3).
Re-scale the χ:
If you extract the Ricci Tensor, you can see the difference.
96
Example 20: Faraday Tensor in Minkowski spacetime under a Lorentz boost
Consider a Faraday Tensor in Minkowski spacetime.
t′
= γ (t − βx)
x ′
= γ (x − βt)
(2.33)
y′
=y
z ′
=z
97
(2.34)
where γ = √ 1
1−β 2
98
where ξ is rapidity.
′
For Fty′ , this implies Ey′ = cosh [ξ] Ey + sinh [ξ] By and Fxz implies By′ = cosh [ξ] By −
sinh [ξ] Ez .
Example 21: Faraday Tensor in Minkowski spacetime under a rotation
Consider a rotation matrix that rotates θ on x-y plane. Let’s transform the Faraday
Tensor.
99
F ′ remains invariant.
Example 23: Minkowski Metric remains invariant under translation, rotation and
boost.
The definition of a member Λ of Lorentz group is:
ΛT ηΛ = η (2.35)
100
rotation on x direction (y and z are similar, totally 3):
101
E
E
µ
P =
(2.36)
0
0
The following condition implies that the photon propagates on the light cone, i.e.,
with speed of light.
102
This shows p′2 = 0 in another frame.
CoordinateTransformation into a new coordinate, but share with symbols and mean-
ings, to deal with ExpressionForm
If we only provide the transformation Rules as the sole argument, the output will
include not only the transformation Rules for coordinates, but also the transformation
Rules for basis.
That is, append these as Rules to input List:
∂xb
b
dx = j
dξ j (2.38)
∂ξ
i
∂ξ
∂ xa = ∂ξ i (2.39)
∂xa
Here is an example:
103
This again shows the Lorentz invariance.
Use this way to Lorentz transform a Faraday tensor ExpressionForm.
104
Minkowski spacetime : {t, x, y, z} → {t′ , x′ , y ′ , z ′ }. The second type transformation
involves a change to a completely different coordinate set. For example, transforming
from 3D Cartesian coordinatetransforms into spherical coordinate: {x, y, z} → {r, θ, ϕ}.
x = r sin [θ] cos [ϕ]
y = r sin [θ] sin [ϕ] (2.40)
z
= r cos [θ]
In comparison to the first type transformation, the second type require an addi-
tional argument: the symbols’ name of the new coordinate set as a List.
To simplify the process, you can declare the transformation as a new variable, al-
lowing you to quickly and easily apply the transformation multiple times.
105
Once again, if you coordinate transform a Metric Tensor, all geometrical objects
will be updated accordingly.
106
r > rs :
r < rs :
Similar to the first type, if users only provide transformation Rules ct and the new
coordinate List coo, the output will be a Rule List. User can then use this with Replace
to transform an ExpressionForm.
107
Use Replace:
Definition
h i h h ii l l ∂ 2 xk
Γlij ξ⃗ = Γkmn ⃗x ξ⃗ J −1 k (J)mi (J)nj + J −1 k j i (2.41)
∂ξ ∂ξ
The first term ΓJ −1 JJ transform like a tensor. The second term which involved
with a Hessian ∂ξ2 x is the term makes Christoffel Symbolsnot a tensor.
Since the first term transforms like a tensor, we will use the CoordinateTransformation
for a normal Tensor to calculate it. The second term is the additional term that needs
to be calculated. With the provided ct, we can obtain both (inverse) Jacobian and the
Hessian. There are no more additional arguments required compared to the second
type of CoordinateTransformation. Therefore, the syntax is identical to the second
108
type. The input consists of the Christoffel chr, a List of transformation Rules ct and a
new coordinate set coo.
The TensorType of chr "ChristoffelSymbols" would prevent TensoriaCalc from trig-
gering CoordinateTransformation for a normal Tensor. To calculate the first term, a
temporary Tensor chr′ is declared, inheriting all the information from input Christof-
fel chr except its TensorType. chr′ is then fed into CoordinateTransformation to obtain
the first term. The second terms is the Hessian contracted with the inverse Jacobian.
The Hessian can be obtained by taking an additional partial derivative to Jacobian.
Let’s transform a Christoffel from 3D Cartesian to spherical coordinates.
109
Transform a Christoffel from 3D Cartesian to cylindrical coordinates.
The process does not involve the Metric. The result is equivalent to substituting a
Metric in the new coordinates into Christoffel.
Definition
In differential topology, there is the theorem called the Whitney embedding theorem. It
states that any arbitrary smooth spacetime/space (whether it is flat, has extrinsic cur-
vature or intrinsic curvature), can be smoothly embedded into a higher-dimensional
flat spacetime/space, with the dimension that is at most twice the dimension of origi-
nal manifold. It is useful to transform a tensor from a higher-dimensional spacetime to
a lower-dimensional one. It provides a new approach to understanding the properties
and symmetries of (hyper)surfaces.
For example, a (3+1)D de Sitter spacetime can be embedded in a (4+1)D Minkowski
spacetime. A (3+1)D Schwarzschild black hole can be embedded in a (5+1)D Minkowski
spacetime.
110
To transform to a lower dimension, a constraint function is required, which can in-
volve multiple coordinates of the ambient space. The constraint can even be nonlinear
with respect to the coordinate variables. However, if one can find a good coordinate
system to describes the relationship between the ambient space and its (hyper)surface
using a constraint that involve only one coordinate. one can easily project a tensor onto
a (hyper)surface.
For example, by specified the constraint r = R in spherical coordinates {r, θ, ϕ}
with a constant R, we can obtain a 2-Sphere with radius R. In other words, the 2-
Sphere {θ, ϕ} is embedded in 3D Cartesian/spherical space.
This is the definition of this type of transformation to a rank-(N+M) Tensor from
⃗
ambient space coordinates ⃗x to (hyper)surface new coordinates ξ:
h i h h ii
T A1 A2 ...AN B1 B2 ...BM ξ⃗ = T a1 a2 ...aN b1 b2 ...bM ⃗x ξ⃗ E A1a1 E A2a2 . . . E AN aN
(2.42)
bN
E b1B1 E b2B2 ...E BN
∂ξ A
∂a = ∂ A ≡ E Aa ∂ξA
∂xa ξ
(2.43)
∂xb
dxb = B dξ B ≡ E bB dξ B
∂ξ
Usage
111
argument is not necessary. The requirement for the ambient space Metric will be ex-
plained in detail in the code section ((See here: 2.0.14)). Additionally, the third argu-
ment coo will have a shorter Length. The Length of the second argument ct corre-
sponds to the dimension of ambient space, i.e., Length[ct] = d. On the other hand, the
Length of coo corresponds to the dimension of (hyper)surface. i.e., Length[coo] = D.
Here we project a identity matrix from 3D Cartesian to 2-Spherewith radius R.
112
The induced metric can be obtained from projecting an ambient metric.
h h ii h i
gij ⃗x ξ E I E J = HIJ ξ⃗
⃗ i j
(2.44)
As advertised, projecting a Metric to obtain induced Metric H itself does not re-
quired the fourth argument. Here, project 3D Cartesian Metric to obtain a 2-Sphere
Metric with radius R.
(2.45)
Note that for Induced Christoffel. Users can directly plug the induced Metric into
Christoffel. There is no benefit to build another CoordinateTransformation code for
Induced Christoffel. Since it still requires an induced Metric.
Code
113
i
to obtain the inverse Jacobian (J −1 ) a , since J bj is a square d × d matrix, which is invert-
ible. TensoriaCalc then use TensorsProduct to contract them with Tensor.
For a projection from d-dimensional ambient space coordinates ⃗x to D-dimensional
⃗ where d < D, obtaining the E A directly from a single set
(hyper-)surface coordinates ξ, a
h i
of ct provided by users is not straightforward. With ct ⃗x ξ⃗ , E bB can still be calculated
easily. However, since E bB is a non-square d×D matrix, it is not invertible. This implies
that users may need to provide the inverse transformation Rules ξ⃗ [⃗x] to calculate E Aa ,
which can be a challenging task. In the definition eq.(2.42), both E bB and E Aa are
required.
The solution to this issue is to avoid using E Aa . Instead, we can perform the Low-
erAllIndices on the input Tensor
T a1 a2 ...aN b1 b2 ...bM first. This operation requires the ambient space Metric gij , but this is a
much simpler task compared to providing ξ⃗ [⃗x].
The first step:
LowerAllIndices [T a1 a2 ...aN b1 b2 ...bM , Ambient Metric gij ] → Ta1 a2 ...aN b1 b2 ...bM (2.46)
The left-hand side of the arrow represents the input, and the right-hand side of the
arrow represents the output. This step requires the ambient Metric gij .
With ct, we can obtain d × D matrix E bB . Now we can proceed with the projection.
The second step:
Then move the Indices back to the original position, with induced Metric.
114
MoveIndices TA1 A2 ...AN B1 B2 ...BM , A1 − , . . . , BM − , Induced Metric Hij
(2.48)
→ T A1 A2 ...AN B1 B2 ...BM
The Induced Metric Hij can be obtained using the method as demonstrated in
code.(2.45). This method also requires the ambient Metric as an input, which is also
required in the first step. This is the reason that users need to provide it as the fourth
argument.
115
Transform a identity matrix in orthonormal basis of 2D Cartesian to 2D polar coor-
dinates. It’s won’t be transformed.
Development History
In the version zero of TensoriaCalc, there were already functionalities for Coordinate-
Transformation of Metric and the generation of Rules. The functionality for the in-
duced Metric was also available. Later, I expanded these capabilities to include Co-
ordinateTransformation for higher rank Tensors, induced Tensor (projections), Co-
ordinateTransformation for OverHated objects and CoordinateTransformation for
Christoffel.
116
2.0.15 TensorEquations
Definition
TensorEquations takes a left-hand side Tensor TLHS as the first argument and a right-
hand side Tensor TRHS as the second argument, and outputs the Equal List component-
by-component.
Usage
117
If one side is a zero Tensor, you can directly input 0 on the right-hand side.
Killing tensor
118
v σ ∇σ (Kµ1 ...µN v µ1 . . . v µN ) = 0 (2.54)
ξµ v µ (2.56)
One should note that finding a Killing vector is normally much easier than finding
a higher rank Killing tensor in a specific spacetime. In the next section, I will introduce
a method to initially find some conserved quantities in a spacetime.
Definition
Lie derivative is the first of order change of a Tensor T while translation along an
infinitesimal vector ξ.
Consider a infinitesimal translation x = x′ + ξ. The first order of change on a rank-
(N + M ) tensor is:
(2.57)
119
The first term is contributed by the change of T along original ξ. The remaining
terms show that not only the change of T contributes, but also the change of ξ itself
contributes.
The higher-order change of T involves higher-order Lie derivatives.
Also, the Lie derivative itself can help analyzing the symmetry.
The Lie derivative of the metric tensor is equal to the left-hand side of the Killing
vector equation.
The simplest way to initially find some Killing vectors is that if there is a coordinate
z that does not appear in any of the tensor components of the metric, then the Lie
derivative along z direction (ξµ = ẑµ = δ zµ ) is equal to 0. This corresponds to a constant
of motion:
pz = δ zµ v µ = v z (2.59)
Usage
Declare J (x) , J (y) and J (z) first, which I will show are all Killing vectors of 2-Sphere.
120
Testing the three vectors, we can see that all of them satisfy Killing equation on
2-Sphere.
You can also obtain Lie derivative on a 1-vector along another 1-vector.
[V, W ]i ≡ V j ∇j W i − W j ∇j V i
= V j ∂j W i − W j ∂j V i (2.60)
= £V W i = −£W V i
121
This is a demonstration to show that the LieBracket of 2 Killing vectors (V and W )
is still a Killing vector.
(2.61)
£[V,W ] g µν
=0
You can also apply LieDerivative to a scalar ExpressionForm. The output will still
be scalar ExpressionForm.
£V f = V i ∂i f (2.62)
122
A shortcut is available, by using £ (\[Sterling])
Development History
In the version zero of TensoriaCalc. It included the LieDerivative for Metric. Later, I
extended it to higher rank Tensors and implemented the LieBracket and their shortcut.
2.0.17 TensorSymmetry
Motivation
The ability to extract the symmetric property of tensors allows for the potential to per-
form abstract calculations, which are expected to consume less CPU Timing compared
to concrete calculations. While this functionality has not been developed in Tensoria-
Calc, TensorSymmetry may serve as a first step towards its further development.
The output of TensorSymmetry is a 2-component List. It extracts the TensorCom-
ponents and applies the Mathematica TensorSymmetry operator to them, resulting in
the first output. The second output is the Tensor endowed with the TensorSymmetry
property.
Let’s obtain the TensorSymmetry of a Metric.
123
You can use Cases to extract TensorSymmetry, but there is no extraction Function
available for it.
However, ZeroTensor may not be a publicly available Function in the future pub-
lished version of TensoriaCalc. Here I provide a method to call an internal Function of
a package.
124
This syntax can be used if ZeroTensor is a private Function.
TensorSymmetry of a Riemann Tensor.
Rµναβ = Rαβµν
Rµναβ = −Rµνβα
Whenever there are multiple symmetry relationships, Cycles is used. The second
number beside each cycle represents the factor difference when swapping indices.
Let’s consider a complex symmetry:
125
2.0.18 SymmetrizeIndices and AntiSymmetrizeIndices
Definition
Fully SymmetrizeIndices:
T{α1 ...αN } = Tα1 ...αN + Tα2 α1 ...αN + All permutation (N! terms) (2.66)
1
Notice that in TensoriaCalc, there is no normalization factor of N!
.
For example:
Fully AntiSymmetrizeIndices:
1
Again, in TensoriaCalc, there is no normalization factor of N!
.
126
T[α|β|γ] = Tαβγ − Tγβα (2.73)
Usage
After applying the Function, you can see that the symmetric property has been
fully symmetrized.
You can also convert the TensorComponents from a List of Lists into a
SymmetrizedArray.
127
For partially SymmetrizeIndices, users should provide the target indices List as
the first argument.
Again, we can use TensorSymmetry to see the result is symmetrized on the first
and the third indices.
128
A 4-dimensional rank-4 fully anti-symmetric Tensor has only one independent com-
ponent.
129
Let’s declare the Riemann Tensor and check that it is not a zero Tensor.
Then let’s declare the left-hand side of the following Bianchi Identity:
Ri[jkl] = 0 (2.74)
It is a zero Tensor.
130
It is a zero Tensor.
2.0.19 ExteriorD
Definition
dF (2.76)
1
∂[µ Fα1 ,α2 ,...,αp ] (2.77)
p!
Usage
131
F = dA (2.78)
This generates the spatial Faraday Tensor, which corresponds to the magnetic field
B only.
If users do not specify the new index, TensoriaCalc will automatically generate a
Unique index. This is for convenience if users only need the TensorComponents and
do not require further contraction with other tensors.
132
Example 27: Infinitesimally Thin Solenoid
Consider a vector potential in 3D Cartesian:
xdy − ydx
Ai dxi = (2.79)
x2 + y 2
Z Z
n⃗
p ijk
d ξ |g (ξ) |ni ϵ̃ ∂j Ak = dn−1 xAi (2.80)
D ∂D
133
Where the left-hand side is a finite n-dimensional (hyper-)volume D with coordi-
nates ξ⃗ in spacetime, and the right-hand side is (hyper-)surface with coordinates ⃗x. The
outgoing field on the boundary of D is described by ni .
First, let’s convert the 3D Cartesian vector potential Ai to 3D cylindrical coordinates.
Z Z
ijk 1
dxdydzni ϵ̃ Fjk = dϕ (2.81)
D 2 ∂D
Z Z
ijk 1
dxdydzni ϵ Fjk = dϕ = 2π (2.82)
D 2 ∂D
Z Z
ijk 1
dxdydzni ϵ Fjk = dϕ = 0 (2.83)
D 2 ∂D
134
The vector potential of the 2D infinitesimally thin solenoid can be generated by dϕ
2.0.20 PotentialForm
Z 1
1 n
dt tp−1 αij...k tx1 , tx2 , . . . , txn xi
βj...k x , . . . , x = (2.85)
0
by given a p-form αij...k as input and returns a (p − 1)-form βj...k . A proof of this
equation is demonstrated in Sec.(4.0.4).
135
Usage
The second argument t in eq.(2.85) is the name of the integrating variable. If the
integral can be finished, there is no difference whether you provide it or not.
136
By given Ai = di θ, we can obtain θ again.
If you provide a Tensor as the argument, it will generate a scalar potential rep-
resented as a Tensor object. If the argument is not a Tensor, it will be treated as an
expression and represented in ExpressionForm.
2.0.21 LeviCivita
Definition
p
A LeviCivita Tensor ϵ̃ is defined as the Determinant of the Metric |g| multiplied by
the Levi-Civita symbols ϵ.
p
ϵ̃µ1 ,µ2 ,...,µd = |g|ϵµ1 ,µ2 ,...,µd (2.86)
The LeviCivita Tensor is a pseudo-tensor, which means you can raise or lower in-
dices by the Metric Tensor itself. It also obeys the coordinate transformation rule.
137
However, the word "pseudo-" implies that under a spacetime parity flips transforma-
tion, it is invariant, which means it does not behave like a normal tensor, but rather
differs by up to a minus sign.
Usage
To declare ϵ̃µναβ , users should provide Indices and the Metric. By default, ϵ0123 ≡ 1.
In addition to all lower indices as example shown here, users can also choose to input
all upper or mixed Indices. TensoriaCalc will handle the MoveIndices operation for
users.
Declare ϵ̃µναβ
138
If users want to define ϵ0123 ≡ −1, they can add a Minus as an additional argument.
Development History
In version 0 of TensoriaCalc, this Function was already available. I have made modifica-
tions to use Mathematica’s built-in Function LeviCivitaTensor6 . Additionally, I have
made the definition of ϵ012...D ≡ −1 available.
6
Although it is called LeviCivita"Tensor", the output is actually a flat Levi-Civita symbol.
139
2.0.22 CovariantHodgeDual
Definition
1 µ1 ...µd−N ν1 ...νN
T̃ µ1 ...µd−N ≡ ϵ̃ Tν1 ...νN (2.87)
N!
Usage
140
Obtain ⋆F from a 0-form (Tensor) by applying the CovariantHodgeDual operation,
resulting in a 4-form.
141
Declare as a Tensor with Tensor as an additional argument.
If you do not specify the Indices, TensoriaCalc will automatically generate a set of
Unique Indicesfor the CovariantHodgeDual operation.
142
Development History
Code
First, apply RaiseAllIndices to the tensor, then use the HodgeDual function, and fi-
nally apply MoveIndices.
2.0.23 TensorWedge
The wedge product between a p-form Tensor α and a q-form Tensor β is defined as
follows:
α ∧ β = (−1)pq β ∧ α (2.88)
Usage
143
2.0.24 SymmetrizedArray
Usage
Let’s declare a Tensor with certain symmetry, and its TensorComponents are given as
a List of Lists.
Using SymmetrizedArray:
144
The TensorComponents are now in the form of a SymmetrizedArray, and the Ten-
sorSymmetry of the Tensor is updated accordingly.
SparseArray TensorComponents
Usage
145
The methods of storing information differ.
2.0.26 Normal
Normal is a Mathematica Function that has multiple functionalities. One of its appli-
cation is to convert a SymmetrizedArray or a SparseArray into a List of Lists.
146
You can directly apply it to a Tensor to convert its TensorComponents.
2.0.27 InteriorProduct
Definition
A q-vector X α and a p-form ωβ1 β2 ...βp . The operation to obtain their InteriorProduct
(ιX ω) returns a (p − 1)-form (p > q):
1 β1 ...βq
(ιX ω)βq+1 ...βp = X ωβ1 β2 ...βq βq+1 ...βp (2.89)
q!
Usage
147
The order of X and ω can be swapped.
There is a shortcut using ι (iota).
By adding a third argument Tensor, you can declare the output as a Tensor.
148
Declare two 1-vectors, X and Y , and a 2-form ω.
ιY ιX ω = −ιX ιY ω
(2.90)
ιX ιX ω = 0
149
2.0.28 MetricOperator
The MetricOperator is a new OptionValue for the Metric Function. It allows users to
specify the operator they want to apply to the metric TensorComponents itself. This
operator will be active when a Metric is declared with ExpressionForm TensorCom-
ponents or when calculating the Inverse Metric.
Usage
150
Users have the option to provide additional conditions for Simplify or choose not
to perform any Simplify by providing this OptionValue.
Inverse Metric:
151
2.0.29 TensorAssumption
Usage
Declare a Tensor g that cannot be fully simplified without providing further assump-
tions.
152
You can also use endow Function.
After extracting the Christoffel from g and applying Simplify, you can observe
that there are still Abs [sin [θ]] terms remaining in the result.
In comparison to this, after extracting the Christoffel from gT A and applying Sim-
plify, you can observe that there are no Abs terms anymore. This example demon-
strates that the TensorAssumption is inherited for all geometrical objects Tensors from
Metric.
153
TensorAssumption could be an important issue while calculating Orthonormal-
FrameField, as it involves the Sqrt.
If you provide TensorAssumption and then apply Simplify, the Sqrt will be ex-
panded.
154
2.0.30 TensorOperator and TensorIsZeroOperator
Usage
Since they are not exactly the same, TensorIsZero’s output is False if we subtract
them.
155
If the TensorIsZeroOperator is not provided, TensoriaCalc will search for the Ten-
sorOperator stored in the Tensors you plug into this Function. However, it is better
to ensure that every Tensor stores the same TensorOperator if you want to use this
strategy effectively.
Here is an example to endow both Tensors with TensorOperator, and we apply
TensorIsZero.
2.0.31 TensorDivision
Definition
In tensor calculus, there is no concept of division between tensors. However, there are
situations where we may want to determine whether two tensors are proportional to
each other and find the factor of proportionality κ.
For example, in the Einstein field equations, the factor kappa may differ for different
types of stress–energy tensor.
156
Usage
TensorDivision solves for the factor between the components of the left-hand side
Tensor and the right-hand side Tensor evaluating each component separately. If the
components are proportional to each other, and the factors are the same value for every
component, the output will be the value of the factor κ in ExpressionForm.
The TensorComponents of the left-hand side Tensor appear in the numerator, while
the TensorComponents of the right-hand side Tensor appear in the denominator.
If the factors of all component divisions can not be recognized as a single Expres-
sionForm, even after simplification, the output will be a Tensor that contains all factors
in their corresponding positions.
157
If a component in numerator is zero while the corresponding component in the
denominator is non-zero, the factor will be 0. This is because we multiply κ on the
right-hand side and any division involving zero will result in zero.
158
Take 2-Sphere as an example. The metric is equal to the Ricci tensor multiplied by
the radius squared, r2 .
If users swap Tensor on the left-hand side and the right-hand side, the output will
be the reciprocal of the original result.
More example of TensorDivision can be found in Sec.(3.7.4) and Sec.(3.7.5).
Providing the TensorDivisionOperator helps TensoriaCalc to determine if the com-
mon factor is the same. If no TensorDivisionOperator is provided, TensoriaCalc will
search for a TensorOperator in the left-hand side Tensor and right-hand side Tensor.
Code
2.0.32 SphericalHarmonicYTensor
159
The definition and syntax are the same as Mathematica’s built-in Function, Spher-
icalHarmonicY.
One can also assign the eigenvalue parameters of SphericalHarmonicY l and m.
2.0.33 VectorSphericalHarmonic
Definition
The vector orthonormal basis on the 2-Sphere consists of 2 sets: Ail,m , Bl,m
i
. These ba-
sis vectors are known as vector spherical harmonics. VectorSphericalHarmonic helps
to declare a vector spherical harmonic as a Tensor.
The normalized vector spherical harmonics are defined as follows.
∇Y i m
Ai ≡√ l
l,m l(l+1)
(2.95)
ϵ̃ij ∂ Y m
i
≡√ i l
Bl,m
l(l+1)
The √ 1
is the normalization factor. Users can choose to declare a VectorSpheri-
l(l+1)
calHarmonic with or without this factor. The Ail,m set is what we call "Gradient" vector
i
spherical harmonic. The Bl,m set is what we call "Curl" vector spherical harmonic.
160
For saving calculation Timing, I have firstly calculated it and Simplify it to a com-
pact form (as follows) to avoid duplicated time-consuming Simplify calculation on
users’ side.
p
1 m cot [θ] Ylm [θ, ϕ] + e−iϕ
(l − m) (l + m + 1)Ylm+1 [θ, ϕ]
Ail,m [θ, ϕ] = p
l (l + 1) 2 m
im csc [θ] Yl [θ, ϕ]
(2.96)
1 im csc [θ] Ylm [θ, ϕ]
i
Bl,m [θ, ϕ] = p
l (l + 1)
m+1
m −iϕ
p
− csc [θ] m cot [θ] Yl [θ, ϕ] + e (l − m) (l + m + 1)Yl [θ, ϕ]
(2.97)
Usage
Users need to provide one index as the first argument, either an upper or lower index.
Provide the value of l and m should be provided as the second and third arguments.
The fourth argument should specify the type of VectorSphericalHarmonic, which can
be either "Gradient" or "Curl". Additionally, users can provide the value of Normalize,
which can be either True or False. The default value of Normalize is True.
This is a demonstration to declare an abstract gradient VectorSphericalHarmonic
Tensor.
161
Users can also declare a concrete VectorSphericalHarmonic.
162
The index can also be a lower index:
163
OP [arg1 _ _ _, CombinedObjects_Times, arg2 _ _ _] (2.101)
Note that there is still a potential automatic sorting problem mentioned in Sec.(1.3.5).
The result may become (atB ⊗ A)klij . Users are suggested to combine them first in the
following way:
164
∂k (a (Aij + Bij )) = ∂k (aAij + aBij )
(2.105)
= ∂k (aAij ) + ∂k (aBij )
In TensoriaCalc, the processing order is a slightly different, but the results are the
same. The first equality is taken care by OperatorProductRule, as the Head is Times.
∂k (a (Aij + Bij )) =
∂k(a)
(Aij + Bij ) + a∂k (Aij + Bij ) (2.106)
Development History
In version 0 of TensoriaCalc, Yi-Zen built the code to handle eq.(2.100), not only for Par-
tialD, but also CovariantD, and other operators. Then, we realized that they shared
165
similar codes for product rule and linearity. However, whenever a new operator Func-
tion was implemented, we needed to add a new section of code for that specific Func-
tion to include the product rule and linearity. We were wondering if there was a more
efficient and compact way to declare the product rule and linearity for particular Func-
tions. So, I created the following command to make it possible. Now, with these short
pieces of code, we can declare them efficiently.
166
OperatorProductRule and OperatorDistributeOverPlus into a standard forms that
can fit any operator, similar to eq.(2.98), so that other Functions can easily be assigned
to these operator rules.
Additionally, I have made OperatorProductRule and OperatorDistributeOverPlus
public, so users can use them to declare rules for custom Functions denoted as op.
OperatorProductRule:
In second term, you can observe how we handle a zero Tensor. In this scenario, we
will let it become 0 ExpressionForm. Then Mathematica will automatically discard it.
Here is an example to demonstrate that LieDerivative has OperatorProductRule
and OperatorDistributeOverPlus:
167
Let’s do it step-by-step:
In TensoriaCalc,
168
The third term vanishes because we set that if the first argument is a scalar Expres-
sionForm, in this case, i, the output is 0.
In this section, I will explain the underlying techniques used in my work for program-
mer readers.
In the previous section (Sec.(2.0.34)), I introduce the concept of Operators’ Rules.
In this section, I will introduce more Operators’ Rules that extend the functionality of
TensorsProduct and TensorComponents. These rules allow them to handle even more
complex CombinedObjects.
First, I commented out the operator rules of TensorsProduct and TensorCompo-
nentsin TensoriaCalc. I will how TensorsProduct and TensorComponents are built
step-by-step.
Let’s start by declaring some Tensors as elements.
169
The first one is with Head Times. The second is with Head List. Here, the List
means Times, but a order preserved version. We mentioned before that when user
want to preserve the order of Tensors while TensorsProduct, they are suggested to use
List, to avoid Mathematica’s Orderless property of Times. In this example, you can
see the first output’s order has been swapped by Mathematica.
So how to deal with this complicated object? Let’s do it step-by-step.
For demonstration, I clear the operator rules of TensorsProduct. Now it does noth-
ing.
170
If Head is Times, and there is at least one Plus of TensorTensor inside it, it will ex-
pand the Times of Plus. The List one should work with OperatorDistributeOverPlus,
or there will be an infinite loop.
Next, let’s include the OperatorDistributeOverPlus.
171
Now one term is well expanded into 4 terms.
Include OperatorFactorOutScalar.
172
This is an important step. This separates different types of objects so that we can
deal with them case-by-case.
Although the output is a bit lengthy, if you focus on the TensorTensor part, you
can observe that TensoriaCalc also performs TensorsProduct to combine scalar Times
TensorTensor into a single Tensor in List version. This will be finished once we declare
OutputBecomesOneTensor.
Let’s separately deal with each part.
Include OperatorExpressionFormReturnItself.
173
This rule will do nothing and return itself if the input is an ExpressionForm.
Include OperatorThreadThroughFunction.
This rule will thread through the Function cover around a scalar Tensor. The
174
Function can be any except Plus, Times, List, Tensor, and Function’s name itself
(TensorsProduct).
Include OperatorTensorReturnItself.
This will thread through Function and operate TensorsProduct when there are Ten-
sors to be contracted.
175
Include OperatorTensorsProduct.
176
We still need to declare OutputBecomesOneTensor.
This will combine any CombinedObjects in to a single Tensor, following this pat-
tern.
177
For TensorsProduct, there is no code for itself. Everything about TensorsProduct is
defined through operator rules.
In contrast, TensorComponents has its own code. It tells TensoriaCalc how to extract
the TensorComponentswhen the Head is Tensor.
Now, since I have cleared the operator rules of TensorComponents, at this point, it
cannot deal with CombinedObjects.
178
Now we can see TensorComponents[CombinedObjects] is well done. (I won’t show
the entire output since it is lengthy.)
The way to declare the operator rules is easy and requires no additional effort!
There are still two rules haven’t been declared. OperatorRemoveSingleCompo-
nentList is to discard the List if there is only one Tensor inside it.
179
OperatorNullList is used to return 1 if there is only a Null List.
Some operators require TensorTensor, and the rank of the output may change. By de-
fault, TensoriaCalc will discard all information about this output except its TensorCom-
ponents and directly print its TensorComponents when it changes into rank-0 (scalar).
When user want to declare the output as a Tensor, they should use this pattern.
180
Add Tensor as the second argument.
181
example for CovariantHodgeDual:
182
Utilize the TensorAssumption.
2.0.38 TensorComponentsManipulation
183
The TensorComponentsManipulation Function is an operator’s rule. The declara-
tions of rules are:
Expand it.
ExpToTrig:
Declare a Tensor with exponential.
184
Apply ExpToTrig:
While TensoriaCalc detects user’s input may in a wrong form, an error Message will
pop up. This helps users to find out the problem to be fixed more easily. Now, there
are 4 internal Functions that will return Message, TestDifferentialForm, TestDiffer-
entialVector, TestQuadratic, TestMetricTensor,TestOneVector.
If users do not input the ExpressionForm in quadratic form when declaring Metric,
an error Message will pop up.
185
In this example, TestDifferentialForm is triggered during the operation of Exteri-
orD. Since the TensorComponents of βνγ are incomplete integral, Mathematica cannot
determine if this is an anti-symmetric tensor. That is the reason the error message pops
up. TensoriaCalc still proceeds to calculate its ExteriorD.
2.0.40 ElectromagneticStressEnergyTensor
Definition
αβ αµ β 1 αβ µν
T = σg F F µ − g Fµν F (2.114)
4
Usage
Users should provide a Faraday Tensor with TensorType→"Faraday" as the first argu-
mentand the Metric Tensor as the second argument. They can also provide the Op-
tionValue of MetricSignature if needed, where the value can be either "Mostly minus"
or "Mostly plus". The default value is "Mostly minus".
Let’s declare the Faraday Tensor and the Metric Tensor.
186
MetricSignature→"Mostly minus":
MetricSignature→"Mostly plus":
187
Chapter 3
Stories in Physics
I have covered all the important functionalities of TensoriaCalc. Although due to the
limitation of the thesis length, I couldn’t cover all the details. However, these Func-
tions are sufficient to handle many applications in Physics. In this chapter, I will
demonstrate how to use TensoriaCalc to tell some classic "stories" in Physics. Through-
out the process, a single story may involves multiple Functions in TensoriaCalc.
189
J (i) = ϵijk X j Pk = −iϵijk xj ∂k (3.1)
Pk = −∂k (3.3)
Px = −i∂x
Py = −i∂y (3.4)
Pz = −i∂z
In this story, I will show that these 3 rotation symmetries are shared within the
2-Sphere which is embedded in 3D flat space.
Let’s declare the 3 angular momenta in 3D Cartesian:
190
Next, project the angular momenta onto S2 .
The angular momenta are purely in angular direction so there is no radial com-
ponent of the vector loss during the projection. How do we know? Try to do a Co-
ordinateTransformation to spherical coordinates. You can observe that there is no
r-direction component.
The projection can also start from the angular momentum in (3+1)D Minkowski
spacetime, which corresponds to rotational symmetries in SO[3,1] symmetry group.
191
The rotation symmetries here are contained in SO[3,1] symmetries. The continuous
SO[3,1] symmetries, which include the rotation and boost symmetries, combined with
translation symmetries, form the Poincaré group. This group describes all the sym-
metries in local (3+1)D spacetime we live in, or it describes symmetries in the global
(3+1)D Minkowski spacetime.
The conserved quantities, angular momenta in 3 directions, are also shared in de
Sitter spacetime due to its isometric property. The symmetries in de Sitter spacetime
are discussed in Sec.(3.6.2).
Again, let’s proceed to project the angular momenta from (3+1)D Minkowski space-
time to 2-Sphere.
192
Then, declare the 2-Sphere Metric through induced Metric CoordinateTransforma-
tion.
By verifying that the LieDerivatives of the 2-Sphere Metric along these vectors are
zero, we can conclude that the 3 vectors are Killing vectors.
193
Hence, the 3 angular momenta vectors are Killing vectors on S2 .
Let’s test one of the Lie algebra relations of SO(3):
(x) (y)
J ,J = iJ (z) (3.5)
(i) (j)
J ,J = iϵijk J (k) (3.6)
Next, let’s see how the angular momentum operator acts on a wave function: f .
194
The story of SO(3) in quantum mechanics has reached a temporary conclusion.
Now, let’s multiply i back to the vectors.
I will now demonstrate the existence of 3 conserved quantities in 2-Sphere from the
perspectives of classical physics and differential geometry’s point of view. The first
step is to calculate the affinely parametrized Lagrangian in 2-Sphere.
195
∂Lg
∂ ż a
(where z = (θ, ϕ)):
∂Lg
ξ a (z) (3.7)
∂ ż a
196
We can calculate L2 ≡ Lx 2 + Ly 2 + Lz 2
The results are the angular momenta in classical mechanics. By replacing the mo-
menta with the corresponding quantum momentum operators, we can recover the pre-
viously obtained results.
197
3.2 Story: Vector calculus in spherical coordinates in or-
thonormal basis
In many introductory physics textbooks for physics students or engineer, vector cal-
culus operators such as speed, gradient, divergence, and curl are often presented in
orthonormal basis. This approach has its advantages and disadvantages. One benefit
is that it allows for easy comparison of components in different directions. However,
a drawback is that it loses its covariance property, making it challenging to perform
coordinate transformations to other coordinate systems without involving the basis
vectors. For beginners, it is not straightforward to derive these vectors in different co-
ordinate systems, and understanding how to calculate the divergence of a vector in an
orthonormal basis system can be difficult.
To illustrate this, let’s start by declaring a spherical coordinate system Metric.
198
(gradf )i = ∇i f (3.8)
(divA) = ∇i Ai (3.9)
199
The curl of vector in coordinate basis:
(3.11)
in orthonormal basis:
⃗ 22 f = □S2 f = ∇i ∇i f
∇ (3.12)
S
200
However, in textbook, the vector A are in orthonormal basis. Let’s compare the
operations involved with A.
Declare the Rules to transform the component of A from orthonormal basis into
coordinate basis.
201
Compare our result with textbooks’.
guage
202
The first set of Maxwell’s equations (Poincaré’s Lemma) is:
dF = 0 (3.13)
You can observe that the output is an Equal List with a Length of 8.
203
You can also see one of the tasks that TensorEquations performs. It will Delet-
eDuplicates in a List. A 3-form in 4D has 43 = 4 independent components, and a
Obtain ⋆F first.
⋆d ⋆ F = J (3.15)
204
and the right-hand side, the source.
Combine them:
This is equivalent to
∇µ F µν = J ν (3.16)
205
Gauss’ Law:
⃗ ·E
∇ ⃗ = ∇i Ei = ρ (3.17)
⃗ ·B
∇ ⃗ = ∇i Bi = 0 (3.18)
Faraday’s Law1 :
i
⃗ ×E
∇ ⃗ + ∂t B i = 0 (3.19)
1
The upper index is equivalent to lower one in 3D Cartesian.
206
Ampère’s Law:
i
⃗ ×B
∇ ⃗ − ∂t E i = J i (3.20)
Let’s demonstrate that the first set of Maxwell’s equations described in 4D differ-
ential geometry is equivalent to the 3D Cartesian Magnetic Gauss’ Law and Faraday’s
Law (source-free equations).
207
3.4 Story: Kerr-Newman black hole
tions
The Kerr–Newman metric describes the spacetime around a charged rotating static
black hole, with charge e and Kerr parameter a. The meaning of a is the same as that
of a Kerr black hole’s (Sec.(1.3.2)).
Now let’s declare the Kerr–Newman Metric Tensor in Boyer–Lindquist coordi-
nates.
In comparison to the Kerr black hole, the Kerr Metric and Kerr–Newman Metric
in Boyer–Lindquist coordinates share the same definition of ∆ = ρ2 . However, the
Kerr–Newman Metric has an additional term due to the presence of electric charge e
208
in natural units. By setting e = 0 in the Kerr–Newman Metric, you can obtain the Kerr
Metric.
The electromagnetic potential 1-form Aµ is defined as follows:
F = dA (3.21)
∇µ Fµν = J ν = 0 (3.22)
209
This index notation is equivalent to the following differential form language.
⋆d ⋆ F = J = 0 (3.23)
⃗ ·E
∇ ⃗ = ρ (Gauss’ Law) (3.24)
⃗ ×B
∇ ⃗ − ∂t E
⃗ = J⃗ (Ampère’s Law) (3.25)
dF = 0 (3.26)
210
The additional ⋆ is to convert a 3-form into a 1-form. You can see this result is due
to the Poincaré’s Lemma d2 = 0 from the TensorName ddA.
this Maxwell’s equation correspond to the rest 2 Maxwell’s equations in the lan-
guage of flat vector calculus:
⃗ ·B
∇ ⃗ = 0 (Magnetic Gauss’ Law) (3.27)
⃗ ×E
∇ ⃗ + ∂t B
⃗ = 0 (Faraday’s Law) (3.28)
Fab F ab = ⃗ 2 − |B|
˙ − 2 |E| ⃗ 2 (3.29)
Fab ⋆ F ab = ⃗ ·B
˙ − 4E ⃗ (3.30)
211
The electromagnetic stress energy tensor (in right-hand side of Einstein-Maxwell
equations):
αβ αµ β 1 αβ µν
T = σg F F µ − g Fµν F (3.31)
4
This is equivalent to
212
Let’s test the Einstein-Maxwell equations
Gαβ = 2T αβ (3.32)
The constant of motion implies that there is a symmetry behind the geometry of the
spacetime. For a free-falling particle in an analytic curved spacetime, its geodesics can
be determined if there are enough constants of motion.
First, let’s declare the Kerr–Newman Metric Tensor again but this time with a dif-
ferent configuration for the starting point comparing to the previous section. We Clear
the assigned value of ρ and ∆. It is best not to substitute the values too early to avoid
complicating the ExpressionForm for both users and Mathematica. Most geometrical
213
objects’s operator are id2 instead of F S (FullSimplify).We also disable trigonometric
simplification in FullSimplify.
214
Geodesic Lagrangian
1
L = gµν (xα ) ẋµ ẋν + ϵẋµ Aµ (3.33)
2
1
pµ ≡ ∂ẋµ L = ∂ẋµ gµν (xα ) ẋµ ẋν + ϵẋµ Aµ = gµν (xα ) ẋν + ϵAµ (3.34)
2
1 1 1
H = gµν (xα ) ẋµ ẋν = g µν (xα ) (p − ϵA)µ (p − ϵA)ν = − µ2 (3.35)
2 2 2
The dot on x represent derivative with respect to the proper time τ = µλ, where µ
is the rest mass of the free-falling particle, and ϵ is the charge of the particle. H is the
Hamiltonian of the particle. L is the Lagrangian
From one set of the Hamilton’s equations:
1
ṗα = −∂α H = −∂µ gµν (xα ) ẋµ ẋν
2
(3.36)
1 µ ν
=− ẋ ẋ ∂α (gµν (xα ))
2
We can see, for given α = z
215
implies
This show the absence of coordinate t in the Metric. Let’s examine all 4 coordinates
of Boyer–Lindquist coordinates.
pt ≡ −E
(3.39)
p ϕ ≡ l
216
Now we have 3 constants of motion. These are exactly the same as the constants of
motion in Schwarzschild black hole. If you are familiar with determining the geodesic
of a free-falling particle around a Schwarzschild black hole or a Reissner–Nordström
black hole, you may ask: "Can we determine the geodesic of a particle around the
Kerr–Newman black hole with these 3 constants of motion?" The answer is no. In
the case of Schwarzschild black hole and Reissner–Nordström black hole, determining
the geodesic of a particle require only 3 constants of motion, excluding the charge
of particle ϵ. However, for all 4 type of static black holes, there are 4 constants of
motion. The reason why geodesic of these 2 black holes only requires 3 constants of
motionis that the fourth constant of motion reduces to l2 on the equatorial plane. To
determine a particle moving on equatorial plane only require 3 constant of motion.
On the other hand, to determine a particle out of the equatorial plane requires four.
Fortunately, due to the spherical symmetry property of the Schwarzschild black hole
and Reissner–Nordström black hole, we can always rotate the coordinate system so
that the geodesic lies on the equatorial plane.
The forth constant of motion correspond to a hidden symmetry of
Kerr–Newman black hole which is not so obvious to find out. Now, let’s try to discover
it.
First declare the conjugate momentum Tensor in eq.(3.34).
The Hamiltonian is:
1
H = g µν (p − ϵA)µ (p − ϵA)ν (3.40)
2
Collect pr and pθ .
217
The first term is in square of pθ and the second term is in square of pr . Notice that
there is no cross term pr pθ . Which implies that we can write H in this separable form:
Since there is a separability. Hamilton-Jacobi theory is useful for solving the forth
constant of motion.
If we can find a solution of the Hamilton-Jacobi equation:
K = H (xµ , pµ = ∂µ F2 ; λ) − ∂λ F2 = 0 (3.42)
We transform into a new coordinate system with a new Hamiltonian K, using the
second type generating function F2 . The transformed new coordinate system {Qµ , Pµ }
satisfy all conserved quantities conditions in new Hamilton’s equations:
∂Pµ K = Q̇µ = 0
(3.43)
−∂Qµ K = Ṗµ = 0
pµ = ∂µ F2 (3.44)
Combine with:
218
H ≡ − 12 µ2
pt ≡ −E (3.45)
p ϕ ≡ l
We obtain
1
F2 = − µ2 λ − Et + lϕ + F2 (r) [r] + F2 (θ) [θ] (3.46)
2
Multiply 2ρ
219
At this point, the remaining work only involves algebraic calculation and does not
require the use of Functions in TensoriaCalc. Therefore, I will provide the intermediate
calculation steps in the Appendix 5.0.3. The result is:
Since it is a differential equation where the left-hand side only involves θ and the
right-hand side only involves r, both side should equal a constant K.
Substitute eq.(3.44),
pθ = ∂θ F2 = F2 ′θ (θ) (3.48)
we can obtain:
220
θ and pθ . This universality extends to the results in all axially symmetric coordinate
systems of the Kerr metric.
If you start from the Boyer–Lindquist coordinates with advanced time
{u, r, θ, φ}, where
dt = du − (r +a ) dr
2 2
∆
(3.50)
a
dϕ = dφ −
dr
∆
=K
221
and the inverse Metric:
222
2 2
µ r +a a
l = ∆
, 1, 0, ∆
2 2
n =ν r +a ∆ a
, − 2Σ , 0, 2Σ (3.52)
2Σ
K µν = Σl{µ nν} + σg r2 g µν
It’s zero.
223
Let’s calculate the corresponding conserved quantity.
K = K µν pµ pν (3.54)
µ2 = −σg g µν pµ pν (3.55)
224
This shows that the conserved quantity generated by the Killing tensor is really
Carter constant.
225
I skip the intermediate steps. The result is still the same:
226
3.5 Story: Linearized gravity
The Minkowski spacetime describes the local symmetry of spacetime or a true vacuum
even without any coordinate singularity. However, General Relativity is developed to
describe how matter affects spacetime. The right-hand side of Einstein equation can’t
be always be vacuum ,since it represents the presence of matter and energy. Testing
General Relativity in extreme cases, such as the spacetime around a black hole or cap-
turing gravitational waves from distant binary systems, is challenging. A practical way
for experimental physicist to test General Relativity is within the solar system, where
the gravitational field is weak. In this regime, the effects on spacetime are not too far
from flat spacetime, and the speeds of matter are significantly lower compared to the
227
speed of light. To describe such a spacetime, the first step is to add a small perturbation
to the Minkowski Metric.
p
∥h∥2,2 ≡ Tr [hT h] ≪ ∥η∥2,2 = 2 (3.57)
1
∂α ∂{ν hαµ} − ∂ 2 hµν − ∂µ ∂ν h − ηµν ∂α ∂β hαβ + ηµν ∂ 2 h
Gµν = (3.58)
2
1
h̄µν ≡ hµν − ηµν h (3.60)
2
1
∂α ∂{ν h̄αµ} − ∂ 2 h̄µν − ηµν ∂α ∂β h̄αβ
Gµν = (3.61)
2
∂α h̄µα = 0 (3.62)
228
1
Gµν = − ∂ 2 h̄µν (3.63)
2
1 h i
G [x, x′ ] = δ t − t′ − |⃗x − x⃗′ | (3.65)
4π|⃗x − x⃗′ |
Z Tµν ′ ⃗′
t − t − |⃗x − x |
h̄µν = −4GN d3 x⃗′ (3.66)
|⃗x − x⃗′ |
in far-zone limit.
if we do a multiple expansion,
1 1 x′k xk
+ 3 + O r−5
= (3.67)
|⃗x − x⃗′ | r r
= − 4GrN M
h̄00
h̄0i = − 2G N ⃗
L × ⃗
x (3.68)
r3
i
h̄ij
=0
Z
M= d x ρ x⃗′
3 ⃗′
(3.69)
229
Z i
i 3 ⃗′
⃗
L = d x x × p⃗ x⃗′
′
(3.70)
pk x⃗′ ≡ T k0 = ρv k x⃗′
GN M
Φ=− (3.71)
r
h̄00 = 4Φ (3.72)
h00 = −h00 = 2Φ
1
mΦ ∼ mv 2 (3.74)
2
That’s implies
Φ ∼ v2 ≪ 1 (3.75)
230
The angular momentum of object in solar system is not large enough to observe its
effect in Newton’s time and even not easy to observe without conducting dedicated
experiments now.
Let’s assume
⃗ =0
L (3.76)
When we declare any small quantity in TensoriaCalc, we often add an ϵ, for the
convenience of Series expansion.
The Einstein Tensor:
231
pi = ρv i ≪ ρ, for given i (3.78)
3.5.2 Gravitoelectromagnetism
⃗ again.
Let’s consider the effect of angular momentum L
GN ⃗
Ai = − L × ⃗
x (3.80)
2r3 i
2GN ⃗
h̄0i = − L × ⃗
x = 4Ai (3.81)
r3 i
declare h̄0µ
232
where Aµ is the gravitoelectromagnetic 4-potential
Aµ = (Φ, Ai ) (3.83)
∂ µ h̄0µ = 4∂ µ Aµ = 0 (3.84)
233
We can now write down the gravitational version of E and B field
⃗ ⃗ ⃗
Eg = −∇Φ − ∂tA
(3.85)
B⃗g = ∇
⃗ ×A
⃗ (3.86)
calculate h0i
234
We can check if the inverse one is correct:
Due to the absence of t in Φ, the Lorentz gauge now become Coulomb gauge:
∂i Ai = 0 (3.88)
235
The source is assumed to be static:
⃗ 2 Aµ = 4πGN j µ
∇ (3.89)
236
Declare E⃗g , B⃗g , ⃗z, ⃗z˙ and ⃗z¨ in terms of Φ, A,
⃗ ⃗ż
237
Now we obtain the gravitational version of Lorentz Force (divided by mass m):
F⃗g ¨ m ⃗
=
˙ ⃗z = z˙ × B
Eg + 4⃗ ⃗g (3.90)
m m
F⃗EM q ⃗
= ⃗z¨ = E + ⃗z˙ × B
⃗ (3.91)
m m
In the comparison of 2 versions of Lorentz force, it can be noticed that they are
almost the same except for a factor difference.
238
The E⃗g represents the Newton’s gravitational field. The mass can be interpreted
as the gravitational version of charge, denoted as m=q
˙ g . For particles with non-zero
mass, qg is always positive. If we consider two particles with positive m = qg , they
will attract each other. On the other hand, if we consider two particles with positive
charge q, they will repel each other. Although the sign of two version of E field con-
tributes to the force is the same, the way charges produce these field is opposite to each
F⃗
other. The term Bg
m
= 4⃗z˙ × B⃗g is a new prediction that deviates from Newton’s gravity.
This makes gravitoelectromagnetism part of the first post-Newtonian (1PN) correction
in General Relativity. The source to generate gravitomagnetic force should also acts
opposite from electromagneticone. Why? In fact, the first discovery of gravitoelec-
tromagnetism was not from linearized gravity. The history can dates back to 1893.
However, it was not easy to detect experimentally, and its significance was recognized
again with the "Gravity Probe B" experiment conducted from 2004 to 2005.
The starting point is a thought experiment. Consider 2 charges with the same mass
m and the same charge q, separated by a distance r. In the frame of reference A, these
charges are absolutely stationary. By tuning the ratio of m and q appropriately, we can
ensure that the gravitational attractive force cancels out the electric repulsive force.
kq 2
2
⃗ GN m (3.92)
Ftotal = − 2 r̂ + 2 r̂ = 0
r r
√ √
if m : q = k: GN .
Now, let’s consider a boost to another frame B with a direction perpendicular to
r̂. In frame B, the distance r between the two charges remains the same since we
are boosting perpendicularly. However, in frame B, the two particles now move in
the same direction and generate the same directional current j. This will provide an
additional magnetic attractive force.
kq 2
GN m2 (3.93)
F⃗total = − 2 r̂ + 2 r̂ − FBEM r̂ = −FBEM r̂ ̸= 0
r r
How is it possible that for a finite boost (which can be much smaller than the speed
239
of light), the two particles remain stationary in frame A but get closer and closer in
frame B?
The solution lies in the existence of a gravitational version of the magnetic repul-
sive force that cancels out the electromagneticversion of the magnetic attraction force.
These forces should act in opposite directions.
Oliver Heaviside was the first to discover and publish the gravitoelectromagnetism
theory. He was also the one who re-wrote electromagnetic 20 equations of Maxwell’s
equations, originally formulated by Maxwell in quaternion form, into the modern set
of four Maxwell’s equations in vector calculus. Then, he also pubished the gravitoelec-
tromagnetism’s version of it in 1983, before the discovery of General Relativity in 1915
by Einstein.
⃗ ·E
∇ ⃗ EM = ρEM ⇔ ∇
⃗ ·E
⃗ g = −4πGN ρg
⃗ ×B
∇ ⃗ EM − ∂t E
⃗ EM = J⃗EM ⇔ ∇
⃗ ×B
⃗ g − ∂t E
⃗ g = −4πGN J⃗g
(3.94)
⃗ ·B
∇ ⃗ EM = 0 ⇔ ∇
⃗ ·B
⃗g = 0
⃗ ×E
∇ ⃗ EM + ∂t B
⃗ EM = 0 ⇔ ∇
⃗ ×E
⃗ g + ∂t B
⃗g = 0
240
3.6 Story: de Sitter spacetime
Before we delve into the de Sitter spacetime, let’s first discuss the FLRW metric. The
FLRW metric describes the large-scale structure of the universe, assuming that matter
in space and space itself are homogeneous ans isotropic. By introducing a scale factor
a [t] that depends on time and multiplying it with spatial line element, it describes the
dynamic of space itself, either expanding or shrinking through time t.
A FLRW in general form with spatial curvature k is given by:
!
2 2 2 (dr)2
(dτ ) = (dt) − a [t] 2
+ r2 (dΩS2 )2 (3.95)
1 − kr
by consider matter in the large-scale structure of the universe act as a prefect fluid,
we can solve the non-vacuum Einstein field equations with cosmological constant Λ.
241
The prefect fluid stress–energy tensor in rest frame U is given by:
T µν = (ρ + p) U µ U ν − pg µν
(3.98)
U µ = (1, 0, 0, 0)
Solve the Einstein field equations with one up one down indices.
The 00 component of the Einstein field equations is the first equation of Friedmann
equations.
Define the Hubble parameter H.
242
2
2 ȧ 8πGN k Λ
H [t] ≡ = ρ [t] − 2 + (3.99)
a 3 a 3
which can be contributed by the energy density ρ in large-scale, the radius of cur-
vature of space k and the cosmological constant Λ.
In eq.(3.99), I emphasized the time dependence of Hubble constant. The reason
is that the energy density ρ contributed by matter and photons can be changed (de-
crease) during the expansion of the universe, vice versa during universe shrinking.
However,the term "constant" in the famous Hubble constant refers to the fact that its
rate of change is not very rapid. The value of Hubble constant at the present time
(t = t0 ) is denoted as H0 .
Solve ȧ in the first Friedmann equation.
ä 4πGN Λ
=− (ρ + 3p) + (3.100)
a 3 3
Kµν = a2 (gµν + σg Uµ Uν )
(3.101)
Uµ = (1, 0, 0, 0)
243
The Killing tensor equation is True.
r
Λ (3.102)
H=
3
244
Declare the de Sitter Metric Tensor:
− ln [−Hη]
t= (3.105)
H
245
The metric is now in the form:
1
where Ω = −Hη
1 gµ[α gβ]ν
0 = Cµναβ ≡ Rµναβ − Rα[µ gν]β − Rβ[µ gν]α + R (3.107)
d−2 (d − 2) (d − 1)
From this analysis, we conclude that the Riemann tensor can only be constructed
using the tensor products of the Ricci tensor, Ricci scalar, and the metric in conformally
flat spacetime. Due to the symmetries of Riemann tensor, Ricci tensor and metric, there
should be an anti-symmetrization on the second and third indices.
Furthermore, considering the trace of the first and third indices of the Weyl tensor,
we find that the Ricci tensor should be constructed solely from the metric and Ricci
scalar.
Therefore, we can deduce that the Riemann tensor can only be constructed from the
Ricci scalar and the metric. There is only one combination that satisfies these require-
ments:
R
Rµναβ = gµ[α gβ]ν (3.108)
d (d − 1)
246
The factor involving dimension d requires further derivation.
The Ricci tensor:
R
Rµν = gµν (3.109)
d
1
The Ricci scalar in this case (Ω = −Hη
):
2dΛ 6dH 2
R=− =− (3.110)
d−2 d−2
(3.111)
247
de Sitter spacetime is maximally symmetric
The Minkowski metric is maximally symmetric, and since de Sitter spacetime is a slice
of 5-dimensional Minkowski spacetime, it also possesses maximally symmetry. In a
d(d+1)
4-dimensional maximally symmetric spacetime, there can be 2
= 10 symmetries,
each corresponding to a Killing vector.
Now, let’s show the 10 Killing equations in de Sitter spacetime.
Given the isotropy of the de Sitter spacetime, there are 3 spatial translation symme-
tries and 3 rotational symmetries.
248
ν
K(i) ∂ν = xi T µ ∂µ − H σ̄∂i
(3.112)
1 2 1
σ̄ ≡ η − ⃗x2 = ηµν xµ xν
2 2
T µ ∂µ = −Hxµ ∂µ (3.113)
e−Ht
η= (3.114)
−H
249
Now becomes
Since the conformally flat Riemann tensor is composed of the metric tensors and
the Ricci scalar (which is a constant in this case), the LieDerivatives of Riemann along
the 10 Killing vectors are also zero.
If we calculate T 2 , we can observe that this is actually a time-like vector, but only in
a finite spatial region |⃗x2 | < η 2 .
250
Let’s see T µ as an example:
∇Y i m
Ai ≡√ l
l,m l(l+1)
(3.115)
ϵ̃ij ∂ Y m
i
≡√ i l
Bl,m
l(l+1)
I show a few examples with the definition of inner product for vector field U i and
Wi
Z
⟨U |W ⟩ ≡ d2 Ωx̂ Ū i Wi (3.116)
S2
Now declare the A and B vectors set and the inner product, with VectorSpherical-
Harmonic.
251
′
Let’s take a example of Am m
l |Bl′ with l = 1, m = 0, l′ = 2, m′ = 1:
Test l = 1, l′ = 1, m = −1 ∼ 1, m′ = −1 ∼ 1
′
Am m
l |Al′ for l = 1, l′ = 1, m = −1 ∼ 1, m′ = −1 ∼ 1:
′
Blm |Blm′ for l = 1, l′ = 1, m = −1 ∼ 1, m′ = −1 ∼ 1:
252
3.7.3 coordinate systems
In code.(1.19), we show that all 2D space or spacetime are conformally flat. There are
also a few coordinate systems of 2-Sphere which are conformally flat.
(x, y):
2
2 2 2 2
(dl) = (dx) + (dy)
1 + χ2
p
χ ≡ x2 + y 2 (3.117)
θ θ
(x, y) ≡ tan cos [ϕ] , tan sin [ϕ]
2 2
(θ, ϕ) to (x, y):
253
(χ, ϕ):
2
2 2
(dχ)2 + χ2 (dϕ)2
(dl) = (3.118)
1 + χ2
(z, z̄):
2
2 2
(dl) = dzdz̄
1 + z z̄
z ≡ x + iy (3.119)
z z̄ = χ2
254
(z, z̄) to (θ, ϕ)
J± = Jx ± iJy (3.120)
255
First declare basic objects:
J+ Ylm p
= (l − m) (l + m + 1), (up to a phase) (3.121)
Ylm+1
J− Ylm p
= (l + m) (l − m + 1), (up to a phase) (3.122)
Ylm−1
256
Utilize this recursion relation:
Pl m+1 [cos [θ]] + 2m cot [θ]−1 Pl m [cos [θ]] + (l − m + 1) (l + m) Pl m−1 [cos [θ]] (3.123)
Firstly verify:
257
−i∂ϕ Yl m
=m (3.124)
Yl m
Another eigenvalue:
−□Yl m
= l (l + 1) (3.125)
Yl m
This time we also need to use the recursion relation eq.(3.123). Replace all m into
m + 1 in that equation.
258
h i
⃗ =0
Since ∂ϕ , ∇
Test with l = 1, m = 0:
Test with l = 0 ∼ 2, m = −2 ∼ 2:
h i
⃗ on vector spherical harmonic, we can obtain
From analysis of commutator □, ∇
the eigenvalue:
Test with l = 1, m = 0:
259
Test with l = 0 ∼ 2, m = −2 ∼ 2:
To plot ∇Yl m , the first task is to declare it with additional r direction with 0 value and
coordinate transform into 3D Cartesian.
260
∇Y2 2 :
261
Now let’s plot ⋆dYl m
⋆dY2 1 :
262
∇Yl m should perpendicular with ⋆dYl −m at every point. The proof is in Sec.(4.0.8).
Real part of ∇Y2 1 ⊥ ⋆dY2 −1 (blue for the former, red for the later):
263
Imaginary part of ∇Y2 1 ⊥ ⋆dY2 −1 (blue for the former, red for the later):
Maxwell’s Equations in 4D
First I will demonstrate the validity of the first equality. Consider a conformally flat
spacetime, specifically the FLRW spacetime.
264
Let’s declare the Faraday Tensor with upper and lower indices.
265
Sum them up and declare as a single Tensor.
266
If you extract any one equation from eq.(3.128), at this point, the result is not True.
Maxwell’s equations in curved spacetime need to be used.
Change Equals into Rules. Add a set of Rules to account for the common factor of
a minus sign.
267
Also include a set of Maxwell’s equations that apply partial derivatives on both
sides.
Now I will demonstrate that in the far-zone limit, eq.(3.128) reduces to:
eq.(3.129) is True.
268
3.9 Story: More example on CoordinateTransformation
3.9.1 Monopole
rs
gµν = ηµν + 2Φδµν = ηµν − δµν (3.130)
r
(3.131)
269
In this section, I will show that the non-rotating linearized gravity is equivalent to
the leading order of Schwarzschild metric in weak field limit.
Let’s declare a Schwarzschild Metric in Schwarzschild coordinates.
rs 2
rs −1 2 2
2
dτ = 1 − ′ (dt) − 1 − ′ (dr′ ) − r′ (dΩS2 )2 (3.132)
r r
By re-scaling radius r′ ,
270
′
rs 2
r = 1+ r (3.134)
4r
rs 2
1−
rs 4
2
dτ = 4r
rs (dt)2 − 1 + (d⃗x)2 (3.135)
1+ 4r
4r
In the small mass limit, we can Series expand rs to the first order, which will become
the leading order since rs 2 ∂r2s ≪ rs ∂rs
271
Compare with the linearized approach in code.(3.131).
where
rs r 3
H=
r 4 + a2 z 2
(3.138)
rx + ay ry − ax z
lµ = 1, 2 , ,
r + a2 r 2 + a2 r
Coordinate transformation rules from Kerr-Schild to Kerr coordinates t̄, r, θ, ϕ̄ :
x = r sin [θ] r cos ϕ̄ − a sin ϕ̄
(3.139)
y = r sin [θ] r sin ϕ̄ + a cos ϕ̄
z = r cos [θ]
272
This CoordinateTransformation is equivalent to:
√
2 + a2 sin [θ] cos ϕ̄ + arctan a
x = r r
√
2 + a2 sin [θ] sin ϕ̄ + arctan a (3.140)
y = r r
z = r cos [θ]
273
From Kerr coordinates to Boyer–Lindquist coordinates with retarded time (v, r, θ, ϕ):
dt̄
= dv − dr
(3.142)
a
dϕ̄ = dϕ +
dr
∆[r]
The quantity ∆ [r] is defined in eq.(1.27). Since the metric is independent of r̄ and
ϕ̄, we don’t need to complete the integral in eq.(3.142). However, since it is integrable,
users can also choose to perform a CoordinateTransformation in that way if they pre-
fer.
From Boyer–Lindquist coordinates with retarded time to Boyer–Lindquist coordi-
nates (t, r, θ, ϕ):
r 2 + a2
dv = dt + dr (3.143)
∆ [r]
274
Again, the metric is ν-independent.
Declare a Boyer–Lindquist coordinates metric in ExpressionForm manually. This
should be equal to the result we obtain.
3.9.3 r + SD−1
" D−2
#
Y
gij = Diag 1, r2 , r2 sin [θ1 ]2 , r2 sin [θ1 ]2 sin [θ2 ]2 , . . . , r2 sin [θi ]2 (3.144)
i=1
If you let D = 3, you obtain 3D spherical coordinates (r, θ, ϕ). You can observe that
θD−1 is ϕ and θD−2 is θ. Notice that for any D, θD−1 is always absent in metric.
Let’s consider 4D, r + S3 , with coordinates (r, Θ, θ, ϕ)
275
gij = Diag 1, r2 , r2 sin [Θ]2 , r2 sin [Θ]2 sin [θ]2 (3.145)
x
= r sin [Θ] sin [θ] cos [ϕ]
y
= r sin [Θ] sin [θ] sin [ϕ]
(3.146)
z = r sin [Θ] cos [θ]
w
= r cos [Θ]
Now, let’s truncate the metric and project out the radius r. This gives us a 3-Sphere
with radius R.
276
Set R = 1, we obtain unit 3-Sphere.
1 gµ[α gβ]ν
Cµναβ ≡ Rµναβ − Rα[µ gν]β − Rβ[µ gν]α + R (3.147)
d−2 (d − 2) (d − 1)
While d = 2, it blows up, and we have proved that all 2D spacetimes/spaces are
conformally flat. However, when d = 3, spacetimes/spaces could not be conformally
flat. In this section, I will show that Weyl tensors for any 3D spacetimes/spaces are
277
always zero. As a result, the conformally flatness of 3D spacetimes/spaces is taken
care by the Cotton tensor, which I won’t discuss in this thesis.
Declare a general 3D metric first.
278
The fourth term, gµ[α gβ]ν
279
Chapter 4
Exercises in Schutz
In this chapter, I will provide the solution of the exercises or reproduce the content in
this book by Schutz[11].
Q: Show that r̂i = (cos [θ] , sin [θ]) and ϕ̂i = (− sin [θ] , cos [θ]) do not form a good coordi-
nates.
A: Transform into polar coordinates first will be clearer.
h i
Show that r̂, ϕ̂ ̸= 0
281
4.0.2 Frobenius’ theorem
Frobenius’ theorem states, tangent vector fields to two integral curves commute if and
only if they can be integrated to form a 2D coordinate system.
In page 82 of Schutz, he provided a counter example:
Spiral curve and vector along it can not form a coordinate set.
Let’s declare the spiral curve along z-direction and z vector field. Obtain their
LieBracket.
282
4.0.3 Exercise 3.7
Q: Show that in S2 , the angular momentum square operator can be written in this form.
A:
283
This is equivalent to negative Laplacian on 2-Sphere.
Show that β the potential form of α. We test for the case that α is a 2-form.
Z 1
1 n
dt tp−1 αij...k tx1 , tx2 , . . . , txn xi
βj...k x , . . . , x = (4.2)
0
Z 1
βν (x, y, z) = dt tαµν (tx, ty, tz) xi (4.3)
0
284
Put minus sign inside the incomplete integral
Check:
285
Z 1
d p
[t αij...k tx1 , tx2 , . . . , txn ]
(dβ)ij...k =
0 dt (4.4)
= αij...k x1 , x2 , . . . , xn
In this case:
Z 1
d 2
(dβ)µν = [t αµν (tx, ty, tz)]
0 dt (4.5)
= αµν (x, y, z)
In the equation (4.69) of Schutz, it states exterior derivative commute with Lie deriva-
tive. The ω in this equation is a p-form.
286
4.0.6 Exercise 4.10
p
Q: In coordinates with ϵ̃ = |g|ϵ
Verify
1 p
divω̃ ξ¯ = p ∂i |g|ξ i (4.7)
|g|
divω̃ ξ¯ = ∇i ξ i (4.8)
1 p
divω̃ ξ¯ ϵ̃ = p ∂i |g|ξ i ϵ̃
(4.9)
|g|
divω̃ ξ¯ ϵ̃ = ∇i ξ i ϵ̃ = d̃ ϵ̃ ξ¯ (4.10)
divω̃ ξ¯ ≡ ∇i ξ i (4.11)
1 p
d̃ ϵ̃ ξ¯ = p ∂i |g|ξ i ϵ̃
(4.12)
|g|
287
Show it:
Q: Convert equation of continuity in fluid dynamic in 3D flat space ϵ̃ = d̃x ∧ d̃y ∧ d̃z:
∂ρ
+ div ρV̄ = 0 (4.13)
∂t
∂
+ £V̄ (ρϵ̃) = 0 (4.14)
∂t
∂
A: Multiply ϵ̃ to eq.(4.13). Since ∂t
ϵ̃ = 0, we obtain:
∂
(ρϵ̃) = −div ρV̄ ϵ̃ (4.15)
∂t
(4.16)
£V̄ (ρϵ̃) = div ρV̄ ϵ̃
288
Declare the left-hand side and right-hand side of eq.(4.16).
A:
289
4.0.9 Exercise 5.6
A:
First declare Hamiltonian H through the phase space volume form ω̃ and a Hamil-
tonian vector field Ū .
(4.18)
{f, g} ≡ ω̃ X̄f , X̄g
290
Q: The Poisson brackets satisfy the Jacobi identity.
A:
Q: Verify
(4.20)
X̄f , X̄g = −X̄{f,g}
A: left-hand side:
291
right-hand side:
292
Chapter 5
Appendix
293
5.0.2 Appendix B: FullForm of a Faraday Tensor declared by Non-
MetricTensor
K=0 (5.1)
Which is:
2
(a2 cos2 (θ) + r2 )
K=
(a2 + e2 + r(r − rs)) (a2 − (a2 + r2 ) csc2 (θ))2
4 2 2 2
2 2
3
2 (5.2)
csc (θ) a En − al + Enr − a + e + r(r − rs) aEn csc(θ) − l csc (θ)
294
2
a2 − a2 + r2 csc2 (θ)
2
= a2 − csc2 (θ) + a2 − r2 csc2 (θ)
2
= a2 1 − csc2 (θ) − r2 csc2 (θ) (5.3)
2
= −a2 cot2 (θ) − r2 csc2 (θ)
2
= csc4 (θ) a2 cos2 (θ) + r2
2
(a2 cos2 (θ) + r2 )
(a2 + e2 + r(r − rs)) (a2 − (a2 + r2 ) csc2 (θ))2
2 2
csc4 (θ) a2 En − al + Enr2 − a2 + e2 + r(r − rs) aEn csc(θ) − l csc3 (θ)
2 ((( 2 2
2
((
(a( cos
(( (θ) + r )
= (
2 2 (( 2
(((
(a2 + e2 + r(r − rs)) csc4 (θ)(
(a( cos
(( (θ) + r2 )
(5.4)
2 2
csc4 (θ) a2 En − al + Enr2 − a2 + e2 + r(r − rs) aEn csc(θ) − l csc3 (θ)
2 (( 2
4
csc 2
(θ) (a En − al + Enr2 ) (a 2
+ e
( 2(((((
+ r(r − rs)) (aEn csc(θ) − l csc3 (θ))
−
= ( ( (
4
(
(a2 + e2 + r(r − rs))
csc (θ)
(a2 + e2(
+(r(r
(( ((
− rs)) csc4 (θ)
((((
2
(a2 En − al + Enr2 )
= 2 2
− (l csc(θ) − aEn sin(θ))2
(a + e + r(r − rs))
2
(a2 En − al + Enr2 )
2 2
− (l csc(θ) − aEn sin(θ))2
(a + e + r(r − rs)) (5.5)
− F2r′ (r)2 a2 + e2 + r(r − rs) + µ2 − a2 cos2 (θ) + r2 − F2θ′ (θ)2 = 0
295
5.0.4 Appendix D: orthogonality of SphericalHarmonicY
296
GeodesicLagrangians, GeodesicHamiltonianDynamics, SphericalHarmonicYTensor,
VectorSphericalHarmonic, ElectromagneticStressEnergyTensor, MHDSystem, MHD-
Scalar, MHD3Form, MHDPlasmaCurrent, MHDMaxwell, MHDMaxwellCurrent, MH-
DRank2P, MHDEquations, MHDEnergyMomentumShearStress, MHDPlasmaEner-
gyDensity, MHDMetric, MHDLagrangian
Common:
TensorComponents→_(List of Lists|SymmetrizedArray|SparseArray)
Indices→___
TensorName→_
CoordinateSystem→_List
StartIndex→_Integer
TensorType→_String
TooltipDisplay→_
TooltipStyle→_
TensorOperator→_Function
TensorAssumption→_List
TensorSymmetry→_
Metric related:
ChristoffelComponents→_List of Lists
RiemannComponents→_List of Lists
RicciComponents→_List of Lists
RicciScalarInvariant→_ExpressionForm
MetricDeterminant→_ExpressionForm
FlatMetric→_List
OrthonormalFrameField→_List of Lists
InverseOrthonormalFrameField→_List of Lists
297
OrthonormalFrameFieldOperator→_Function
CheckOrthonormalFrameField→_(True|False)
298
Options[NonMetricTensor]={StartIndex→0, TooltipDisplay→Null,
TensorType→Null, TooltipStyle→{ }, TensorOperator→Simplify,
TensorAssumption→{ }};
Options[MHDSystem]={MHDOperator→Simplify, MetricSignature→"Mostly mi-
nus"};
Options[GeodesicSystem]={AffineParameter→Unique[Symbol],
NonAffineParameter→Unique[Symbol]};
Options[GeodesicLagrangians]={AffineParameter→Unique[Symbol],
NonAffineParameter→Unique[Symbol]};
Options[CoordinateTransformation]={
CoordinateTransformationOperator→Simplify,
StartIndex→Unique[Symbol], Indices→{ },
TensorName→Unique[Symbol], TooltipStyle→{ }, TooltipDisplay→Null};
Options[LieDerivative]={LieDerivativeOperator→Simplify};
Options[LieBracket]={LieDerivativeOperator→Simplify,
LieBracketOperator→Simplify, TooltipStyle→{ },
TooltipDisplay→Null, Indices→Null};
Options[SphericalHarmonicYTensor]={TooltipStyle→{},
TooltipDisplay→Null};
Options[VectorSphericalHarmonic]={Normalize→True,
TooltipStyle→{}, TooltipDisplay→Null};
Options[SymmetrizeIndices]={SymmetrizeIndicesOperator→#1&};
Options[AntiSymmetrizeIndices]={AntiSymmetrizeIndicesOperator→#1&};
Options[TensorIsZero]={TensorIsZeroOperator→Simplify};
Options[TensorDivision]={TensorDivisionOperator→Simplify};
Options[PotentialForm]={TensorName→"β"};
Options[ToTensorComponents]={CoordinateSystem→{}};
Options[ElectromagneticStressEnergyTensor]={MetricSignature→"Mostly minus"};
299
Bibliography
[1] Yi-Zen Chu. “Analytical Methods in Physics”. In: (2018). arXiv: 1701 .00776v2
[math-ph] .
[2] Yi-Zen Chu, Wei-Hao Chen, and Vaidehi Varma. TensoriaCalc. URL:
http://www.stargazing.net/yizen/Tensoria.html .
[3] Wolfram Research, Inc. Mathematica, Version 12.1.1.0). Champaign, IL, 2020. URL:
https://www.wolfram.com/mathematica .
[4] Yi-Zen Chu and Vitaly Vanchurin. “Ideal MHD(-Einstein) Solutions Obey-
ing The Force-Free Condition”. In: (2016). arXiv: 1605.08786 [gr-qc]. URL:
http://www.stargazing.net/yizen/MHD.html .
[5] Brandon Carter. “Global Structure of the Kerr Family of Gravitational Fields”. In:
Phys. Rev. 174 (5 1968), pp. 1559–1571. DOI: 10 . 1103 / PhysRev.174.1559.URL:
https://doi.org/10.1103/physrevlett.106.221101
[7] C.W. F. Everitt et al. “Gravity Probe B: Final Results of a Space Experiment to Test
General Relativity”. In: Physical Review Letters 106.22 (2011). DOI: 10.1103/phys-
revlett.106.221101 . URL: https://doi.org/10.1103%2Fphysrevlett.106.221101.
301
[9] B Vetö. “Gravity Probe B experiment and gravitomagnetism”. In: European
Journal of Physics 31.5 (2010), p. 1123. DOI: 10.1088/0143-0807/31/5/014. URL:
https://dx.doi.org/10.1088/0143-0807/31/5/014.
302