Cadabra
a field-theory motivated approach to computer algebra

Cadabra in Jupyter

General

By virtue of the Cadabra kernel for Jupyter, it is possible to use Cadabra from a Jupyter notebook. This allows you to use Cadabra notation in a familiar environment, and make use of e.g. Jupyter widgets for visualisation, or other things which are currently not possible in the Cadabra notebook interface.

[screenshot]

The Cadabra Cloud service makes use of Jupyter to provide you with an on-line service to run Cadabra; send an email to cloud@cadabra.science if you want to get access.


Installation

If you do a standard build from source, or if you obtained Cadabra from a binary package (at least version 2.3.1.15), you will get the Cadabra Jupyter kernel automatically. You should be able to start the Jupyter notebook as usual with

jupyter notebook

The 'New' button in the top-right of the screen should then give you the option of creating a new notebook with a 'Cadabra2' kernel. If that fails, and the error messages produced by Jupyter indicate that it cannot find the Cadabra kernel, you may need to adjust your PYTHONPATH.

Differences with Cadabra's own notebook

When you use Cadabra within Jupyter, most things will work as in Cadabra's own notebook interface. The main thing to keep in mind is that Jupyter notebooks (with extension .ipynb) and Cadabra notebooks (with extension .cnb) are not the same file format. You can read notebooks created in Jupyter into the Cadabra cadabra2-gtk client, and you can (as of version 2.3.3) export Cadabra notebooks as Jupyter notebooks (or convert them using the cadabra2ipynb command-line utility), but it is good to keep this in mind.

You can, however, make use of Cadabra packages inside the Jupyter notebook, so you can still do import something where something.cnb is a Cadabra notebook.

Copyright © 2001-2021 Kasper Peeters
Questions? info@cadabra.science