a field theory motivated approach to computer algebra

Cadabra tutorials

The tutorials listed 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. These notebooks all require the new 2.x version of the software and will not work with the old version 1.x. If you have a nice notebook that you think would help others to learn Cadabra, please get in touch.

Absolute beginners

This notebook explains how to enter expressions, how to do simple substitutions on them, how to use wildcards. It also explains how the new Python functionality works. If you have never used Cadabra before, start here.

Beginners tutorial: read online download notebook

For a bit more advanced material, try one of the following tutorials.

Tensor monomials: read online download notebook

If you have used old versions of Cadabra but are new to series 2.x, give the following notebook a shot.

Tutorial for 1.x users: read online download notebook

Writing packages for Cadabra

One of the key reasons for the rewrite of Cadabra was to make it much easier for users to contribute small bits of functionality. As all of its internals are available via Python, it becomes much easier to write small add-on packages, just like you can for other computer algebra systems.

A more step-by-step tutorial for writing packages will follow; for the time being here are some smaller tutorials describing a number of Cadabra programming concepts.

Convergence of operations: read online download notebook

Actions, equations of motion, variational derivatives

Fierz transformations: read online download notebook

Quantum mechanics, groups and algebras

Dirac gamma matrix algebra is very simple with Cadabra, and it can handle them in arbitrary dimensions.

Gamma matrix algebra: read online download notebook

An frequently asked question is how to do commutator algebra with Cadabra. The following notebook shows how this works by verifying the invariance of the two quadratic Casimirs of the Poincaré algebra. It shows how to make good use of post_process to simplify expressions automatically.

Poincaré algebra Casimirs: read online download notebook

Because of fact that you can use natural LaTeX notation and because Cadabra understand non-commuting objects, many tedious operator algebra computations in quantum mechanics become relatively simple. Here is an example from string theory, in which we verify that certain states satisfy the quantum string constraints.

String states: read online download notebook

Abstract general relativity

Cadabra was originally written in order to facilitate computations in extensions of general relativity. The following example shows how to prove a particular polynomial identity cubic in the Weyl tensor, by virtue of its multi-term symmetries.

Bianchi identities: read online download notebook

Component computations

From version 2.x you can do abstract as well as component computations with Cadabra. The logic is very simple and based on a few key ideas rooted in Cadabra's substitution engine. Examples of varying difficulty are available below. The first one computes Christoffel symbols and related for the Schwarzschild metric; definitely a frequently requested feature...

Schwarzschild spacetime: read online download notebook

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.

Kaluza-Klein: read online download notebook


Cadabra's notebook now displays graphics from a variety of Python sources; see the notebook below for some basic examples.

Plotting tutorial: read online download notebook

SymPy users

Cadabra relies on SymPy for all scalar computer algebra, that is, for all 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.

SymPy inside Cadabra: read online download notebook

Using Cadabra from IPython/Jupyter

Because most Cadabra functionality is now accessible as a Python module, you can easily use Cadabra from IPython/Jupyter notebooks with a Python kernel. This notebook shows some of the absolute basics. Note that this is different from using IPython/Jupyter notebooks inside the Cadabra GUI.

Cadabra inside Jupyter: read online download notebook
Copyright © 2001-2017 Kasper Peeters