Skip to content

Sympy and ExprTk

SLOTH provides interfaces with the C++ Mathematical Expression Toolkit Library ExprTk and the Python library for symbolic mathematics Sympy to manage physical properties with Coefficient.

This page presents the instructions for installing these dependencies.

ExprTk

The following installation procedure describes how to install and link the library ExprTk to SLOTH applications.

Getting ExprTk

The C++ Mathematical Expression Toolkit Library ExprTk is contained in the C++ file name exprtk.hpp which can be downloaded either from the ExprTk website or with spack by running the following instructions in a terminal:

spack install exprtk

Other approaches exist as, for example, the use of conda.

Linking SLOTH and ExprTk

To link SLOTH with ExprTk, the user must load the SLOTH configuration file with the --exprtk option:

bash ../envSloth.sh --exprtk=$EXPRTK_PATH

where EXPRTK_PATH is an environment variable setting the path toward the exprtk folder containing the file exprtk.hpp.

With spack, this environment variable can be defined as:

export EXPRTK_PATH=$(spack location -i exprtk)/include/exprtk

Sympy

The Python script GenerateCoefficient.py (see the script folder in the SLOTH repository) used to build coefficients from a mathematical expression is built on top of Sympy.

To install Sympy and use the Python script GenerateCoefficient.py, the following instruction can be run in a terminal:

pip install Sympy

Users are free to use other installation procedures as described in the Sympy website.