GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/****************************************************************************1**2*A expand_commutator.c ANUPQ source Eamonn O'Brien3**4*Y Copyright 1995-2001, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany5*Y Copyright 1995-2001, School of Mathematical Sciences, ANU, Australia6**7*/89#include "constants.h"1011/* routines for handling expansion of commutator relations */1213void add(int *x, int *y);14void invert_symbols(int *x);1516/* expand the commutator of s and t */1718void expand_commutator(int *s, int t)19{20int a[MAXWORD];21register int i;2223for (i = 0; i < MAXWORD; ++i)24a[i] = s[i];2526invert_symbols(s);27s[length(s)] = -t;28add(s, a);29s[length(s)] = t;30}3132/* find the number of non-zero entries in s */3334int length(int *s)35{36register int i = 0;3738while (i < MAXWORD && s[i] != 0)39++i;4041return i;42}4344/* concatenate y with x */4546void add(int *x, int *y)47{48register int j;49int i = length(x);5051for (j = 0; j < MAXWORD && y[j] != 0; ++j)52x[i + j] = y[j];53}5455/* construct the group-theoretic inverse of the symbols in x */5657void invert_symbols(int *x)58{59register int i = length(x) - 1;60register int j;61int temp, mid;6263mid = i / 2;6465for (j = 0; j <= mid; ++j) {66temp = x[j];67x[j] = -x[i - j];68x[i - j] = -temp;69}70}717273