The file test.c |
Example:Reading this text you should not worry about the lines of this program except for the line scan(INTEGER,a);println(a); which only matters. You may guess that this line in fact means the following: there is an integer a which is read off (''scanned``) from the monitor and then simply printed out. You are right, and all what you have to do in order to check this: Enter make and wait until the prompt arrives (don't bother about the two lines of reply which possibly show up on your screen in the meantime). Then you enter a.out and you will be asked for an integerobject. You enter 5, say, and it answers by printing 5.#include"def.h" #include"macro.h" main() { OP a; anfang(); a = callocobject(); scan(INTEGER,a); println(a); freeall(a); ende(); }
Now you may be curious if you can do better by enlarging the test.c file as follows: You introduce another object b in order to be able to square a, and we give you the hint that there is a procedure mult(OP a,OP b,OP result) that allows to multiply objects a and b, say, in such a way that mult(a,b,c) yields as its result an object c which is the product of a and b. Look at the following example program (stored under ex2.c):
Example:Do the corresponding changes in your file test.c, enter make, then a.out, enter 3 and then 4, and you will obtain 12. An easy check (left to the reader) shows that this is in fact the product of 3 and 4. (For safety reasons the commands println(a) and println(b) were added, the computer shows by repeating these numbers that it understood you properly!)#include"def.h" #include"macro.h" main() { OP a,b,c; anfang(); a = callocobject(); b = callocobject(); c = callocobject(); scan(INTEGER,a); println(a); scan(INTEGER,b); println(b); mult(a,b,c); println(c); freeall(a); freeall(b); freeall(c); ende(); }
Now you may like to try similar things with permutations, vectors, matrices, and so on. Just do a little bit of trial and error, in order to see how far you get. In a first try you may replace INTEGER by PERMUTATION, enter make, and, after the prompt has shown up, you enter a.out. You will then be told by the program that it expects you to enter your favourite permutation in list notation, and that, before you do this, you should enter the length of its vector. So, please enter 5 for this length. The reply will ask you for an integerobject, by which it means the entries of your favourite permutation. Moreover, it tells you that it prefers permutations in list notation. So you may enter the following sequence of natural numbers, separated by blanks: 5 4 3 2 1 This is interpreted by SYMMETRICA as the permutation that maps 1 onto 5, 2 onto 4, and so on, in list notation we shall write that as [5,4,3,2,1]. The program returns four lines with the word integerobject (don't bother why), and a fifth line containing the list [1,2,3,4,5] which is in fact the list of the square [5,4,3,2,1]^{2}.
Now you may be even more ambitious. Replace PERMUTATION by MATRIX. You will see that you will be asked first for the number of rows and columns, and then for the kind of entries you want to use. Try different cases and you will hopefully get a feeling how it works, and, moreover, you will get the feeling that there is a lot more to say and to learn before you really understand what is going on.
Nevertheless you may want immediately to see more of representation theoretical things like characters and character tables of good old symmetric group S_{n} (cf. ex3.c):
Example:Note that the rows and columns correspond to the partitions in inverse lexicographic order!#include"def.h" #include"macro.h" main() { OP a,b,c; anfang(); a = callocobject(); b = callocobject(); scan(INTEGER,a);println(a); chartafel(a,b);println(b); freeall(a); freeall(b); ende(); }(tafel is German for table). The result will be (after make, a.out and entering 5):
5 [1:1:1:1:1:1:1:] [-1:0:-1:1:0:2:4:] [0:-1:1:-1:1:1:5:] [1:0:0:0:-2:0:6:] [0:1:-1:-1:1:-1:5:] [-1:0:1:1:0:-2:4:] [1:-1:-1:1:1:-1:1:]
Now you may want to evaluate a single character value. This can be done by either picking this value from a character table or by direct evaluation.
We suppose that you know that both the irreducible characters and the conjugacy classes of S_{n} can be parametrized in a canonic way by partitions. Partitions are entered in the same way as integers or permutations, namely by scan(PARTITION,a); You will be informed that partitions are supposed to be increasing sequences, which means that the program system prefers the French notation.
Here you see now how a character value can be picked from a character table, after having evaluated this table. The procedure which reads this character value from the table is charvalue(OP partition,OP class,OP result,OP table) Hence a corresponding program contains the following lines (for the complete version see ex4.c):
Example:If you enter 5 for n and 2 3 for the partition which parametrizes the representation, and 1 2 2 for the partition that parametrizes the conjugacy class of elements, you will see that the program picks the value 1. But please do not forget that this works only if the character table of S_{5} is already available, which holds if you successfully run the program just described above.... scan(INTEGER,n); println(n); chartafel(n,c);println(c); scan(PARTITION,a); println(a); scan(PARTITION,b); println(b); %chartafel(n,c);println(c); charvalue(a,b,d,c);println(d); ...
If you are fed up with that and simply want to get a character table and move it into your manuscript, then you can replace the print command println(c) for the character table by tex(c), and you will get the character table in a form which you can easily change into a LaTeX-readable form that yields, after processing, the following matrix:
1 | 1 | 1 | 1 | 1 | 1 | 1 |
-1 | 0 | -1 | 1 | 0 | 2 | 4 |
0 | -1 | 1 | -1 | 1 | 1 | 5 |
1 | 0 | 0 | 0 | -2 | 0 | 6 |
0 | 1 | -1 | -1 | 1 | -1 | 5 |
-1 | 0 | 1 | 1 | 0 | -2 | 4 |
1 | -1 | -1 | 1 | 1 | -1 | 1 |
Clearly there is also a way directly to evaluate characters. The program system uses the (recursive) Murnaghan-Nakayama Rule or, if the dimension has to be evaluated, the well-known hook formula. This is done by simply replacing the name for the character table by NULL: charvalue(a,b,c,NULL); The evaluation of all the values of a specific character of a symmetric group can be carried out using the following program lines (ex5.c):
Example:The Young character (which is the permutation character on the set of cosets of a Young subgroup corresponding to the partition in question) can be picked from a table of Young characters, or it can be evaluated in a similar fashion:... scan(PARTITION,a); println(a); m_part_sc(a,b);println(b); ...In case you enter the partition 2 3 of 5, the answer is as follows:2 35:0,14:-1,23:1,113:-1,122:1,1112:1,11111:5,
scan(PARTITION,a); println(a); young_character(a,b,NULL); println(b);The scalar product of two characters is calculated by scalarproduct_symchar(OP a,OP b,OP result) Apply this, say, to the Young characters corresponding to the partitions 2 3 and 1 2 2 of 5, and you will get 5 as their scalar product.
The file test.c |