# How-To: Installing the PolyLogTools Mathematica package on School Ubuntu Linux hosts

This blog post shows you how to install the PolyLogTools Mathematica package for use on Linux hosts in the School of Physics & Astronomy.

## What is PolyLogTools?

**PolyLogTools** is a Mathematica package for calculations involving multiple polylogarithms.

It’s popular with people in the School’s **Particle Physics Theory** group, and may be of interest to other researchers in the School.

## What this How-To will demonstrate

This short How-To will show you to install your own personal copy of PolyLogTools inside your School Linux Home Directory.

Doing this will let you use PolyLogTools within Mathematica from any Linux host in the School.

## Step 0: Before you start

First of all, you’ll need to be comfortable typing commands into the Linux terminal.

You’ll probably want to install PolyLogTools while you’re sitting at one of our Linux PCs, including our CPLab PCs in JCMB 4325D and ROE U3. However if you’re comfortable working remotely over SSH, then that will work too.

As we’ll be installing PolyLogTools into your own Linux home directory, you’ll need to have about 50 MB of free space in there.

## Step 1: Decide where to install PolyLogTools (and other Mathematica packages)

We’ll be installing PolyLogTools into your Linux home directory.

This guide assumes you’re happy to put everything into a directory called **MathematicaPackages** at the top of your home directory. If you’d prefer to store things elsewhere, you can choose another location, but you’ll need to change some of the commands below to reflect this.

So let’s first create our own MathematicaPackages directory by opening up a new Terminal window and typing the following commands:

cd mkdir MathematicaPackages

What do these commands do? The first command (**cd**) makes sure you’re in your home directory. It isn’t actually necessary if you’ve just opened a new Terminal as you’ll already be at the top of your home directory, but we’ve included it just in case. (In general, this **c**hange **d**irectory command is used to navigate into a different directory usually takes an additional argument to specify where you’d like to go. When used without an argument like we’ve done here, cd takes you the top of home directory, which is really handy if you get a bit lost!)

The second command (**mkdir MathematicaPackages**) creates your **MathematicaPackages** directory, provided it doesn’t already exist.

## Step 2: Install software required by PolyLogTools

PolyLogTools requires a few other pieces of software. (This is pretty common when installing new software – it typically requires and works with other pieces of software. These are called *dependencies*.)

Unsurprisingly, PolyLogTools requires Mathematica! Luckily, our School pays for a site license for Mathematica, and Mathematica version 13 is already installed on all of our Linux hosts.

PolyLogTools also requires a symbolic algebra tool called GiNaC and another Mathematica package called HPL. We already provide a suitable version of GiNaC on our Linux hosts, so there’s nothing to do for that one.

That just leaves us needing to install HPL, which we’ll do next.

## Step 3: Install HPL

