GithubHelp home page GithubHelp logo

kpeeters / cadabra2 Goto Github PK

View Code? Open in Web Editor NEW
215.0 21.0 37.0 158.09 MB

A field-theory motivated approach to computer algebra.

Home Page: https://cadabra.science/

License: GNU General Public License v3.0

CMake 13.20% CSS 11.30% Makefile 0.08% C++ 63.13% TeX 2.00% Python 0.64% C 0.04% Objective-C 0.05% Objective-C++ 0.14% HTML 8.34% Mathematica 0.12% Shell 0.23% Batchfile 0.03% Rich Text Format 0.01% Dockerfile 0.04% JavaScript 0.21% Jupyter Notebook 0.02% Lua 0.35% Inno Setup 0.09%
computer-algebra mathematics tensors physics science-research cplusplus python3 symbolic-manipulation cadabra2 computer-algebra-system

cadabra2's Introduction

Cadabra

A field-theory motivated approach to computer algebra.

Kasper Peeters <[email protected]>

This repository holds the 2.x series of the Cadabra computer algebra system. It supersedes the 1.x series, which can still be found at https://github.com/kpeeters/cadabra.

Cadabra is a symbolic computer algebra system, designed specifically for the solution of problems encountered in quantum and classical field theory. It has extensive functionality for tensor computer algebra, tensor polynomial simplification including multi-term symmetries, fermions and anti-commuting variables, Clifford algebras and Fierz transformations, implicit coordinate dependence, multiple index types and many more. The input format is a subset of TeX. Both a command-line and a graphical interface are available, and there is a kernel for Jupyter.

Installation

Cadabra builds on Linux, macOS, OpenBSD, FreeBSD and Windows. Select your system from the list below for detailed instructions.

Binaries for these platforms may (or may not) be provided from the download page at https://cadabra.science/download.html, but they are not always very up-to-date.

See Building Cadabra as C++ library for instructions on how to build the entire Cadabra functionality as a library which you can use in a C++ program.

See Building a Jupyter kernel for information on the Jupyter kernel for Cadabra sessions.

Linux (Debian/Ubuntu/Mint)

On Debian/Ubuntu you can install all that is needed with:

sudo apt install git cmake libpython3-dev python3-dev g++ libgmp3-dev \
      libgtkmm-3.0-dev libboost-all-dev libgmp-dev libsqlite3-dev uuid-dev  \
      python3-matplotlib python3-mpmath python3-sympy python3-gmpy2

