Abstract
Abstract
This notebook extends the Relativity Toolkit (v1.11.0) to basic Abelian scalar gauge theory. We implement a generalized covariant derivative operator that simultaneously processes spacetime geometry and internal phase geometry. We demonstrate this implementation through four automated computational proofs:
◼
Metric Compatibility: the Levi-Civita connection uniquely nulls the gradient of the metric ()
∇g=0
◼
U(1)
◼
Field Strength Invariance: the electromagnetic tensor is invariant under local gauge transformations.
F
μν
◼
Charged Vector Field Covariance: the covariance of a generic charged vector field transforms covariantly under simultaneous spacetime coordinate changes and internal phase rotations.
α
V
U(1)
Finally, we apply the updated engine to re-derive the Riemann curvature tensor from the torsion-free commutator of covariant derivatives.
Initialize the Relativity Toolkit
Initialize the Relativity Toolkit
Optional: Quit for a Fresh Kernel
Optional: Quit for a Fresh Kernel
◼
Note, if you call Quit in a notebook, evaluation may hang. If you want to “Evaluate Notebook,” mark the following two cells “Evaluatable” in the CellProperty menu, call Quit and FrontEndTokenExecute once each, then comment out the cells, or mark them unevaluatable again. Alternatively, you can quit the kernel via the Evaluation menu (last item). At that point, you can “Evaluate Notebook” in a clean environment, or evaluate cells individually.
->
Quit[];
In[]:=
FrontEndTokenExecute["DeleteGeneratedCells"]
Download the Code
Download the Code
In[]:=
RTbranch="v1.11.0";RTbase="https://raw.githubusercontent.com/rebcabin/RelativityToolkit/"<>RTbranch<>"/";RTbust="?t="<>ToString[Round[AbsoluteTime[]]];(*Forcefreshdownload*)RTrules=RTbase<>"RelativityToolkit.wl"<>RTbust;RTtests=RTbase<>"RelativityToolkit_RegressionTests.wl"<>RTbust;RTviz=RTbase<>"RelativityToolkit_VisualShowcase.wl"<>RTbust;Get[RTrules];
»
Relativity Toolkit version :1.11.0
»
Relativity Connection Symbol :Γ
Optional: See all Tests and Results from Prior Works
Optional: See all Tests and Results from Prior Works
Make any of the following cells evaluatable if you wish. They’re unevaluatable by default to keep this notebook trim.
In[]:=
Get[RTtests];
In[]:=
Get[RTviz](*nosemicolon,onpurpose*)
In[]:=
Get[RTbase<>"covariant_derivative.wl"]
In[]:=
Get[RTbase<>"law_of_gamma.wl"]
In[]:=
Get[RTbase<>"connections_to_christoffels.wl"]
Get[RTbase<>"schwarzschild_from_scratch.wl"]
Introduction
Introduction
In physics, choosing a coordinate system or a phase reference is “setting a gauge.” Changing this choice—whether transforming spacetime coordinates or shifting the phase of a field—often introduces inhomogeneous terms when taking partial derivatives.
Connection fields arise to maintain covariance of the physics under such transformations. In general relativity, the Levi-Civita connection (Christoffel symbols) corrects for the curvature of spacetime coordinates. In electrodynamics, the vector potential acts as the connection, correcting for local variations in the phase reference.
μ
A
While apparent forces (like centrifugal and Coriolis) can be eliminated globally by choosing a specific inertial gauge, fundamental forces (like tidal gravity and electromagnetism) arise from the intrinsic curvature of these connections and cannot be globally gauged away.
Covariance and Internal Gauge
Covariance and Internal Gauge
To see how a connection restores covariance, consider a scalar matter field ψ subjected to a local phase change :
U(1)
Λ()
μ
x
ψ
qΛ
(
1
)where is a constant charge. The ordinary partial derivative produces an inhomogeneous term via the product and rules:
q
∂
μ
ψ
qΛ
∂
μ
∂
μ
(
2
)The inhomogeneous term breaks covariance. To restore it, introduce a gauge covariant derivative. As with general relativity, add a correction to the partial derivative
q(Λ)ψ
∂
μ
D
μ
∂
μ
A
μ
(
3
)Requiring the connection to transform as
A
μ
A
μ
∂
μ
(
4
)gives us an operator that transforms covariantly with gauge, just as transforms covariantly with coordinates in relativity:
D
μ
∇
μ
D
μ
ψ
∂
μ
ψ
A
μ
ψ
qΛ
∂
μ
∂
μ
A
μ
∂
μ
qΛ
qΛ
∂
μ
A
μ
qΛ
D
μ
(
5
)Internal Gauge Spaces in the Calculus
Internal Gauge Spaces in the Calculus
In general relativity, we take covariant derivatives of tensors inhabiting the tangent spaces of a curved manifold. The connection Γ accounts for the twisting of basis vectors.
In gauge theories like electrodynamics, the connections operate on internal spaces (such as the U(1) phase) attached, extrinsically to the spacetime itself, to each point in spacetime. The objective of this notebook is to update the calculus to compute derivatives for objects that possess both spacetime indices and internal gauge charges simultaneously.
Covariant Derivatives, Revisited
Covariant Derivatives, Revisited
In GR, the canonical example is the covariant derivative of an arbitrary contravariant vector with respect geometrical coordinates:
μ
A
In[]:=
With[{example=HoldForm[CD[A[[μ]],x[[ν]]]]},Echo[TensorForm@@example,example""]];
»
+(A)
A
μ
;ν
A
μ
,ν
λ
μ
Γ
νλ
The connection coefficients Γ account for twisting and turning of basis vectors in the tangent spaces as the vector is parallel-transported geometrically. In GR, this twisting and turning causes geodesics to converge or diverge, thus causing tidal forces. Twisting and turning also drives single geodesics, giving rise to orbits, gravitational lensing, gravitational waves, and so on.
μ
A
◼
Emphasis: Geodesic deviation is indistinguishable from tidal force. It’s not an apparent force: its numerical values may depend on gauge choice, but we can’t get rid of it globally by gauge choice.
The derivative above transforms like a tensor, ensuring physics is locally Lorentz invariant. This invariance invites Noether’s theorem again, implying a conserved quantity. In GR, this conserved quantity is spin current, from symmetries of non-coordinate bases or tetrads (see the Appendix).
A New CD
A New CD
The following new overload of CD computes covariant derivatives for Abelian (commutative) gauges like scalar phase. We’ll get to non-Abelian gauges like and in future notebooks.
SO(3)
SU(2)
Gauge Covariant Derivative
Gauge Covariant Derivative
Inputs
Inputs
1
.expr: The field being differentiated, scalar or tensor
2
.var: the coordinate function, e.g., x[[μ]], the differentiation variable
3
.q: the coupling constant or “charge”
4
.A: the gauge-field connection symbol. Γ is kept implicitly as the spacetime connection for all theories.
In[]:=
CD[expr_,var_,q_,A_]:=Module[{gravitationalPart,gaugeCorrection,idx},(*GetcoordinatecovariantderivativeviaexistingCDoverloads.*)(*∂+Christoffels(ifexprisatensor)*)(*Ifexprisascalar,justreturn∂.*)gravitationalPart=CD[expr,var];(*Extracttheindexfromthedifferentiationvariable.*)(*varissomex[[μ]];weneedμ*)idx=var[[1,1]];(*Constructthegaugecorrection,e.g.,-iq*expr*)(*Note:ThisAhasaDOWN(Covariant)indexmatchingthederivative*)gaugeCorrection=-I*q*A[[idx]]*expr;(*Add*)gravitationalPart+gaugeCorrection];
A
μ
Electrodynamics Demos
Electrodynamics Demos
Covariance of the Covariant Derivative
Covariance of the Covariant Derivative
Above, we subjected ψ to gauge transformation manually. Automat that calculation:
In[]:=
(cde=CD[ψ,x[[μ]],q,A])
Out[]=
-qψ(A)+
μ
ψ
,μ
Starting with the gauge transformations
ψ
iqΛ
A
μ
A
μ
∂
μ
In[]:=
gaugeTransforms=ψ->ψ,A[[μ_]]:>A[[μ]]+Partials[Λ,x[[μ]]]
qΛ
Out[]=
ψψ,AA+
qΛ
μ_
μ
Λ
,μ
prove that the covariant derivative
D
μ
∂
μ
A
μ
transforms exactly as does ψ
D
μ
ψ
iqΛ
D
μ
Need one rule for the charge constant. Everything else is already in the toolkit’s differentiationRules:
In[]:=
constantRules={Partials[q,x[[μ_]]]:>0}
Out[]=
{0}
q
,μ_
In[]:=
transformedCde=(cde/.gaugeTransforms//.differentiationRules/.constantRules)//Expand//Simplify
Out[]=
qΛ
μ
ψ
,μ
In[]:=
transformedCde===cde
qΛ
Out[]=
True
QED ■
Invariance of the Field-Strength Tensor
Invariance of the Field-Strength Tensor
The field-strength tensor, , aka Faraday, is defined as follows
F
μν
In[]:=
F[μ,ν]=Partials[A[[ν]],x[[μ]]]-Partials[A[[μ]],x[[ν]]]
Out[]=
-+
A
μ
,ν
A
ν
,μ
Now, subject it to the gauge transform:
See that it doesn’t change by invoking the toolkit’s ExpandDerivatives:
QED ■
Charged Vector Field Covariance Demo
Charged Vector Field Covariance Demo
Proceed just as above:
QED ■
Geometrical GR Demos
Geometrical GR Demos
Geometrical Covariant Derivative of a Scalar Function Λ
Geometrical Covariant Derivative of a Scalar Function Λ
equal to its ordinary partial derivative, rendered in comma notation
equal to its partial derivative plus the correction proportional to the geometrical connection Γ
now we get two corrections, one for each index
ditto, with a sign change
Geometrical Covariant Derivative of the Covariant Metric
Geometrical Covariant Derivative of the Covariant Metric
Two negative signs, one for each covariant index
◼
Christoffel symbols were derived in Covariant Derivatives and Connections in the Calculus, assuming both torsion freedom (symmetry in lower two indices of Γ), and metric compatibility.
We do not develop this case further in this notebook.
For pedagogy, clear the definitions loaded from the toolkit:
Start with the covariant derivative of the metric, cdg, from above
Fetch the Levi-Civita connection via a new ruleLeviCivita, added to Relativity Toolkit v1.9.0:
In cdg, replace Γ with its definition via this rule, then Expand to expose terms to further processing
Now consider the following new metricDifferentiationRules in the toolkit:
They include
QED ■
Riemann Revisited
Riemann Revisited
Here is a concise derivation of the Fundamental Theorem of Riemannian Geometry, shorter than the derivation in our earlier notebooks
Simplification Pipeline
QED ■
Appendix: Spin Connection as Gravitational Gauge
Appendix: Spin Connection as Gravitational Gauge
To formulate gravitation as a strict gauge theory functionally equivalent to the Standard Model forces, one must identify the conserved currents corresponding to local gauge symmetries. The definitive literature demonstrates how this is achieved:
◼
Friedrich W. Hehl et al., General Relativity with Spin and Torsion: Foundations and Prospects (Rev. Mod. Phys. 48, 393, 1976)
which shows that:
◼
Invariance under general transformations (diffeomorphisms), implies conservation of the energy-momentum tensor.
◼
Invariance under local Lorentz transformations implies conservation of the spin angular momentum tensor (the spin current).
◼
Standard Einstein GR with vanishing torsion, which we assumed in this series of notebooks, collapses the two symmetries and hides the independent spin current.
Some other references are
◼
Sean Carroll, Spacetime and Geometry: An Introduction to General Relativity
◼
Also see Hehl above, Equation 3.8 and Sections III.B and III.C. In other references, this may be called Belinfante-Rosenfeld symmetrization.
◼
T. W. B. Kibble, Lorentz Invariance and the Gravitational Field (J. Math. Phys. 2, 212, 1961)
◼
Foundational paper deriving gravitation as the gauge theory of the Poincaré group, i.e., translations + Lorentz
Kibble shows that (1) gauging translations in Poincaré yields the tetrad field, defining the metric and conserving energy-momentum, and that (2) gauging the Lorentz boost+rotation subgroup yields the spin connection, permitting transformation of spinors, otherwise impossible.
Conclusion
Conclusion
References
References
1
.Beckman, Brian. From the steam age to quantum fields: a unified approach via UD tensorial calculus. Wolfram Community post.
2
.3
.4
.5
.6
.7
.Beckman, Brian. Schwarzschild Metric from Scratch via Compilation. Wolfram Community post (to appear).
8
.9
.10
.[MTW] Misner, Charles W.; Thorne, Kip S.; Wheeler, John Archibald. Gravitation. Princeton University Press, 2017.
11
.Sean Carroll, Spacetime and Geometry: An Introduction to General Relativity. Cambridge University Press, 2019.
12
.Friedrich W. Hehl et al., General Relativity with Spin and Torsion: Foundations and Prospects (Rev. Mod. Phys. 48, 393, 1976)
13
.T. W. B. Kibble, Lorentz Invariance and the Gravitational Field (J. Math. Phys. 2, 212, 1961)
14
.Sciama, D. W., On the analogy between charge and spin in general relativity. In: Recent Developments in General Relativity, p. 415. Pergamon, New York, 1962.
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Gauge theory in
by Brian Beckman
Wolfram Community, STAFF PICKS, February 23, 2026
https://community.wolfram.com/groups/-/m/t/3643786
by Brian Beckman
Wolfram Community, STAFF PICKS, February 23, 2026
https://community.wolfram.com/groups/-/m/t/3643786