Tutorial



next up previous
Next: A reference Guide Up: User's Guide Previous: User's Guide

Tutorial

The calculator

The Unifpack calculator (called uniflang ) has an interface similar to Maple, you type formulas and commands and they are interpreted immediately by the program. Please keep in mind that uniflang is not a symbolic manipulator, it is just a calculator that knows about groups and fundamental polygons; it can not solve equations or do symbolic manipulation, but can evaluate arithmetic expressions involving integers, reals (floating point), complex numbers, moebius maps, generators, words and groups.

To show the typical use let's start doing some group and polygons calculations, first we invoke uniflang simply by typing its name:

$ uniflang

The > prompt should appear, it means that uniflang is waiting for your input, uniflang uses # as a comment character, all the line after that character is ignored so you can put comments in your code, we use those comments in the next examples, so you don't need to type them down, they are there just as explanations, some of the ouput has been deleted to improve readability, sometimes only one of many options is explained, check the reference manual to find the other options and their description.

Calculating groups and polygons

To calculate a group given from a presentation you just type the presentation, we recommend to save the group in a variable to avoid recomputation

  > G = \< a,b,c:a^4,b^2,c^2,(a*b*c)^2,c*b*a\>;

notice the ``;'' at the end of the line, all uniflang commands must be ended this way. Once you calculate a group it becomes the ``current group'', all group and words operations refer to the current group, but when you write down words in the generators they are interpreted as elements of the free group, they are not elements of the group, you can obtain the corresponding elements on the group and operate with them as in

  #
  # Elements are not printable on this version
  #
  > e = ElementFromWord(G,a*b*c^-1*a);
  > e2 = ElementFromWord(G,c);
  > e3 = e*e2*e^-1;
  > ElementWord(e3);

To create a polygon you have to use a ``built-in function'',

  > P = PolygonFromGroup(G);

polygons are drawn on ``devices'' you must create at least one device to draw anything

  # X windows device, check your local installation, maybe a 
  # better device is available.
  > X11();
  > PolygonDraw(P,Moebius1);

when you create the polygon the set of parameters for it are printed, later you can change those parameters,

  
  > Print(P);
  > PolygonParams(P,Pi/4,Pi/2,Pi/4);

uniflang does not update any changes, you must clear the device and redraw to see any changes

  > DeviceClear(); 
  > PolygonDraw(P,Moebius1);

another useful device is Fig, it creates files in Fig format that can be converted into Encapsulated PostScript, EEPIC, and several other formats, but you need transfig(1) or fig2dev(1). gif

  > Fig("D4.fig");
  > PolygonDraw(P,Moebius1);

to end a uniflang session you just type the command

  > Quit();

Arithmetic

Doing arithmetic on uniflang is simple, you just type expressions and they are evaluated, as in

  > 2+2;
  4
  > 2*3+5;
  11
  > 5.0/2;
  2.5
  > 2^5;
  32

some constants are provided to simplify computations,

  > Pi;
  3.141592653
  > I*I;
  (-1.000,0.000)

valid expressions include adding, multiplying, powers, comparing, and boolean operators.

  > (2+3*I)^2;
  (-5.000,12.000)
  > 5 < 3;
  False
  > False && True;
  False

Expressions may also include calling built-in functions and assignments

  > z = ComplexPolar(2.0,Pi/4);
  (1.414214,1.414214)
  > z+I;
  (1.414214,2.414214)

Relabeling and changing parameters

When a group is calculated each element on it is labeled with a word on the generators such that the word represents the element, you can change those words one by one or ask uniflang to recalculate all the words in a group,

  > D4=\;
  P = \
   The presentation is (g,P)-admisible
  {1 , a , a*a , a*a*a , a*a*a*b , a*b , b , a*a*b}

  #
  # Elements are not printable on this version
  #
  > E=ElementFromWord(D4,c);
  Error: UlPrint - Cannot print that type
 
  Continuing
  > ElementWord(E);
  a*a*a*b
  > ElementChangeLabel(E,c);
  True
  > GroupRelabel(D4);
  True
  > D4;
  P = \
   The presentation is (g,P)-admisible
  {1 , a , a*a , a*a*a , c , a*a*c , a*c , a*a*a*c}

an interesting feature is that the words you change by hand are never changed when Unifpack recalculates words. The label searching algorithm can be changed also,

  > ChangeSearch("SearchBreadth");
  > D4;
  P = \
   The presentation is (g,P)-admisible
  {1 , a , a*a , a*a*a , c , a*a*c , a*c , a*a*a*c}

  > GroupRelabel(D4);
  True
  > D4;
  P = \
   The presentation is (g,P)-admisible
  {1 , a , a*a , c*b , c , a*b , b , c*a}

Once a polygon has been calculated it is interesting to change the parameters offered, the type of the parameters are printed when the polygon is calculated or Print'ed, but their meaning is Polygon dependant and should be documented on the ``Reference Manual'', the values of the parameters can be obtained using PolygonPrintParams,

  > P = PolygonFromGroup(D4);
  PolygonGroup:P = \
   The presentation is (g,P)-admisible
  {1 , a , a*a , a*a*a , a*a*a*b , a*b , b , a*a*b}

  Polygon class name = Cuadr
  Polygon Parameters:
  Parameter: Angle1 of type Real
  Parameter: Angle2 of type Real
  Parameter: Angle3 of type Real

  > PolygonPrintParams(P);
  type = 0 , value = 1.047198
  type = 0 , value = 1.047198
  type = 0 , value = 1.047198

to change the parameters use PolygonParams, you just have to give the new values to each of the parameters,

  > PolygonParams(P,Pi/4,Pi/2,Pi/4);
  > PolygonPrintParams(P);
  type = 0 , value = 0.785398
  type = 0 , value = 1.570796
  type = 0 , value = 0.785398