(on Ubuntu 14.04 you need to replace cmake with cmake3 and also install g++-4.9; get in touch if you don't know how to do this). On older systems you may want to install sympy using sudo pip3 install sympy, but that is discouraged in general.

This is the development platform and issues are typically first fixed here. You can use either g++ or the clang++ compiler to build. You need to clone the cadabra2 git repository (if you download the .zip file you will not have all data necessary to build). So first do:

git clone https://github.com/kpeeters/cadabra2

Building is then done with the standard:

cd cadabra2
mkdir build
cd build
cmake ..
make
sudo make install

This will produce the command line app cadabra2 and the Gtk notebook interface cadabra2-gtk. You can also find the latter in the 'Education' menu.

Linux (Fedora 24 and later)

Fedora 24 is the first Fedora to have Python 3; you can build Cadabra using Python 2 but you are strongly encouraged to upgrade. The Fedora platform receives less testing so please get in touch if you run into any issues. You can use either g++ or the clang++ compiler.

Install the dependencies with:

sudo dnf install git python3-devel make cmake gcc-c++ \
     gmp-devel libuuid-devel sqlite-devel \
     gtkmm30-devel boost-devel \
     texlive python3-matplotlib \
     python3-pip
sudo pip3 install sympy

You need to clone the cadabra2 git repository (if you download the .zip file you will not have all data necessary to build). So first do:

git clone https://github.com/kpeeters/cadabra2

Building is then done with the standard:

cd cadabra2
mkdir build
cd build
cmake ..
make
sudo make install

This will produce the command line app cadabra2 and the Gtk notebook interface cadabra2-gtk. You can also find the latter when searching for the 'Cadabra' app from the 'Activities' menu.

Linux (CentOS/Scientific Linux)

On CentOS/Scientific Linux you need to activate The Software Collections (SCL) and Extra Packages for Enterprise Linux (EPEL) to get access to a modern C++ compiler, Python3 and all required build tools.

On CentOS first do:

sudo yum install centos-release-scl epel-release

On Scientific Linux the equivalent is:

sudo yum install yum-conf-softwarecollections epel-release

Now install all build dependencies with:

sudo yum install devtoolset-7 rh-python36 cmake3 \
              gmp-devel libuuid-devel sqlite-devel \
         gtkmm30-devel boost-devel git \
              texlive python-matplotlib

You need to enable the Python3 and C++ compiler which you just installed with:

scl enable rh-python36 bash
scl enable devtoolset-7 bash

(note: do not use sudo here!).

You also need to install sympy by hand:

sudo pip3 install sympy

Now need to clone the cadabra2 git repository (if you download the .zip file you will not have all data necessary to build):

git clone https://github.com/kpeeters/cadabra2

Building is then done with the standard:

cd cadabra2
mkdir build
cd build
cmake3 ..
make
sudo make install

This will produce the command line app cadabra2 and the Gtk notebook interface cadabra2-gtk. You can also find the latter in the 'Education' menu.

Linux (openSUSE)

For openSUSE (tested on 'Leap 15.2', probably also fine with minor changes for 'Tumbleweed') you first need to install the dependencies with:

sudo zypper install --no-recommends git cmake python3-devel gcc-c++ \
              gmp-devel libuuid-devel sqlite-devel \
              gtkmm3-devel  \
              texlive python3-matplotlib \
              python3-sympy \
              libboost_system1_71_0-devel libboost_filesystem1_71_0-devel \
              libboost_date_time1_71_0-devel libboost_program_options1_71_0-devel

You can get away with less than the full texlive.

This platform receives less testing so please get in touch if you run into any issues. You need to clone the cadabra2 git repository (if you download the .zip file you will not have all data necessary to build). So first do:

git clone https://github.com/kpeeters/cadabra2

Building is then done with the standard:

cd cadabra2
mkdir build
cd build
cmake ..
make
sudo make install

This will produce the command line app cadabra2 and the Gtk notebook interface cadabra2-gtk.

Linux (Arch/Manjaro)

The package for Arch Linux is cadabra2 https://aur.archlinux.org/packages/cadabra2/ Building and installing (including dependencies) can be accomplished with:

yay -S cadabra2

Alternatively use makepkg:

git clone https://aur.archlinux.org/cadabra2.git
cd cadabra2
makepkg -si

Please consult the Arch Wiki https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages for more information regarding installing packages from the AUR.

Linux (Solus)

Support for Solux Linux is experimental. To build from source on Solus Linux, first install the dependencies by doing:

sudo eopkg install -c system.devel
sudo eopkg install libboost-devel gmp-devel libgtkmm-3-devel
sudo eopkg install sqlite3-devel texlive python3-devel
sudo eopkg install git cmake make g++

Then configure and build with:

cd cadabra2
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install

This installs below /usr (instead of /usr/local on other platforms) because I could not figure out how to make it pick up libraries there.

Any feedback on these instructions is welcome.

OpenBSD

Install the dependencies with:

pkg_add git cmake boost python-3.6.2 gtk3mm gmp gmpxx texlive_texmf-full py3-sympy

We will build using the default clang-4.0.0 compiler; building with the alternative g++-4.9.4 leads to trouble when linking against the libraries added with pkg_add.

Configure and build with:

cd cadabra2
mkdir build
cd build
cmake -DENABLE_MATHEMATICA=OFF ..
make
su
make install

The command-line version is now available as cadabra2 and the notebook interface as cadabra2-gtk.

Any feedback on this platform is welcome as this is not our development platform and testing is done only occasionally.

FreeBSD

The recommended way to install Cadabra is through:

pkg install cadabra2

It is also possible to build and install Cadabra from the port:

cd /usr/ports/math/cadabra2 && make install clean

The command-line version is now available as cadabra2 and the notebook interface as cadabra2-gtk.

Any feedback on this platform is welcome as this is not our development platform.

macOS

Cadabra builds with the standard Apple compiler, on both Intel and Apple silicon, but you do need a number of packages from Homebrew (see https://brew.sh). Install the required dependencies with:

brew install cmake boost gmp python3
brew install pkgconfig
brew install gtkmm3 adwaita-icon-theme
pip3 install sympy gmpy2

If the lines above prompt you to install XCode, go ahead and let it do that.

You also need a TeX installation such as MacTeX, https://tug.org/mactex/ . Any TeX will do, as long as 'latex' and 'dvipng' are available, so you simply do:

brew install mactex

Make sure to install TeX before attempting to build Cadabra, otherwise the Cadabra style files will not be installed in the appropriate place. Make sure 'latex' works from the terminal in which you will build Cadabra.

You can build against an Anaconda Python installation (in case you prefer Anaconda over the Homebrew Python); cmake will automatically pick this up if available.

You need to clone the cadabra2 git repository (if you download the .zip file you will not have all data necessary to build). So do:

git clone https://github.com/kpeeters/cadabra2

After that you can build with the standard:

cd cadabra2
mkdir build
cd build
cmake -DENABLE_MATHEMATICA=OFF ..
make
sudo make install

(note the -DENABLE_MATHEMATICA=OFF in the cmake line above; the Mathematica scalar backend does not yet work on macOS).

This will produce the command line app cadabra2 and the Gtk notebook interface cadabra2-gtk.

Feedback from macOS users is very welcome because this is not the main development platform.

Windows

On Windows the main constraint on the build process is that we want to link to Anaconda's Python, which has been built with Visual Studio. The recommended way to build Cadabra is thus to build against libraries which are all built using Visual Studio as well (if you are happy to not use Anaconda, you can also build with the excellent MSYS2 system from https://www.msys2.org/). It is practically impossible to build all dependencies yourself without going crazy, but fortunately that is not necessary because of the VCPKG library at https://github.com/Microsoft/vcpkg. This contains all dependencies (boost, gtkmm, sqlite and various others) in ready-to-use form.

If you do not already have it, first install Visual Studio Community Edition from https://www.visualstudio.com/downloads/ and install Anaconda (a 64 bit version!) from https://www.anaconda.com/download/. You also need a TeX distribution, for instance MiKTeX from https://miktex.org and of course git from e.g. https://gitforwindows.org/. You need all four before you can start building Cadabra.

The instructions below are for building using the Visual Studio 'x64 Native Tools Command Prompt' (not the GUI). First, clone the vcpkg repository:

git clone https://github.com/Microsoft/vcpkg

Run the bootstrap script to set things up:

cd vcpkg
bootstrap-vcpkg.bat

Install all the dependencies with (this is a very slow process, be warned, it can easily take several hours, but at least it's automatic):

vcpkg install mpir:x64-windows glibmm:x64-windows sqlite3:x64-windows
vcpkg install boost-system:x64-windows                   boost-asio:x64-windows                   boost-uuid:x64-windows                   boost-program-options:x64-windows                   boost-signals2:x64-windows boost-property-tree:x64-windows                   boost-date-time:x64-windows                   boost-filesystem:x64-windows boost-ublas:x64-windows
vcpkg install gtkmm:x64-windows
vcpkg integrate install

The last line will spit out a CMAKE toolchain path; write it down, you need that shortly. Now clone the cadabra repository and configure as:

cd ..
git clone https://github.com/kpeeters/cadabra2
cd cadabra2
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=[the path obtained in the last step]
      -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_INSTALL_PREFIX=C:\Cadabra
      -G "Visual Studio 16 2019" -A x64 ..

the latter all on one line, in which you replace the CMAKE_TOOLCHAIN_PATH with the path produced by the vcpkg integrate install step. Do _not_ forget the .. at the very end! The last line can be adjusted to -G "Visual Studio 15 2017 Win64" if you are on the previous version of Visual Studio. You can ignore warnings (but not errors) about Boost. You may have to add:

-DCMAKE_INCLUDE_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.22.27821"

or a similar path to make cmake pick up msvc140.dll and related; see [https://developercommunity.visualstudio.com/content/problem/618084/cmake-installrequiredsystemlibraries-broken-in-lat.html]

Now build Cadabra with:

cmake --build . --config RelWithDebInfo --target install

This will build and then install in C:\Cadabra. The self-tests can be run by doing:

ctest

(still fails tensor_monomials, bianchi_identities, paper and young when in Release build).

Finally, the command-line version of Cadabra can now be started with:

python C:\Cadabra\bin\cadabra2

and you can start the notebook interface with:

C:\Cadabra\bin\cadabra2-gtk

It should be possible to simply copy the C:Cadabra folder to a different machine and run it there (that is essentially what the binary installer does).

To create an installer, make sure you have Inno installer available. Then run, from the cadabra2/config directory:

"C:\Program Files (x86)\Inno Setup 6\ISCC" install_script.iss

Building a Jupyter kernel

As of version 2.3.4 the standard build process (as described above) also creates a Jupyter kernel, which is written in Python on top of ipykernel (thanks to Fergus Baker). This should work on most platforms out-of-the-box; you do not need to do anything else. The Jupyter kernel allows you to use Cadabra notation inside a Jupyter notebook session.

The distribution also still contains code for the 'old' Jupyter kernel, which is written in C++ on top of xeus. Building this kernel is more complicated mainly because of this dependency, and there is not much of an advantage over the Python kernel; it's mainly left in the tree for future reference, For full instructions on how to build the old xeus-based kernel, see https://github.com/kpeeters/cadabra2/blob/master/JUPYTER.rst.

Creating an AppImage

When building Cadabra for bundling as an AppImage, the GUI will be configured to use MicroTeX (https://github.com/NanoMichael/MicroTeX) for typesetting (this dependency is included in the Cadabra source). MicroTeX is a rendering library which does not rely on an existing LaTeX installation. Configure and build with:

cmake -DAPPIMAGE_MODE=ON -DCMAKE_INSTALL_PREFIX=/usr ..
make
make install DESTDIR=AppDir

This installs everything in the AppDir folder ready for packaging. Then run:

make appimage

to create the AppImage itself.

Tutorials and other help

Please consult https://cadabra.science/ for tutorial-style notebooks and all other documentation, and https://cadabra.science/doxygen/html/ for doxygen documentation of the current master branch. The latter can also be generated locally; you will need (on Debian and derivatives):

sudo apt-get install doxygen libjs-mathjax

For any questions, please contact [email protected] .

Building Cadabra as C++ library

If you want to use the functionality of Cadabra inside your own C++ programs, you can build Cadabra as a shared library. To do this:

mkdir build
cmake -DBUILD_AS_CPP_LIBRARY=ON ..
make
sudo make install

There is a sample program simple.cc in the c++lib directory which shows how to use the Cadabra library.

Special thanks

Special thanks to José M. Martín-García (for the xPerm canonicalisation code), James Allen (for writing much of the factoring code), Dominic Price (for the meld algorithm implementation, many additions to the notebook interface, the conversion to pybind and the Windows port), Fergus Baker (for the new Jupyter kernel), Isuru Fernando (for the Conda packaging), the Software Sustainability Institute and the Institute of Advanced Study. Thanks to the many people who have sent me bug reports (keep 'm coming), and thanks to all of you who use Cadabra, sent feedback or cited the Cadabra papers.

cadabra2's People

Contributors

alexmyczko avatar badshah400 avatar bmwiedemann avatar cbehan avatar dominicprice avatar doxdrum avatar dpbutter avatar fjebaker avatar isuruf avatar kpeeters avatar lgtrombetta avatar rvlobato avatar yitzchak avatar yurivict avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cadabra2's Issues

Compile error on Antergos

After cloning the repo, I ran into the problem while compiling. My compiler was telling me that std::function in core/Functional.hh was not declared. I was able to solve it by adding "#include # into the aforementioned file. Could you please fix this in repo?
Thanks!

young_project_tensor does not handle mixed indices

When indices are mixed upper/lower, young_project_tensor messes them up, and triggers an exception. Example:

{a,b,c,d}::Indices(position=fixed);
{a,b,c,d}::Integer(1..2);
\delta{#}::KroneckerDelta;
ex:= \delta_{c}^{e} \epsilon^{a d};
young_project_tensor(_);

Position of indices

HI,

I am working on Schwarzschild notebook. I want to do calculations implicitly by defining metric like in bellow notebook.

Issues:

  • why indices have different position in definition of Christoffel symbol and its components? Same problem with Riemann tensor.
  • where have I made a mistake in this notebook. I wanted make substitute at the end and find same
    result for Kretschmann scalar but for sure

schwarzschild_new_version.cnb.zip

Thanks

Segfault when running with GTK_DEBUG=interactive

When running in GTK_DEBUG=interactive mode, the 'save as' functionality crashes when the file chooser dialog is closed. Commenting out the actual 'save' does not change this, so it is likely a Gtk issue. May be related to the crash that has been reported on OS X.

Build in web2 produces htmls with unexpanded latex code, and the install target doesn't install anything

I tried to build in web2/.

One resulting html file:///usr/ports/math/cadabra2/work/cadabra2-bb7f711/web2/cadabra2/source/notebooks/kaluza_klein.html in the browser looks like this:

{% extends "notebook_layout.html" %} {% block head %}{%- endblock %} {% block main %} {% raw %}
The Kaluza-Klein example from section 2.5 of hep-th/0701238

This example shows how to use split_index in a somewhat more complicated setting. We first declare the indices that we will use.
{\mu,\nu,\rho,\sigma,\kappa,\lambda,\eta,\chi#}::Indices(full, position=independent); {m,n,p,q,r,s,t,u,v,w,x,y,z,m#}::Indices(subspace, position=independent, parent=full);
\[{}\text{Attached property Indices(position=independent) to }\left(\mu, \nu, \rho, \sigma, \kappa, \lambda, \eta, \chi\#\right).\]

It didn't print any errors. I can't tell what is wrong by looking at it. Maybe some command it expected was missing? It should have complained then.

Additionally, 'install' target is expected to install things, and it didn't install anything when called in web2/

AUR PKGBUILD problems

I have this program on my main desktop computer, and it's been running great. I decided to put it on my laptop, however, I was installing it using the AUR, and I kept getting this error

[ian@ml-01 ~]$ yaourt cadabra2
1 aur/cadabra2 2.1.2-2 (0) (0.00)
    A computer algebra system designed specifically for the solution of
    problems encountered in field theory.
2 aur/cadabra2-git r1214.d0aa77688-1 (1) (0.00)
    A computer algebra system (pre-release version) designed specifically
    for the solution of problems encountered in field theory.
==> Enter n° of packages to be installed (ex: 1 2 3 or 1-3)
==> -------------------------------------------------------
==> 1


==> Downloading cadabra2 PKGBUILD from AUR...
x .SRCINFO
x .gitignore
x PKGBUILD
x package.install
x package.patch
cadabra2 2.1.2-2  (2017-01-29 14:51)
( Unsupported package: Potentially dangerous ! )
==> Edit PKGBUILD ? [Y/n] ("A" to abort)
==> ------------------------------------
==> n

==> cadabra2 dependencies:
 - python-matplotlib (already installed)
 - gtkmm3 (already installed)
 - jsoncpp (already installed)
 - mathjax (already installed)
 - boost-libs (already installed)
 - python-sympy (already installed)
 - texlive-core (already installed)
 - cmake (already installed) [makedepend]
 - boost (already installed) [makedepend]


==> Edit package.install ? [Y/n] ("A" to abort)
==> -------------------------------------------
==> n

==> Continue building cadabra2 ? [Y/n]
==> ----------------------------------
==> y

==> Building and installing package
==> ERROR: Cannot find the git package needed to handle git sources.

==> ERROR: An unknown error has occurred. Exiting...
==> ERROR: Makepkg was unable to build cadabra2.
==> Restart building cadabra2 ? [y/N]
==> ---------------------------------
==>

Is there some sort of MD5 sum that might have been messed up?

Provide a debug option to cadabra2-gtk

Regularly, I do something that causes the frontend to unexpectedly close, with the message Segmentation fault (core dumped). The command-line interface has a -d option that runs the code in a debugger; it might be nice to provide something similar for the frontend?

About the output of a calculation

By default (at least in my setup: Linux debian stable, with Cadabra compiled through git source) in the output presentation, the double derivative is showed as a derivative with two indices. See the last terms in the image.

screenshot from 2016-06-22 15 18 57

Is it possible to customise this feature?

I would like to express it in the usual LaTeX form, say $\nabla^\mu \nabla^\nu$ or similar.

Python 3.5 and macports includes

Hi,
I am compiling cadabra2 as of 2016.10.26 on macOS Sierra.

Could you add support for python3.5 in core/CMakeLists and also a pointer to
-I/opt/local/include
so that it may be possible to build using Macports.
Tanks for your good work.

GP

UI frontend client fails to connect to the server on FreeBSD

Client keeps restarting the server, every time prints this:

cadabra-client: spawning server
PREPARSED:
 import sys
server=0
def setup_catch(cO, cE, sE):
   global server
   sys.stdout=cO
   sys.stderr=cE
   server=sE

PREPARSED:
 import imp; f=open(imp.find_module('cadabra2_defaults')[1]); code=compile(f.read(), 'cadabra2_defaults.py', 'exec'); exec(code); f.close()

cadabra-client: connect done
cadabra-client: connection failed

System calls log for each cycle:

67782: _umtx_op(0x80076d0e0,UMTX_OP_WAKE_PRIVATE,0x7fffffff,0x0,0x0) = 0 (0x0)
cadabra-client: connect done67787: mmap(0x0,4194304,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34577842176 (0x80d000000)
67782: write(2,"cadabra-client: connect done",28) = 28 (0x1c)

67787: mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368212992 (0x800815000)
67782: write(2,"\n",1)                           = 1 (0x1)
67782: kevent(11,0x0,0,{ 12,EVFILT_READ,EV_CLEAR,0x0,0x1,0x812c260bc },128,{ 0.000000000 }) = 1 (0x1)
67782: close(35)                                 = 0 (0x0)
67782: kevent(11,{ 12,EVFILT_READ,EV_ADD|EV_CLEAR,0x0,0x0,0x812c260bc },1,0x0,0,0x0) = 0 (0x0)
67782: socket(PF_INET,SOCK_STREAM,6)             = 35 (0x23)
67782: setsockopt(0x23,0xffff,0x800,0x7fffdfffc974,0x4) = 0 (0x0)
67782: ioctl(35,0x8004667e { IOW 0x66('f'), 126, 4 },0xdfffc964) = 0 (0x0)
67782: connect(35,{ AF_INET 127.0.0.1:20914 },16) ERR#36 'Operation now in progress'
67782: kevent(11,{ 35,EVFILT_WRITE,EV_ADD|EV_CLEAR,0x0,0x0,0x812c40200 },1,0x0,0,0x0) = 0 (0x0)
67782: kevent(11,0x0,0,{ 12,EVFILT_READ,EV_CLEAR,0x0,0x1,0x812c260bc 35,EVFILT_WRITE,EV_CLEAR|EV_EOF,NOTE_LOWAT|0x3c,0x8000,0x812c40200 },128,{ 0.000000000 }) = 2 (0x2)
67782: poll({ 35/POLLOUT },1,0)                  = 1 (0x1)
67782: getsockopt(0x23,0xffff,0x1007,0x7fffdfffccec,0x7fffdfffccfc) = 0 (0x0)
67782: getpeername(35,0x7fffdfffcdb0,0x7fffdfffcde0) ERR#57 'Socket is not connected'
67782: kevent(11,{ 12,EVFILT_READ,EV_ADD|EV_CLEAR,0x0,0x0,0x812c260bc },1,0x0,0,0x0) = 0 (0x0)
67782: shutdown(35,SHUT_RDWR)                    ERR#54 'Connection reset by peer'
cadabra-client: connection failed67782: write(2,"cadabra-client: connection faile"...,33) = 33 (0x21)

How to use the Weight property?

A very useful property defined in Cadabra 1.x is Weight, together with its related WeightInheritproperty, and the algorithms @keep_weight and @drop_weight.

The property Weight seems to be implemented in Cadabra 2.x. However, the use of the algorithms is not documented, and are not working.

@kpeeters Is this happening because the algorithms are not yet implemented?

Meanwhile: Is there a way to bypass the use of these properties and algorithms?

Non-linear action principles

Suppose you want to compute the equations of motion of a non-linear action principle, such as the Sine-Gordon model:

S:= \int { (\partial_t \phi)^2-(\partial_x \phi)^2 -2 + 2 \cos(\phi) }{x};

Can you compute the equations of motion? I tried using

vary(S, $\phi -&gt; \delta{\phi}$)

But is seems not to work, as it keeps computing forever...

Is Cadabra equipped to deal with non-linear potentials? It seems to me that it only admits polynomial terms.

PYTHONPATH problem on MacOS Sierra

Hi All,

I am new on mac. I am trying to compile cadabra on it and there is a problem with pythonpath.
On my linux machine installation ended without problems, good job!
You can find error msg bellow.

Thanks!

-- Configuring self-tests

-- Set PYTHONPATH for testing to /Users/$username/cadabra2/core:/Users/$username/cadabra2/build/core/packages:/Users/$username/cadabra2/build/core:/usr/local/Cellar/python/
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PYTHON_LIBRARY (ADVANCED)
linked by target "cadabra2" in directory /Users/$username/cadabra2/core
linked by target "cadabra2python" in directory /Users/$username/cadabra2/core
linked by target "cadabra_server" in directory /Users/$username/cadabra2/client_server
linked by target "cadabra_client" in directory /Users/$username/cadabra2/client_server

-- Configuring incomplete, errors occurred!
See also "/Users/$username/cadabra2/build/CMakeFiles/CMakeOutput.log".

Provide uninstall instructions

Hi, I'm using 2.0 and would like to upgrade to 2.2. The problem is, I don't know how to uninstall it (I've compiled from github)....

Kernel crash when missing semicolons

The following code seems works, but removing the line with the dummy assignment to foo and running the cell leads to a kernel crash. I tried reducing the example, but the crash is a bit elusive: adding/removing semicolons changes where it happens.

{A,B,C,D}::Indices(flat5d, parent=flat6d);
{z,y,x,w}::Indices(flat2d, parent=flat5d);
{a,b,c,d}::Indices(flat3d, parent=flat5d);
ex:= T_{A B}^{m} T_{C D r} V^{A B C D};
foo:= 0;
split_index(ex, $A,z,a$, repeat=True)
canonicalise(ex)
substitute(ex, $T^{z t? u?} -> 0$, repeat=True)
substitute(ex, $T^{t? z u?} -> 0$, repeat=True)
substitute(ex, $T^{z t?}_{u?} -> 0$, repeat=True)
canonicalise(ex);
substitute(ex, $T^{a z}_{r} -> 0$, repeat=True);
sort_product(ex);

cadabra2 ModuleNotFoundError in jupyter

Hi,

I'm new using python and I'm willing to work with cadabra2 from Jupyter. I tried to start a Jupyter notebook from an Anaconda installation by importing first cadabra2 (installed in Ubuntu 16.04LTS). I do this:

from cadabra2 import *

and get this:

ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 from cadabra2 import *

ModuleNotFoundError: No module named 'cadabra2'

Could you please help me to run this correctly?

Provide tagged releases for easier downstream package maintenance

Hi!
I package cadabra for openSUSE, and would like to provide packages for cadabra2 too. It would be useful if there were tagged versions of the source-code explicitly made available for download so that as a packager I would know when to update my package and so on, rather than taking a random git snapshot (which may be in an unstable state, etc). Thank you very much for your excellent application.

Kernel crash on incorrect TableauSymmetry

The following (admittedly incorrect) command crashes the kernel:
T_{i j k}::TableauSymmetry( shape={2,1}, indices={0,1,2,3} );
It should result in an error on incompatible number of boxes and indices.

No "About Cadabra"

Clicking on Help -> About Cadabra in the GTK version results in the following error:

(cadabra2-gtk:11021): glibmm-CRITICAL **:
unhandled exception (type Glib::Error) in signal handler:
domain: g-file-error-quark
code  : 4
what  : Datei »/usr/local/share/cadabra2/images/cadabra2-gtk.png« konnte nicht geöffnet werden: Datei oder Verzeichnis nicht gefunden

It seems that under Debian the logo is installed under /usr/share/cadabra2/images/cadabra2-gtk.png, while GTK looks under /usr/local/share/cadabra2/images/cadabra2-gtk.png.

The error message "Exception running LaTeX"

cadabra-client: spawning server
cadabra-client: connect done
cadabra-client: Exception running LaTeX.

cadabra2 deletes logs:

                erase_file(std::string(templ)+".log");
                erase_file(std::string(templ)+".out");

It needs to keep failed logs in one file, and point to this file in the error message. Otherwise there is no easy way to tell what went wrong.

Provide a sort_derivatives algorithm

In complex coordinates, things like \del{\delbar{X}} and \delbar{\del{X}} should be sortable to the same term. Probably best done with a new sort_derivatives which sorts commuting derivatives. Could make that the default too.

Python interface: string representation eats up the whitespace in indices

I am using cadabra from within python, that is

> from cadabra2 import *

Looks like the string representation of the Ex objects gobbles up the spaces in indices. For example,

> ex = Ex(r'A^{i j}') 
> print(ex.__repr__())

gives me something like

{A}  (0x2243ee8)
  1:^{i}  (0x2243f38)
  2:^{j}  (0x2247de8)

as it should. But if I then pass str(ex) to Ex,

> print(Ex(str(ex)).__repr__())

I get

{A}  (0x224d608)
  1:^{ij}  (0x224d658)

I would have expected the result to be same as before.

I am using version 2.1.4 compiled from source.

Building error on Mac OS X El Capitan

Hi,
I followed all the instructions for building on Mac (I am using OS X El Capitan, version 10.11.6), and all went fine, except the almost final step (make), where I got the following messages:

%%%%%%%%%%%

[ 81%] Linking CXX shared library libcadabra_server.dylib
ld: warning: ignoring file /opt/local/lib/libglibmm-2.4.dylib, file was built for i386 which is not the architecture being linked (x86_64): /opt/local/lib/libglibmm-2.4.dylib
ld: warning: ignoring file /opt/local/lib/libsigc-2.0.dylib, file was built for i386 which is not the architecture being linked (x86_64): /opt/local/lib/libsigc-2.0.dylib
Undefined symbols for architecture x86_64:
"Glib::get_user_config_dir()", referenced from:
snoop::SnoopImpl::get_user_uuid(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) in Snoop.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [client_server/libcadabra_server.dylib] Error 1
make[1]: *** [client_server/CMakeFiles/cadabra_server.dir/all] Error 2
make: *** [all] Error 2

%%%%%%%%%%%

and of course if I try "sudo make install" afterwards it gives me errors too, and the command line is not created.

Any solution?

vary on fractions crashes

While vary works on powers,

ex:=s**(-1);
vary(_, $s->\delta{s}$);  

it crashes on fractions,

ex:=1/s;

(reported by email Wed, 10 Aug 2016 00:26:38 +0200)

Empty "affiliation" field in register support dialog

Leaving the "affiliation" field in the dialog to register support empty results in the following error:

(cadabra2-gtk:7214): Pango-CRITICAL **: pango_layout_get_cursor_pos: assertion
'index >= 0 && index <= layout->length' failed

(cadabra2-gtk:7214): Pango-CRITICAL **: pango_layout_get_cursor_pos: assertion
'index >= 0 && index <= layout->length' failed

(cadabra2-gtk:7214): Pango-CRITICAL **: pango_layout_get_cursor_pos: assertion
'index >= 0 && index <= layout->length' failed

Please fix compiler warnings

Here are the warnings from clang-3.6:

/usr/ports/math/cadabra2/work/cadabra2-bb7f711/core/Props.cc:133:13: warning: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Wpotentially-evaluated-expression]
                if(typeid(*(pit.first->second.second))==typeid(*pb) &&
                          ^
/usr/ports/math/cadabra2/work/cadabra2-bb7f711/core/Props.cc:341:27: warning: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Wpotentially-evaluated-expression]
                        if(typeid(*pr)==typeid(*(*pit.first).second.second)) {
                                               ^
/usr/ports/math/cadabra2/work/cadabra2-bb7f711/core/Props.cc:410:13: warning: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Wpotentially-evaluated-expression]
                if(typeid(*(*fit).first)==typeid(*pr))
                          ^
/usr/ports/math/cadabra2/work/cadabra2-bb7f711/core/Props.cc:423:13: warning: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Wpotentially-evaluated-expression]
                if(typeid(*(*pit).first)==typeid(*pr))

Failure to build: undefined reference to symbol 'pthread_join@@GLIBC_2.2.5'

[ 86%] Linking CXX executable cadabra-server
/usr/bin/ld: CMakeFiles/cadabra-server.dir/cadabra-server.cc.o: undefined reference to symbol 'pthread_join@@GLIBC_2.2.5'
/usr/lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [client_server/CMakeFiles/cadabra-server.dir/build.make:103: client_server/cadabra-server] Error 1
make[1]: *** [CMakeFiles/Makefile2:663: client_server/CMakeFiles/cadabra-server.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

Pasting Unicode in notebook

Pasting Γ in a notebook leads to a core dump (on the other hand similar attempts in the command-line cadabra2 simply give a UnicodeDecodeError).

$ cadabra2-gtk 
cadabra-client: spawning server
cadabra-client: connect done
  
(cadabra2-gtk:4194): glibmm-ERROR **: 
unhandled exception (type std::exception) in signal handler:
what: basic_string::insert

Trace/breakpoint trap (core dumped)
$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.