Beginners tutorial
Learn how to enter expressions, how to do simple substitutions, how to use wildcards and how to tie everything together using Python.
{% extends "layout.html" %} {% block title %}Cadabra: Tutorials{% endblock %} {% block description %}Tutorials for Cadabra, from first steps to tensor polynomials, general relativity, spinors, components and numerics, all made from Cadabra notebooks.{% endblock %} {% block section %}learn{% endblock %} {% block breadcrumb %} {% endblock %} {% block main %}
The tutorials listed below are meant to illustrate Cadabra concepts at the level of simple examples; for research-level applications of Cadabra please see the papers section.
The pages linked below are produced from actual Cadabra notebooks. Instead of reading them on-line, you can also download the notebooks and play with them inside Cadabra. If you have a nice notebook that you think would help others to learn Cadabra, please get in touch.
For new users of Cadabra, to get you started with the input format and basic symbolic manipulations.
Learn how to enter expressions, how to do simple substitutions, how to use wildcards and how to tie everything together using Python.
Manipulate tensor polynomials, canonicalise expressions using index symmetries and dealing with multi-term symmetries.
Use SymPy calculus functions such as series expansions on Cadabra expressions, and plot the results.
Compute equations of motion from the action of a scalar field using variational derivatives and integration by parts.
Use Fierz transformations to verify an identity for Majorana spinors in eleven dimensions, taken from hep-th/9803209.
About using operators and other non-commuting objects, together with their commutation relations.
Handle Dirac gamma matrix algebra in arbitrary dimensions.
Verify the invariance of the two quadratic Casimirs of the Poincaré algebra and learn about automatic expression post-processing.
Obtain the conditions that determine the physical states of the bosonic string by imposing the Virasoro constraints.
Cadabra was originally written in order to facilitate computations in extensions of general relativity including supergravity.
Use meld in a post_process function to simplify expressions with multi-term symmetries, such as the Bianchi identities, automatically at every step.
You can also do computations with abstract differential forms and the exterior derivative, as in the example below.
The following example shows how to prove a particular polynomial identity cubic in the Weyl tensor, by virtue of its multi-term symmetries.
Showing invariance of the $N=1$, $d=4$ supergravity action under supersymmetry variations.
Learn how to do abstract tensor computations and then compute explicit components, for a number of examples from general relativity.
Simple example of computing the curvature tensor and scalar for a 2-sphere, to illustrate the main Cadabra ingredients.
Compute Christoffel symbols, Riemann and Ricci tensor and the Kretschmann scalar for the Schwarzschild metric.
Derive the Friedmann equations for a homogeneous and isotropic universe, starting from the Friedmann-Robertson-Walker metric.
Compute Christoffel symbols, Riemann and Ricci tensor and the Kretschmann scalar for the Kerr metric, and learn how to speed up the simplification of components.
Compute curvature invariants of a rotating, charged black hole, using $y=\cos\theta$ as a coordinate so that all metric components are rational functions.
Somewhat related to component computations is the concept of splitting a vector bundle into two parts, like you do in Kaluza-Klein models. The following notebook is also discussed in the original Cadabra paper hep-th/0701238.
Cadabra's notebook now displays graphics from a variety of Python sources; see the notebook below for some basic examples.
The ndsolve algorithm can be used to solve differential equations numerically. You feed it (a system of) differential equations and initial conditions, and get back one or more anonymous (interpolating) functions.
Learn how to do more complicated things, by combining Cadabra algorithms into your own Python programs and storing these in modules.
How to apply operators on expressions until they no longer change.
Only relevant if you can use neither the Cadabra kernel nor the Jupyter extension, and need to work with Cadabra's expression and property objects directly from plain Python code.
Cadabra relies on SymPy for a lot of scalar computer algebra, that is, for algebra on expressions which do not involve indices.
Here is a simple notebook to illustrate the basic concepts. This may also be a useful read if you want to use the Cadabra notebook interface just to work with SymPy.