Top
Posted: Febraury 19, 2011

Perl Setclass Calculator Script

The following script is entirely my own, for better or for worse. It is a self-contained script that calculates the set class of a given set. Given a particular set of pcs (numbers) in a given mod, the program returns the Tn and TnI classes, and the interval vector. The program is quite powerful, in that it handles decimals, negative numbers and multisets.

To install the script, go to Terminal (in mac), and find the directory where the script is located (using cd). If you need help with that, here is a page outlining some of the basic unix commands.

Assuming the script to be installed is called ‘setclass.pl’, run the following commands:

sudo cat setclass.pl > /usr/local/bin/setclass

sudo chmod +x  /usr/local/bin/setclass

To uninstall, go to Terminal and type:

sudo rm /usr/local/bin/setclass

To use the script, open up Terminal and type ‘setclass’. This will then prompt a dialog that asks for the mod and the pcs. You can also use it with arguments in following manner:

setclass mod pcs...

Here are some example usages:

setclass

setclass 12 3 2 11 4

setclass 10 0 1.25 3 6.75

setclass 1 0 .72 .383 3.11

I should explain the odd interval vector that is used. Since the program accepts multisets and decimal numbers, the usual old interval vector does not suffice. To overcome this, I adopted a system of labeling that lists the interval classes that are present, along with their number of occurrences, where each interval class appears in the form ‘i-#’.

For example, the usual interval vector,

<100011>

is written as

1-1 5-1 6-1

This allows for unusual interval vectors, such as:

0-1 1.3-2 2.7-1 4-2

Let me know if you have any suggestions.