Cadabra and Python algorithms in General Relativity and Cosmology II Gravitational Waves

2025-04-27 0 0 530.36KB 32 页 10玖币
侵权投诉
Cadabra and Python algorithms in General Relativity and Cosmology II:
Gravitational Waves
Oscar Castillo-Felisolaa, Dominic T. Priceb, Mattia Scomparinc,
aDepartamento de F´ısica and Centro Cient´ıfico y Tecnol´ogico de Valpara´ıso (CCTVal),
Universidad T´ecnica Federico Santa Mar´ıa
Casilla 110-V, Valpara´ıso, Chile
bDepartment of Mathematical Sciences, Durham University,
South Road, Durham DH1 3LE, United Kingdom
cVia del Grano 33,
Mogliano Veneto, Italy
Abstract
Computer Algebra Systems (CASs) like Cadabra Software play a prominent role in a wide range of research activities
in physics and related fields. We show how Cadabra language is easily implemented in the well established Python
programming framework, gaining excellent flexibility and customization to address the issue of tensor perturbations
in General Relativity. We obtain a performing algorithm to decompose tensorial quantities up to any perturbative
order of the metric. The features of our code are tested by discussing some concrete computational issues in research
activities related to first/higher-order gravitational waves.
Keywords: Computer Algebra System, Cadabra, Gravitation, Classical Field theory, Gravitational Waves,
Perturbative Field Theory, Python, Cosmology, General Relativity.
1. Introduction
This article is the continuation of our previous work [1] describing the use of Cadabra algorithms within the
framework of General Relativity and Cosmology. Cadabra is an open-source Computer Algebra System (CAS)
designed for field-theory problems and specialized for both abstract and component computations. The Cadabra
language is Python-oriented and works closely with the Python library for symbolic calculations SymPy, but uses its
own Python class for storing expressions and uses L
A
T
E
X formatting for inputs and outputs.
In the last few years many introductory works about Cadabra [25] have appeared. Among all the applications
described in this wide bibliography include problems dealing with field theory, dierential equations and symbolic
matrix algebra. Nevertheless, only a small number of them discuss the currently available spectrum of physical
applications which development of Cadabra algorithms supported by Python coding allows. Thanks to its many
language constructs and wide ranging standard library, Python is a very complete and flexible programming language
employed in many high-performance scientific back-end and front-end applications. In addition, Python oers a wide
range of external libraries such as NumPy,SymPy,SciPy and Matplotlib which make it a powerful and up-to-date
ecosystem for dealing with mathematical, statistical, biological, human and social sciences. From this perspective,
an in-depth investigation into how Cadabra algorithms could be consolidated and enhanced with Python is strongly
motivated.
Of course there are many other CASs available and which are used in research on a daily basis and which contain
specialist packages and functionality for dealing with a wide range of problems, however one of the main motivations
for the writing of this paper is to display how even without dedicated functionality already available in the language
Corresponding author
Email addresses: o.castillo.felisola@protonmail.com (Oscar Castillo-Felisola), dominicprice@outlook.com (Dominic T. Price),
mattia.scompa@gmail.com (Mattia Scomparin)
Preprint submitted to Computer Physics Communications October 4, 2022
arXiv:2210.00007v1 [gr-qc] 30 Sep 2022
it is not dicult to create very powerful and generic programs by using Python with Cadabra. In particular, we
wish to draw to the attention of the reader the following constructs which dier from other CASs and which are used
throughout this paper when constructing algorithms and performing other manipulations:
Expressions in Cadabra are mutable which provides powerful ways to interact with them, especially by com-
bining this with Python iterator constructions which allows expressions to be visited and modified using for
loops and other intuitive constructs.
By allowing expressions to be queried for dierent property types, ‘smart’ algorithms can be written which
respond dierently to dierent types of input. Properties can also be dynamically attached to new symbols
which allows the construction of functions which programmatically define new sets of objects.
Python has many useful and performant inbuilt containers which have rich interfaces, and also provides im-
plementations of many more useful container types such as defaultdict in the collections library. These
make storing and accessing related expressions very easy and natural which improves the organisation of the
code.
As Cadabra uses a L
A
T
E
Xformat for inputting and outputting expressions, expressions can be created or ma-
nipulated by using Python’s string and regex functions if a feature is not implemented in Cadabra. While this
is not always an optimal solution, it is one of the great strengths of Python which makes it such a productive
language that it is almost always possible to achieve some end.
In order to showcase as many of these features as possible, we have chosen to take a more in-depth look at tensor
perturbation theory in General Relativity which is by no means the only field topic whose analysis is assisted by
using the tools Python and Cadabra oer; but as it is a very well studied topic with a lot of literature dedicated to
it we hope this makes the paper accessible to a large audience. Tensor perturbations, also known as Gravitational
Waves, are disturbances in the curvature of the spacetime metric and represent one of the most definitive theoretical
and phenomenological signatures of General Relativity as a standard theory of gravitation. Recently, gravitational
waves have attracted a wide interest thanks to the detections made by the LIGO and Virgo interferometers sourced by
compact binary coalescences [612].
Having taken gravitational waves as the most eective case study to examine, the main purpose of this work is
therefore to put forth the first structured insight on the approach, design, and implementation of hybrid Cadabra and
Python functions/commands and methods of defining a new coding environment within Cadabra. In particular, we
use our multi-annual experience gained in both Cadabra and Python to provide a programming vision of the entire
life-cycle of such a development process, which consists of five phases as displayed in Table 1.
Step Description Ref. Secs.
Theory Analysis, modelling, formalism, reference objects Sec. 2
Ref. libraries development Supporting functions & environments, coding core paradigms Sec. 3
Main algorithms development Code development, optimization, new user-oriented commands Sec. 4
Notebooks Explore the new environment, upgrade Cadabra, communicate Sec. 5,6,7
Testing & Discussion Timing, performance, perspectives & generalizations Sec. 8
Table 1: Steps of the development process with related reference sections of this article.
When talking about gravitational waves, methods related to Perturbation Theory are essential and Section 2is
dedicated to providing a general overview of tensorial perturbative expansions in General Relativity. In particular,
the spacetime metric representing the gravitational field is treated as a series of successive, increasingly small tensor
perturbations around a background, where an N-th order gravitational wave solution is obtained by (i) truncating the
series by keeping only the first Nterms, and (ii) forcing consistency with perturbed General Relativity equations and
gauge conditions.
Operating tensorial expansions within Cadabra naturally leads to us introducing in Section 3a set of new hybrid
Cadabra and Python functions (see Table 2) collected inside a library which we call perturbations.cnb. These
functions are united by the goal of defining the basic perturbative elements we will deal with. They fix the core
2
assumptions of our algorithms including the formalism, e.g. how perturbations will be represented, and the new user-
oriented interface commands, e.g. how to invoke the new perturbative objects obtained in the code. This step is deeply
influenced by the Pythonic aesthetic in favour of writing functions that are perfect for the immediate use-case, and
which can be developed and tested separately before finally being put together.
Section 4presents our first result, an algorithm called perturb() able to deal with tensor perturbations for every
order of a generic tensor defined in terms of the spacetime metric. The following example illustrates the use of
our machinery to perturb the Cristoel connection Γµντ, stored in the ch variable, up to the second order of metric
tensor:
connection = perturb(ch,[gLow,gUpp],'pert',2)
where gLow and gUpp hold information about the metric tensor.
The code returns the Python dictionary connection which contains useful representations of the perturbation
such as a symbolic decomposition in the 'sym'key:
Γµντ =(Γ)
µντ +(1)
Γµντ +(2)
Γµντ
and an array of the perturbative orders in the 'ord'key, so in this case connection['ord'][2] is
(2)
Γµντ =1
2τ
(2)
hνµ+1
2ν
(2)
hτµ1
2µ(2)
hντ 1
2
(1)
hµστ
(1)
hνσ 1
2
(1)
hµσν
(1)
hτσ +1
2
(1)
hµσσ
(1)
hντ
More information about the data structure can be found in Table 4.
The algorithm is very performative and has been developed to be both flexible and intuitive, goals which the use
of the timing analysis tools introduced in our fist paper [1] has helped us to achieve. The results of this analysis are
reported in Section 8. The perturb() function takes full consideration of the symmetries and other fundamental
properties of the perturbed object. This section also presents several examples of computations, focusing on the
dependence of timings on properties of perturbed expressions.
The suite composed by the perturbations.cnb library and the perturb() algorithm defines a new Cadabra
perturbative environment that must be explored and used alongside normal Cadabra notebooks. As toy models to
provide a staging ground, Section 5and Section 6are completely dedicated to first order gravitational waves, obtained
in the so-called harmonic gauge, with the respective sections calculating (i) the wave-equation which describes the
propagation of first order gravitational waves, and (ii) the related wave-relations. In the last Section 7we apply our
machinery to reproduce some results obtained in Ref. [13], where a complete analytical analysis of vacuum high-order
gravitational waves solutions is given. Hence, we provide a computational counterpart of such analysis, highlighting
the natural predisposition of Cadabra Software and the newly developed perturbative environment to treat the heavy
and onerous nature of high-order tensor calculations. In particular, we discuss how to obtain the numerical coecients
of higher-order gravitational wave solutions.
A final discussion is drawn in Section 8where we analyse the timing, performance, and perspectives of our
new perturbative environment, highlighting the full consistency of our results with the predicted exponential timing
behaviour derived from the number of perturbed terms.
The experience gained through all phases of the development process, from designing to release, took us into a
leading role in the design of Cadabra and Python algorithms. During the development process we needed to identify
the algorithms’ bottlenecks and boost their performance to satisfy notebooks’ demands about practical manipulating,
debugging, and programming issues not covered by Cadabra itself.
With reference to the process followed, we believe that there are some important takeaways of programming in
Cadabra:
Developing Cadabra algorithms supported by Python oers superior algorithm solutions. The well-established
coding vision coming from Python suggests a more structured way of thinking about algorithms and provides a
powerful factory of tools that can inspire many improvements of Cadabra.
Cadabra architecture is completely predisposed to work with Python data-structures.Cadabra expression are
one of the main paradigms of Cadabras architecture and they are Python objects that can be treated as data
inside more complex algorithm structures to be processed.
3
Cadabra algorithms can be debugged and tested in a very smart way. We exhibit in the first part [1] for the first
time some new approaches on Cadabra code debugging. A new approach to test timing performance has been
introduced within the new timing.cnb library.
The development of new computing environments induces an improvement of Cadabra’s core. When working
with our new perturbative environment, we needed to introduce new functions into Cadabras core library,
exhibiting a wide range of possible improvements for Cadabra. The fact that the introduction of a new environ-
ment has induced an improvement of the standard Cadabra environment shows that Cadabra has new undis-
covered domains of improvements that approaches like ours can discover. From this perspective, Cadabras
code and community mutually support and inspire progress with each other.
Finally, it is important to notice that the results developed in this paper can be easily customized with respect to
any physical model to which a perturbative approach must be applied, as is the case with statistical mechanics [14],
radiative transfer [15], quantum mechanics [16], particle physics [17], fluid mechanics [18], chemistry [19], and many
other contexts. Our algorithms are built in such a way that one can cut-and-paste expressions straight from this paper
into a Cadabra notebook and customize the content according to specific needs. The main notebooks of this work
will be completely available on the ocial GitLab repository.1
Since new functions have been introduced in the Cadabra core libraries, our code requires a minimum of version
2.3.8 of Cadabra software, and as it is heavily based on the cooperation of Cadabra with Python it is completely
incompatible with the old 1.x versions.
2. Overview of Tensor Perturbations in General Relativity
There is a vast, practically limitless, choice of works aimed to introducing the basics of General Relativity and
its implications in Cosmology (see for example Refs. [20,21]). In our analysis, we will follow the notations and
conventions defined in the first part of our previous work [1].
As a starting point, let us consider spacetimes aected by small perturbations hµν about Minkowski spacetime ηµν.
More precisely, the metric tensor gµν can be written
gµν (0)
gµν +hµν =ηµν +hµν 'ηµν +(1)
hµν.(1)
Note that the linear approximation has been employed and higher order terms than first have been neglected. Con-
sequently, as gαµgµβ =δβ
α, the contravariant metric can be written as gµν =ηµν hµν, with hµν =ηµαηνβhαβ. As a
consequence, it is clear that the indices of all first-order tensorial quantities will be raised or lowered using the flat
Minkowski metric. Adopting such perturbative decompositions, it is simple to exhibit that the first order Einstein’s
equations
(1)
Rµν =κ(1)
Sµν,(2)
can be rewritten as 1
2νρ
(1)
hµρ1
2ρρ
(1)
hµν 1
2µν
(1)
hρρ+1
2µρ(1)
hνρ =κ(1)
Sµν,(3)
with κthe constant gravitational coupling and (1)
Sµν the first-order term of the source tensor, S, defined as
Sµν =Tµν 1
2gµνT.
This equation does not possess unique solutions since, given a solution, it will always be possible to identify one
another solution performing a coordinate transformation of the form
x0α=xα+ξα(xα),(4)
1See https://gitlab.com/cdbgr/cadabra-gravity-II.
4
where βξαis of the same order of hµν. This property is known as gauge invariance. The redundancy can be removed
by fixing a specific coordinate system. For our purposes, it is a good choice to work in the so-called harmonic gauge,
defined by the condition
0= Γσ=gµνΓσµν,(5)
which perturbed up to first order and inserted in Eq. (3) in vacuum yields the first-order gravitational wave equation
αα
(1)
hµν =0.(6)
Without loss of generality, Eq. (6) is solved by tensor plane-wave parametrization solutions that can be parametrized
as follows: (1)
hµν =eµν exp ikλxλ+¯
eµν exp ikλxλ,(7)
with
kλkλ=0 and eλνkλ1
2eµµkν=0.(8)
Above, we have introduced the spacetime coordinate xµ, the wave-number kλand the symmetric polarization tensor
eµν with its complex conjugate ¯
eµν. Eqs. (8) are commonly known as the first-order wave relations.
The entire framework described in the present section can be extended to higher-order perturbations. As we will
see in the following sections, the covariant metric can be decomposed as
gµν
¯n
X
n=0
(n)
gµν =
¯n
X
n=0
fnη, (1)
h,· · · ,(n)
h.(9)
In our notation, (n)
Ystands for the n-th perturbative order associated to the tensor Y, with ¯nthe higher perturbative
order we are interested in.
In such higher-order context the methods described for first-order perturbations and concept of gauge invariance
hold. With reference to the main equations, Eqs. (5) and (6) become
0=(n)
Γση, (1)
h,· · · ,(n)
hand 0 =(n)
Rµν η, (1)
h,· · · ,(n)
hwith n∈ {0, ..., ¯n}.(10)
In particular, wave solutions propagating in vacuum satisfying Eqs. (10) admit a very general parametrization
(2n)
hµν = Φnn(2n)
aηµσασν+izωc1(2n)
bηµσβσνoexp i2nkρxρ+c.c., (11)
with, among all the objects introduced, Φeµνeνµand ασν,βσνconstant matrices. The numerical coecients
n(2n)
a,(2n)
bofor n=1,2,..., (12)
characterize each perturbative order solution. Parametrization (11) means that the odd-order solutions do not con-
tribute to the metric perturbation since one can see that all odd-order terms in the metric perturbation vanish identi-
cally. This feature may be related to the physical properties of the gravitational interaction [13].
3. Libraries
The code which accompanies this paper is organised into a number of modules, each of which contains functions
and computations corresponding to a dierent section. See Figure 1for the rooting. This section will introduce
the content in the libraries directory, which contains general routines which are used throughout the remainder of
the paper: (i) header.cnb setting up a common environment of property and object definitions, (ii) perturbations.cnb
which defines general perturbative algorithms which are the building blocks of the discussion.
The remaining files in the algorithms directory are the notebooks which accompany the other sections in this
paper; sec4_TensorPerturbationsGR.cnb defines an algorithm able to deal with tensor perturbations up to every
order of a generic tensor defined in terms of the metric tensor (section 4), sec5_FirstOrderEqGW.cnb to get first-
order gravitational waves equation (section 5), sec6_FirstOrderGWrel.cnb to get first-order gravitational wave
relations (section 6), and sec7_HighOrderGWsol.cnb to study higher-order gravitational wave solutions (section 7).
5
摘要:

CadabraandPythonalgorithmsinGeneralRelativityandCosmologyII:GravitationalWavesOscarCastillo-Felisolaa,DominicT.Priceb,MattiaScomparinc,aDepartamentodeF´sicaandCentroCient´coyTecnol´ogicodeValpara´so(CCTVal),UniversidadT´ecnicaFedericoSantaMar´aCasilla110-V,Valpara´so,ChilebDepartmentofMathema...

展开>> 收起<<
Cadabra and Python algorithms in General Relativity and Cosmology II Gravitational Waves.pdf

共32页,预览5页

还剩页未读, 继续阅读

声明:本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。玖贝云文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知玖贝云文库,我们立即给予删除!
分类:图书资源 价格:10玖币 属性:32 页 大小:530.36KB 格式:PDF 时间:2025-04-27

开通VIP享超值会员特权

  • 多端同步记录
  • 高速下载文档
  • 免费文档工具
  • 分享文档赚钱
  • 每日登录抽奖
  • 优质衍生服务
/ 32
客服
关注