We need to download and install the HPL code. This is made available to download via HPL’s website (https://www.physik.uzh.ch/data/HPL/), and it’s distributed as a **.tar.gz** file, which is a popular way of packaging up and compressing a bunch of files – similar to ZIP files.

So type in (or paste) the following commands to download and extract the code into your MathematicaPackages directory:

cd ~/MathematicaPackages wget https://www.physik.uzh.ch/data/HPL/HPL-2.0.tar.gz tar zxf HPL-2.0.tar.gz

(The first **cd** command moves you into your MathematicaPackages directory. Note the use of **~** as a shortcut for your home directory. The very handy **wget** command then downloads the HPL package from its website, and the final** tar** command uncompresses and unpacks all of the HPL code.)

The unpacked HPL files will be stored in a new directory called **HPL-2.0**. (You can type **ls** to see this.)

You should then navigate into this new HPL-2.0 directory and run HPL’s install script by typing:

cd HPL-2.0 ./HPLInstall

The installer will ask you a few questions, which you should reply as follows:

**Platform**: Pick option 2 (linux)**Where to install**: Pick option 2 (/home/[your UUN]/MathematicaPackages/HPL-2.0)

This should take a few seconds to complete. Make sure it ends up saying **Installation successful!**

If you’re pretty familiar with Mathematica, note that the HPL install will have added some stuff to your personal **~/.Mathematica/Autoload/init.m** file, which gets executed whenever you start Mathematica.

Once HPL is installed, you may want to delete the HPL-2.0.tar.gz file you originally downloaded by typing the following commands:

cd .. rm HPL-2.0.tar.gz

## Step 4: Install PolyLogTools

We now download the PolyLogTools package. Unlike HPL, the PolyLogTools code is made available to download using the popular **Git** revision control tool.

So you can download our own copy of the PolyLogTools code by typing:

cd ~/MathematicaPackages git clone https://gitlab.com/pltteam/plt.git

Assuming these commands completed successfully, this should have created a new directory inside MathematicaPackages called **plt**, which contains the PolyLogTools code.

You’ll now want to add some stuff to your Mathematica autoload file to tell it about PolyLogTools.

One way you could do this is by copying & pasting the necessary configuration into your ~/.Mathematica/Autoload/init.m file using a text editor.

But we can also do this without needing a text editor by typing the following command:

cat <<'END' >>~/.Mathematica/Autoload/init.m (* set up path for PolyLogTools *) $PolyLogPath = SetDirectory[$HomeDirectory <> "/MathematicaPackages/plt"]; $Path = Append[$Path, $PolyLogPath]; END

This features a slightly advanced application of the **cat** (=con**cat**enate) command to append (**>>**) stuff to your ~/.Mathematica/Autoload/init.m file. The **<<‘END’** stuff is called a “here document”, and tells cat to keep appending the following lines until it sees a line starting with the word END.

If you like, you can check what has been added to your init.m file by typing: **cat ~/.Mathematica/Autoload/init.m**

It should look something like the following:

(* begin of the lines added by HPL *) $HPLPath = "/home/[your UUN]/MathematicaPackages/HPL-2.0" If[Not[MemberQ[$Path,$HPLPath]],$Path = Flatten[{$Path, $HPLPath }]]; (* end of the lines added by HPL *) (* set up path for PolyLogTools *) $PolyLogPath = SetDirectory[$HomeDirectory <> "/MathematicaPackages/plt"]; $Path = Append[$Path, $PolyLogPath];

The first 4 lines will have been added when you installed HPL, and the next 3 came from you command you typed previously to tell Mathematica about PolyLogTools.

(Note that you may see other stuff here if you have previously added other commands to init.m.)

## Test out PolyLogTools

PolyLogTools should now be installed and ready to try out.

You can test it out by opening up Mathematica (for example, by typing **math** in the Terminal, or by opening up the Mathematica application from the Ubuntu application launcher) and then typing:

<<PolyLogTools`;

If you’ve successfully installed PolyLogTools, then it should output something like the following:

Mathematica 13.0.1 Kernel for Linux x86 (64-bit) Copyright 1988-2022 Wolfram Research, Inc. In[1]:= <<PolyLogTools`; (****** PolyLogTools 1.4 ******) Authors: Claude Duhr, Falko Dulat Email: cduhr@uni-bonn.de PolyLogTools uses the implementation of the PSLQ algorithm by P. Bertok (http://library.wolfram.com/infocenter/MathSource/4263/) *-*-*-*-*-* HPL 2.0 *-*-*-*-*-* Author: Daniel Maitre, University of Zurich Rules for minimal set loaded for weights: 2, 3, 4, 5, 6. Rules for minimal set for + - weights loaded for weights: 2, 3, 4, 5, 6. Table of MZVs loaded up to weight 6 Table of values at I loaded up to weight 6 $HPLFunctions gives a list of the functions of the package. $HPLOptions gives a list of the options of the package. More info in hep-ph/0507152, hep-ph/0703052 and at http://krone.physik.unizh.ch/~maitreda/HPL/ SetDelayed::write: Tag EdgeChromaticNumber in EdgeChromaticNumber[g_Graph] is Protected. /usr/bin/ginsh In[2]:=

If you don’t get an output like this, check that you followed all of the above steps correctly.

If that doesn’t work, ask us for help via the School Helpdesk: sopa-helpdesk@ed.ac.uk

## Comments are closed

Comments to this thread have been closed by the post author or by an administrator.