xCPS is a Mathematica package that implements the Covariant Phase Space (CPS) formalism for field theories within the xAct tensor algebra suite.
For a given a Lagrangian, xCPS can compute:
-
Equations of Motion (EOM)
-
Symplectic currents
-
Symmetry verification for arbitrary field transformations
-
Noether charges associated with symmetries
The package handles generic Lagrangians of the form
Two powerful tools for general tensor calculations might be useful for the general public:
-
Divergence detection: Determine whether an expression can be written as
$\nabla_a V^a$ -
Potential extraction: Extract the "potential" tensor
$T^{bc}$ from expressions of the form$\nabla_a T^{bc}$
xCPS is included by default in xAct 1.3 and later versions. For prior versions, please refer to Section A.1 of xCPS_doc.nb for manual installation instructions.
A complete tutorial with theoretical background and detailed examples is included in the documentation notebook xCPS_doc.nb which includes, among other things, the following examples:
-
Scalar field theories (Klein-Gordon and generic Lagrangians that depend on the scalar field and its derivatives)
-
Electromagnetism (Maxwell theory)
-
General Relativity and
$f(R)$ gravity -
Boundary terms and corner contributions
If xCPS contributes to your research, please cite:
J. Margalef-Bentabol, "xCPS: an xAct package for covariant phase space, Noether symmetries and Noether charges." arXiv preprint (forthcoming). GitHub: juanmargalef/xCPS
J. Margalef-Bentabol and E. J. S. Villaseñor, "Geometric formulation of the covariant phase space methods with boundaries," Phys. Rev. D 103, 025011 (2021). arXiv:2008.01842
(* Load the package *)
<< xAct`xCPS`
$PrePrint = ScreenDollarIndices;
(* Setup manifold and metric *)
DefManifold[M, 4, {a, b, c, d, e, f, i}];
DefMetric[-1, g[-a, -b], LCDer];
(*********************************)
(* Example 1: General Relativity *)
(*********************************)
(* Einstein-Hilbert Lagrangian *)
LGR = RicciScalarLCDer[] Sqrt[-Determinant[g][]];
(* Equations of Motion → Einstein equations *)
EOM[g, LCDer][LGR] // ContractMetric // Simplification
(* Symplectic Current *)
SymplecticCurrent[g, LCDer][LGR] // ContractMetric // Simplification
(******************************************)
(* Example 2: Generic Scalar Field Theory *)
(******************************************)
(* Define scalar field and its covariant derivative (as an independent tensor) *)
DefTensor[phi[], M, PrintAs -> "\[Phi]"];
Implode[LCDer[-a]@phi[]]
(* Generic scalar function depending on φ and ∇φ *)
DefScalarFunction[LScalar1, {phi,LCDerphi}, PrintAs -> "\!\(\*SubscriptBox[\(L\), \(1\)]\)"];
(* Generic scalar Lagrangian *)
L = Sqrt[-Detg[]] LScalar1[phi,LCDerphi];
(* First variation with respect to φ *)
FirstVariation[phi, LCDer][L]
(* Symplectic Current *)
SymplecticCurrent[phi, LCDer][L]For questions, bug reports, or feature requests:
-
GitHub Issues: Open an issue for bug reports or feature requests
-
xAct Community: Join discussions on the xAct Google Group
-
Send me an email (info in the xCPS_doc.nb file)
This project is licensed under the GNU General Public License v2.0. See the LICENSE file for full details.
Keywords: Covariant Phase Space, Field Theory, General Relativity, Symplectic Geometry, Noether Charges, xAct, Mathematica, Tensor Calculus