{"id":13830950,"url":"https://github.com/kpeeters/cadabra2","last_synced_at":"2025-05-16T10:06:26.549Z","repository":{"id":38325762,"uuid":"45484302","full_name":"kpeeters/cadabra2","owner":"kpeeters","description":"A field-theory motivated approach to computer algebra.","archived":false,"fork":false,"pushed_at":"2025-05-12T20:28:19.000Z","size":165580,"stargazers_count":243,"open_issues_count":91,"forks_count":41,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-16T10:06:15.737Z","etag":null,"topics":["cadabra2","computer-algebra","computer-algebra-system","cplusplus","mathematics","physics","python3","science-research","symbolic-manipulation","sympy","tensor-algebra","tensors"],"latest_commit_sha":null,"homepage":"https://cadabra.science/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kpeeters.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null}},"created_at":"2015-11-03T17:44:58.000Z","updated_at":"2025-05-09T02:23:14.000Z","dependencies_parsed_at":"2024-01-13T16:24:54.633Z","dependency_job_id":"75337ba6-09b4-4433-8218-99542987a491","html_url":"https://github.com/kpeeters/cadabra2","commit_stats":{"total_commits":3106,"total_committers":18,"mean_commits":"172.55555555555554","dds":"0.27784932388924666","last_synced_commit":"542f200c97da2751267988e71a7cb7c85b352ddb"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpeeters%2Fcadabra2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpeeters%2Fcadabra2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpeeters%2Fcadabra2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpeeters%2Fcadabra2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kpeeters","download_url":"https://codeload.github.com/kpeeters/cadabra2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509475,"owners_count":22082891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cadabra2","computer-algebra","computer-algebra-system","cplusplus","mathematics","physics","python3","science-research","symbolic-manipulation","sympy","tensor-algebra","tensors"],"created_at":"2024-08-04T10:01:13.436Z","updated_at":"2025-05-16T10:06:26.543Z","avatar_url":"https://github.com/kpeeters.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"Cadabra\n=======\n\n.. image:: https://joss.theoj.org/papers/10.21105/joss.01118/status.svg\n   :target: https://doi.org/10.21105/joss.01118\n\n.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.2500762.svg\n   :target: https://doi.org/10.5281/zenodo.2500762\n\n.. image:: https://github.com/kpeeters/cadabra2/workflows/Linux/badge.svg\n   :target: https://github.com/kpeeters/cadabra2/actions?query=workflow%3ALinux\n\n.. image:: https://github.com/kpeeters/cadabra2/workflows/macOS/badge.svg\n   :target: https://github.com/kpeeters/cadabra2/actions?query=workflow%3AmacOS\n\n.. image:: https://github.com/kpeeters/cadabra2/workflows/Docker/badge.svg\n   :target: https://github.com/kpeeters/cadabra2/actions?query=workflow%3ADocker\n\n.. image:: https://github.com/kpeeters/cadabra2/workflows/Windows%2011/badge.svg\n   :target: https://github.com/kpeeters/cadabra2/actions?query=workflow%3AWindows%2011\n\n.. image:: https://github.com/kpeeters/cadabra2/workflows/FreeBSD/badge.svg\n   :target: https://github.com/kpeeters/cadabra2/actions?query=workflow%3AFreeBSD\n\n*A field-theory motivated approach to computer algebra.*\n\nKasper Peeters \u003cinfo@cadabra.science\u003e\n\n- End-user documentation at https://cadabra.science/\n- Source code documentation at https://cadabra.science/doxygen/html\n\nThis repository holds the 2.x series of the Cadabra computer algebra\nsystem. It supersedes the 1.x series, which can still be found at\nhttps://github.com/kpeeters/cadabra.\n\nCadabra is a symbolic computer algebra system, designed specifically\nfor the solution of problems encountered in quantum and classical\nfield theory. It has extensive functionality for tensor computer\nalgebra, tensor polynomial simplification including multi-term\nsymmetries, fermions and anti-commuting variables, Clifford algebras\nand Fierz transformations, implicit coordinate dependence, multiple\nindex types and many more. The input format is a subset of TeX. Both a\ncommand-line and a graphical interface are available, and there is a\nkernel for Jupyter.\n\n\nInstallation\n-------------\n\nCadabra builds on Linux, macOS, OpenBSD, FreeBSD and Windows. Select\nyour system from the list below for detailed instructions.\n\n- `Linux (Debian/Ubuntu/Mint)`_\n- `Linux (Fedora 24 and later)`_\n- `Linux (CentOS/Scientific Linux)`_\n- `Linux (openSUSE)`_\n- `Linux (Arch/Manjaro)`_\n- `Linux (Solus)`_\n- `OpenBSD`_\n- `FreeBSD`_\n- `macOS`_\n- `Windows`_\n\nBinaries for most of these platforms are provided from the download\npage at https://cadabra.science/download.html, which links to\nhttps://github.com/kpeeters/cadabra2/releases/latest.  These binaries\nare automatically generated on every release.\n\nSee `Building Cadabra as C++ library`_ for instructions on how to\nbuild the entire Cadabra functionality as a library which you can use\nin a C++ program.\n\nSee `Building a Jupyter kernel`_ for information on the Jupyter kernel\nfor Cadabra sessions.\n\nSee `Notes on Python paths`_ for some remarks on where Cadabra\ninstalls its Python modules and how this plays with various types of\nPython installations.\n\n\nLinux (Debian/Ubuntu/Mint)\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nOn Debian/Ubuntu you can install all that is needed with::\n\n    sudo apt install git cmake libpython3-dev python3-dev g++ libgmp3-dev \\\n          libgtkmm-3.0-dev libboost-all-dev libssl-dev libgmp-dev libsqlite3-dev uuid-dev  \\\n          python3-matplotlib python3-mpmath python3-sympy python3-gmpy2\n\n(on Ubuntu 14.04 you need to replace `cmake` with `cmake3` and also\ninstall g++-4.9; get in touch if you don't know how to do this). On\nolder systems you may want to install `sympy` using `sudo pip3 install\nsympy`, but that is discouraged in general.\n\t \nThis is the development platform and issues are typically first fixed\nhere. You can use either g++ or the clang++ compiler to build. You need to\nclone the cadabra2 git repository (if you download the .zip file you\nwill not have all data necessary to build). So first do::\n\n    git clone https://github.com/kpeeters/cadabra2\n\nBuilding is then done with the standard::\n\n    cd cadabra2\n    mkdir build\n    cd build\n    cmake ..\n    make\n    sudo make install\n\nThis will produce the command line app ``cadabra2`` and the Gtk\nnotebook interface ``cadabra2-gtk``. You can also find the latter in\nthe 'Education' menu.\n\nLinux (Fedora 24 and later)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFedora 24 is the first Fedora to have Python 3; you can build Cadabra\nusing Python 2 but you are strongly encouraged to upgrade. The Fedora\nplatform receives less testing so please get in touch if you run into\nany issues. You can use either g++ or the clang++ compiler.\n\nInstall the dependencies with::\n\n    sudo dnf install git python3-devel make cmake gcc-c++ \\\n         gmp-devel libuuid-devel sqlite-devel \\\n         gtkmm30-devel boost-devel \\\n         python3-matplotlib \\\n         python3-pip\n    sudo pip3 install sympy\n\nYou need to clone the cadabra2 git repository (if you download the\n.zip file you will not have all data necessary to build). So first do::\n\n    git clone https://github.com/kpeeters/cadabra2\n\nBuilding is then done with the standard::\n\n    cd cadabra2\n    mkdir build\n    cd build\n    cmake ..\n    make\n    sudo make install\n\nThis will produce the command line app ``cadabra2`` and the Gtk\nnotebook interface ``cadabra2-gtk``. You can also find the latter\nwhen searching for the 'Cadabra' app from the 'Activities' menu.\n\nLinux (CentOS/Scientific Linux)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nOn CentOS/Scientific Linux you need to activate The Software\nCollections (SCL) and Extra Packages for Enterprise Linux (EPEL) to\nget access to a modern C++ compiler, Python3 and all required build\ntools.\n\nOn *CentOS* first do::\n\n    sudo yum install centos-release-scl epel-release\n\nOn *Scientific Linux* the equivalent is::\n\n    sudo yum install yum-conf-softwarecollections epel-release\n\t \nNow install all build dependencies with::\n  \n    sudo yum install devtoolset-7 rh-python36 cmake3 \\\n\t          gmp-devel libuuid-devel sqlite-devel \\\n                  gtkmm30-devel boost-devel git \\\n\t          python-matplotlib \n\nYou need to enable the Python3 and C++ compiler which you just\ninstalled with::\n\n    scl enable rh-python36 bash\t\t\t\t\t\n    scl enable devtoolset-7 bash\n\n(note: do *not* use sudo here!).\n\t \nYou also need to install sympy by hand::\n\n    sudo pip3 install sympy\n\nNow need to clone the cadabra2 git repository (if you download the\n.zip file you will not have all data necessary to build)::\n\n    git clone https://github.com/kpeeters/cadabra2\n\nBuilding is then done with the standard::\n\n    cd cadabra2\n    mkdir build\n    cd build\n    cmake3 .. \n    make\n    sudo make install\n\nThis will produce the command line app ``cadabra2`` and the Gtk\nnotebook interface ``cadabra2-gtk``. You can also find the latter in\nthe 'Education' menu.\n\n\nLinux (openSUSE)\n~~~~~~~~~~~~~~~~\n\nFor openSUSE (tested on 'Leap 15.2', probably also fine with minor\nchanges for 'Tumbleweed') you first need to install the dependencies\nwith::\n\n    sudo zypper install --no-recommends git cmake python3-devel gcc-c++ \\\n                  gmp-devel libuuid-devel sqlite-devel \\\n                  gtkmm3-devel  \\\n                  python3-matplotlib \\\n                  python3-sympy \\\n                  libboost_system1_71_0-devel libboost_filesystem1_71_0-devel \\\n                  libboost_date_time1_71_0-devel libboost_program_options1_71_0-devel\n\nThis platform receives less testing so please get in touch if you run\ninto any issues. You need to clone the cadabra2 git repository (if you\ndownload the .zip file you will not have all data necessary to\nbuild). So first do::\n\n    git clone https://github.com/kpeeters/cadabra2\n\nBuilding is then done with the standard::\n\n    cd cadabra2\n    mkdir build\n    cd build\n    cmake .. \n    make\n    sudo make install\n\nThis will produce the command line app ``cadabra2`` and the Gtk\nnotebook interface ``cadabra2-gtk``. \n\n\nLinux (Arch/Manjaro)\n~~~~~~~~~~~~~~~~~~~~\n\nThe package for Arch Linux is cadabra2\nhttps://aur.archlinux.org/packages/cadabra2/  Building and\ninstalling (including dependencies) can be accomplished with::\n\n    yay -S cadabra2\n\nAlternatively use ``makepkg``::\n\n    git clone https://aur.archlinux.org/cadabra2.git\n    cd cadabra2\n    makepkg -si\n\nPlease consult the Arch Wiki\nhttps://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages\nfor more information regarding installing packages from the AUR.\n\n\nLinux (Solus)\n~~~~~~~~~~~~~\n\nSupport for Solux Linux is experimental. To build from source on Solus\nLinux, first install the dependencies by doing::\n\n    sudo eopkg install -c system.devel\n    sudo eopkg install libboost-devel gmp-devel libgtkmm-3-devel \n    sudo eopkg install sqlite3-devel python3-devel\n    sudo eopkg install git cmake make g++\n\nThen configure and build with::\n\n    cd cadabra2\n    mkdir build\n    cd build\n    cmake .. -DCMAKE_INSTALL_PREFIX=/usr\n    make\n    sudo make install\n\nThis installs below ``/usr`` (instead of ``/usr/local`` on other\nplatforms) because I could not figure out how to make it pick up\nlibraries there.\n\nAny feedback on these instructions is welcome.\n\n\nOpenBSD\n~~~~~~~\n\nInstall the dependencies with::\n\n  pkg_add git cmake boost python-3.6.2 gtk3mm gmp gmpxx py3-sympy\n\nWe will build using the default clang-4.0.0 compiler; building with\nthe alternative g++-4.9.4 leads to trouble when linking against the\nlibraries added with pkg_add.\n\nConfigure and build with::\n\n  cd cadabra2\n  mkdir build\n  cd build\n  cmake -DENABLE_MATHEMATICA=OFF ..\n  make\n  su\n  make install\n\nThe command-line version is now available as ``cadabra2`` and the\nnotebook interface as ``cadabra2-gtk``.\n\nAny feedback on this platform is welcome as this is not our\ndevelopment platform and testing is done only occasionally.\n\n\nFreeBSD\n~~~~~~~\n\nThe recommended way to install Cadabra is through::\n\n  pkg install cadabra2\n\nIt is also possible to build and install Cadabra from the port::\n\n  cd /usr/ports/math/cadabra2 \u0026\u0026 make install clean\n\nThe command-line version is now available as ``cadabra2`` and the\nnotebook interface as ``cadabra2-gtk``.\n\nAny feedback on this platform is welcome as this is not our\ndevelopment platform.\n\n\nmacOS\n~~~~~\n\nCadabra builds with the standard Apple compiler, on both Intel and\nApple silicon, but you do need a number of packages from Homebrew (see\nhttps://brew.sh). Install the required dependencies with::\n\n    brew install cmake boost gmp python3 \n    brew install pkgconfig \n    brew install gtkmm3 adwaita-icon-theme\n    pip3 install sympy gmpy2\n\nIf the lines above prompt you to install XCode, go ahead and let it do\nthat.\n\nYou can build against an Anaconda Python installation (in case you\nprefer Anaconda over the Homebrew Python); cmake will automatically\npick this up if available.\n\nYou need to clone the cadabra2 git repository (if you download the\n.zip file you will not have all data necessary to build). So do::\n\n    git clone https://github.com/kpeeters/cadabra2\n\nAfter that you can build with the standard::\n\n    cd cadabra2\n    mkdir build\n    cd build\n    cmake -DENABLE_MATHEMATICA=OFF ..\n    make\n    sudo make install\n\n(*note* the `-DENABLE_MATHEMATICA=OFF` in the `cmake` line above; the\nMathematica scalar backend does not yet work on macOS).\n  \nThis will produce the command line app ``cadabra2`` and the Gtk\nnotebook interface ``cadabra2-gtk``. \n\nFeedback from macOS users is *very* welcome because this is not the main\ndevelopment platform.\n\n\nWindows\n~~~~~~~\n\nOn Windows compilation is easiest by using the MSYS2 system, as their\ngtkmm-3.0 packages just work and the whole system can be driven from the\ncommand line. We used to build Cadabra using the vcpkg packages, but\nthey no longer provide packages for gtkmm-3.0, and in general the lack\nof binary packages means that build times are on the order of many, many\nhours, instead of just a few minutes with MSYS2. More info on building and\npackaging gtk apps on windows at https://www.gtk.org/docs/installations/windows/.\n\nInstall MSYS2 from https://www.msys2.org and start a UCRT64 shell.\nFirst update with (if you don't do this you may end up not being able\nto install some of the required packages due to version conflicts)::\n\n    pacman -Suy\n\nThen install a compiler and the dependencies of Cadabra with::\n\n    pacman -S mingw-w64-ucrt-x86_64-gcc\n    pacman -S mingw-w64-ucrt-x86_64-gtkmm3\n    pacman -S mingw-w64-ucrt-x86_64-boost    \n    pacman -S mingw-w64-ucrt-x86_64-sqlite3\n    pacman -S mingw-w64-ucrt-x86_64-cmake\n    pacman -S mingw-w64-ucrt-x86_64-python\n    pacman -S mingw-w64-ucrt-x86_64-python-matplotlib\n    pacman -S mingw-w64-ucrt-x86_64-python-sympy\n    pacman -S mingw-w64-ucrt-x86_64-osslsigncode\n    pacman -S git\n\nCheckout Cadabra and build::\n\n    git clone https://github.com/kpeeters/cadabra2\n    cd cadabra2\n    mkdir build\n    cd build\n    cmake ..\n    ninja\n    ninja install\n\nThis will leave an installation in `Program Files (x86)/Cadabra`, from where\nyou can start `cadabra2-gtk`. \n\nTo build an installer, simply run `cpack` after having built\nCadabra. \n    \n\nBuilding a Jupyter kernel\n-------------------------\n\nAs of version 2.3.4 the standard build process (as described above)\nalso creates a Jupyter kernel, which is written in Python on top of\n`ipykernel` (thanks to Fergus Baker). This should work on most\nplatforms out-of-the-box; you do not need to do anything else. The\nJupyter kernel allows you to use Cadabra notation inside a Jupyter\nnotebook session.\n\nThe distribution also still contains code for the 'old' Jupyter\nkernel, which is written in C++ on top of `xeus`. Building this kernel\nis more complicated mainly because of this dependency, and there is\nnot much of an advantage over the Python kernel; it's mainly left in\nthe tree for future reference, For full instructions on how to build\nthe old `xeus`-based kernel, see\nhttps://github.com/kpeeters/cadabra2/blob/master/JUPYTER.rst.\n\n\nCreating an AppImage\n--------------------\n\nThe Cadabra build system can create an AppImage for use on a wide\nvariety of Linux distributions (this is used to create the AppImage\nwhich is available from the `releases` on github). This build process\nhas been tested by using Ubuntu 20.04 as base system. Install the\nprerequisites as above,::\n\n    sudo apt install git cmake libpython3-dev python3-dev g++ libgmp3-dev \\\n          libgtkmm-3.0-dev libboost-all-dev libssl-dev libgmp-dev libsqlite3-dev uuid-dev  \\\n          python3-matplotlib python3-mpmath python3-sympy python3-gmpy2\n\nNow configure and build with::\n\n    cmake -DAPPIMAGE_MODE=ON -DCMAKE_INSTALL_PREFIX=/usr ..\n    make\n    make install DESTDIR=AppDir\n\nThis installs everything in the `AppDir` folder ready for packaging.\nThen run::\n\n    make appimage\n\nto create the AppImage itself. If you run into trouble with this,\nplease first consult the comments in the top-level `CMakeLists.txt`\nfile about `linuxdeploy` and friends.\n\n\n\nTutorials and other help\n------------------------\n\nPlease consult https://cadabra.science/ for tutorial-style notebooks\nand all other documentation, and https://cadabra.science/doxygen/html/\nfor doxygen documentation of the current master branch. The latter can\nalso be generated locally; you will need (on Debian and derivatives)::\n\n    sudo apt-get install doxygen libjs-mathjax  \n\nFor any questions, please contact info@cadabra.science .\n\n\nBuilding Cadabra as C++ library\n-------------------------------\n\nIf you want to use the functionality of Cadabra inside your own C++\nprograms, you can build Cadabra as a shared library. To do this::\n\n    mkdir build-lib\n    cd build-lib\n    cmake -DBUILD_AS_CPP_LIBRARY=ON ..\n    make\n    sudo make install\n\nThere is a sample program `simple.cc\n\u003chttps://github.com/kpeeters/cadabra2/blob/master/c%2B%2Blib/simple.cc\u003e`_\nin the `c++lib` directory which shows how to use the Cadabra library.\n\n\nNotes on Python paths\n---------------------\n\nCadabra tries to play nice with a large variety of Python\ninstallations, which is not an easy task. In general, it will try to\ninstall in such a way that the Python interpreter which is specified\nat build time will be able to import the `cadabra2` Python module\nwithout any change to its path.  This is necessary so that e.g. a\nJupyter notebook will be able to find this module.  Cadabra will\ntherefore install its Python module in\n`site.getsitepackages()[0]`. Since this module constructs its\ndocstrings dynamically on load, the manual pages are also stored\nrelative to this module.\n\nHowever, Cadabra will install its binaries according to standard\nCMake logic in `$CMAKE_INSTALL_PREFIX/bin/`. On systems that have\nPython installed in subtree which is not below `$CMAKE_INSTALL_PREFIX`,\nthis means that the Cadabra binaries and the Cadabra Python module\nwill not be in the same subtree. This typically happens on systems\nwith Python coming from Homebrew, as these will have Python somewhere\nbelow `/opt/homebrew` even when `$CMAKE_INSTALL_PREFIX` is `/usr/local/`.\n\nOn some systems, users or package managers prefer that\n`site.getsitepackages()[0]` remains under control of the package\nmanager (Homebrew is the typical example). In this case, if you do not\nwant to write there, your only option is to first create a virtual\nenvironment before you run Cadabra's `cmake`.\n\n\nSpecial thanks\n--------------\n\nSpecial thanks to José M. Martín-García (for the xPerm\ncanonicalisation code), James Allen (for writing much of the factoring\ncode), Dominic Price (for the meld algorithm implementation, many\nadditions to the notebook interface, the conversion to pybind and the\nWindows port), Fergus Baker (for the new Jupyter kernel), Isuru\nFernando (for the Conda packaging), the Software Sustainability\nInstitute and the Institute of Advanced Study. Thanks to the many\npeople who have sent me bug reports (keep 'm coming), and thanks to\nall of you who use Cadabra, sent feedback or cited the Cadabra\npapers.\n\nLicenses\n--------\n\nCadabra itself is licensed under the GPL-3.0. It includes some dependencies\nwhich have the following licenses:\n\n* tiny-process-lib [https://gitlab.com/eidheim/tiny-process-library/]\n  MIT license\n\n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpeeters%2Fcadabra2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkpeeters%2Fcadabra2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpeeters%2Fcadabra2/lists"}