to see any changes the polygon must be drawn

  > X11();
  > PolygonDraw(P,Moebius1);
  > PolygonParams(P,Pi/3,Pi/3,Pi/3);
  > PolygonDraw(P,Moebius1);

More on devices

Check your local configuration (contact the person who installed Unifpack at your site) to know what device drivers installed, usually Fig and X11 are installed. As shown above the Fig command requires a string as parameter, this is the name of the file were the output is to be generated.

Sometimes you will have to clear the screen use DeviceClear to delete any graphics already drawn, if for any reason part of the image is lost the function DeviceRefresh redraws the lost parts.

More on groups

If the presentation is -admisible it is possible to determine the genus of the Riemann surface admitting the prescribed group (with the given presentation)

  > C=\;

  > GroupGenus(C);
  5
  > G24 = \;

  > GroupGenus(G24);
  2

the order of the group can be obtained too

  > GroupOrder(C);
  24
  > GroupOrder(G24);
  24

sometimes it is desirable to iterate trough the elements of the group (see below the section on flow control), a simple way to obtain each element is

  > i = 0;
  0
  > while( i < GroupOrder(G24) ) { 
      Print(ElementWord(GroupElement(G24,i))); 
      Print(ElementOrder(GroupElement(G24,i))); 
      i = i+1; 
    };

Since generators of different groups can have the same name, word's are interpreted using the ``current group'', usually this is the last group calculated, but sometimes it may be necessary to change it explicitely using WithGroup.

Side pairings

Warning: The functions described on this section are under test, they seem to work OK, but some changes may be needed in the future

Once the fundamental polygon has been calculated it is interesting to determine the side pairings and the maps that pair those sides, some output has been deleted.

  > W = \;
  > P = PolygonFromGroup(W);
  > X11();
  # Draw the side pairings in the current device
  > PolygonDrawSides(P,Moebius1);

The side pairings induce a (probably new) presentation for the group, the presentation obtained may repeat some relations, but it can be hand edited later

  > D4=\;
  P = \
   The presentation is (g,P)-admisible
  {1 , a , a*a , a*a*a , a*a*a*b , a*b , b , a*a*b}

  > P4 = PolygonFromGroup(D4);
  PolygonGroup:P = \
   The presentation is (g,P)-admisible
  {1 , a , a*a , a*a*a , a*a*a*b , a*b , b , a*a*b}

  Polygon class name = Cuadr
  Polygon Parameters:
  Parameter: Angle1 of type Real
  Parameter: Angle2 of type Real
  Parameter: Angle3 of type Real

  > PolygonPresentation(P4);
  \

Caution: when you change the group labeling the sides, the side pairings and the presentation change too, you must recalculate them if any label is changed.

Moebius maps

Many times we have used the constant Moebius1, it represents the moebius identity, other moebius maps can be created either using the functions provided or multiplying several of them

MoebiusFromZ0 creates a moebius map of the form

or

as in

    > z0 = (1+I)/4;
    (0.250000,0.250000)
    > t = MoebiusFromZ0(0.0,z0,False);
    Conj = False , a = (1.000000,0.000000) , c = (-0.250000,0.250000)

conjugacy is controlled by the last parameter, using moebius maps is simple,

    > t2 = MoebiusFromZ0(Pi/2,0,False);
    Conj = False , a = (0.707107,0.707107) , c = (0.000000,0.000000)
    > t3 = t*t2;
    Conj = False , a = (0.707107,0.707107) , c = (-0.353553,0.000000)
    > tc = MoebiusFromZ0(0,0,True);
    Conj = True , a = (1.000000,0.000000) , c = (0.000000,0.000000)
    > tc*z0;
    (0.250000,-0.250000)
    > t3*z0;
    (-0.492308,-0.061538)

Flow control

Advance users may want to write small scripts for uniflang , some flow control is provided for them so simple programs or animations may be written, while and if else are the only ones provided so far, in the future do while, for and list iteration may be added.

The following example should let it clear, the output has been deleted

  > G=\;
  > P=PolygonFromGroup(G);

  > D4=\;
  > PD4=PolygonFromGroup(D4);

  > X11();

  > PolygonDraw(PD4,Moebius1); Pause(5);

  > i=0;
  > while(i < GroupOrder(G) ) {
      w = ElementWord(GroupElement(G,i));
      DeviceClear(); PolygonDraw(PD4,Moebius1); 
      PolygonDrawOne(P,w,R); Pause(1);
      Print(w);
      i = i+1;
    };
  >

Using the programs

Unifpack provides several programs that experienced users may find useful, this programs let you calculate groups and polygons, printing and/or viewing this polygons, this can be done with uniflang too, but the programs provided are much faster in some cases.

Let start with a file called D4.prs which contains the following line:

\< a,b,c:a^4,b^2,c^2,(a*b*c)^2,c*b*a\>
let us call the group corresponding to this presentation, the command:
$ prs2grp -i D4.prs -o D4.grp
creates a new file (called D4.grp) which contains the Cayley graph of ; next the command
$ grp2uni -i D4.grp -o D4.uni
creates a new file (D4.uni) which contains the polygon corresponding to the previous group and presentation, you can later load this polygon into uniflang using the (uniflang ) command:
 > P = LoadPolygon("D4.uni");
you can view the polygon using the uni2dev command, it let you use several devices which depend on your system and architecture, uni2dev manual page describes some of the devices and their options. As examples we create a Fig file
$ uni2dev -i D4.uni -d Fig -o "D4.fig"
and preview it under X Windows
$ uni2dev -i D4.uni -d X11



next up previous
Next: A reference Guide Up: User's Guide Previous: User's Guide



coryan@mat.puc.cl