# Cadabra tutorials

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. 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.

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

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

## 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.

## Actions, equations of motion, variational derivatives

## Quantum mechanics, groups and algebras

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

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.

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.

## 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.

## 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...

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.

## Plotting

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

## 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.

## 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.