HoriAsso - Documentation: Difference between revisions
Line 13: | Line 13: | ||
Note: This will be archived once the package is more complete. |
Note: This will be archived once the package is more complete. |
||
===Demo Mathematica NoteBook=== |
===Demo ''Mathematica'' NoteBook=== |
||
A Mathematica notebook named '''''HoriAssoFLnSpaceDemo.nb''''' to demonstrate the usage of this Free Lie Algebra package |
A ''Mathematica'' notebook file named '''''HoriAssoFLnSpaceDemo.nb''''' to demonstrate the usage of this Free Lie Algebra package is included in the '''''FreeLieAlgebra''''' folder that you just downloaded from the [http://katlas.math.toronto.edu/svn/HoriAsso/trunk/FreeLieAlgebra repository]. After installation (as above), simple open the notebook in ''Mathematica'', follow the simple initialization steps below, (i.e., modifying path names and parameters in the demo file), and evaluate the cells as you wish. |
||
===Usage=== |
===Usage=== |
Revision as of 17:57, 15 August 2006
Installation and Setup for using Java in Mathematica
Installation
Please download the FreeLieAlgebra folder from our repository. This folder includes the compiled Java Class files, and the Mathematica/Java interface HoriAssoInterface.m; otherwise, if you are online during the Mathematica session, enter the path to the repository during the initialization steps according to the section Necessary Initialization Stepsbelow.
Note: This will be archived once the package is more complete.
Demo Mathematica NoteBook
A Mathematica notebook file named HoriAssoFLnSpaceDemo.nb to demonstrate the usage of this Free Lie Algebra package is included in the FreeLieAlgebra folder that you just downloaded from the repository. After installation (as above), simple open the notebook in Mathematica, follow the simple initialization steps below, (i.e., modifying path names and parameters in the demo file), and evaluate the cells as you wish.
Usage
The HoriAsso Mathematica interface is set up to do computations only in Free Lie algebra with 1,2, and 3 generators, named FL2, FL3, FL4 respectively (the suffix is the number of generators +1). You could do computations in Free Lie Algebras with more generators if you used the Java classes directly.
Necessary Initialization Steps
1.In a Mathematica session, load the Java/Mathematica interface by:
In[1]:=
|
<<"/path_to_interface_folder/HoriAssoInterface.m"
|
where "path_to_interface_folder" is the folder containing the downloaded HoriAssoInterface.m file or simply the "Source" folder of this project's repository.
2(Optional). For faster and bigger calculations, reinstall the Java runtime with the option to use as much memory as designated:
In[1]:=
|
ReinstallJava[CommandLine -> "path_to_Java -Xmx800M"
|
where 800M in the last argument can be replaced by your choice of maximum memory to use according to your computer specs.
3. Let Mathematica know where to look for the necessary Java class files:
In[1]:=
|
SetHoriAssoPath["/path_to_Java_Class_folder"];
|
where "path_to_Java_Class_folder" contains the downloaded Java Class files, or simply the path to the "Source" folder in our repository.
4. Create the Lyndon bases for all three Free Lie Algebras with 1, 2, and 3 generators respectively by:
In[1]:=
|
InitializeHoriAssoSpace[12];
|
or Create the Lyndon basis separately for the different Free Lie Algebras by:
In[1]:=
|
CreateFL2Basis[any_number];
|
In[1]:=
|
CreateFL3Basis[any_num_<=_20];
|
In[1]:=
|
CreateFL4Basis[any_num_<=_14_(12_is_safe)];
|
where the argument controls up to what word length the Lyndon bases will contain elements of. Please read the "Algebraic operations" section below for its effect.
Performance Note: For the default java runtime on a computer with 1G RAM, 12 as the maximum word length in "InitializeHoriAssoSpace" or "CreateFL4Basis" seems to be quite safe. You can choose up to 14 if you have chosen to run Java with 800M memory in Step 2.
To check the dimension of the Free Lie Algebras at a given length (less than the maximum word length used in creating the basis):
In[3]:=
|
GetFLnDimension[4,14]
|
Out[3]=
|
341484
|
where the first argument is n in FLn, i.e., the number of generators + 1, and the second is the wordlength at which the basis dimension is returned.
Notation
Any Free Lie Algebra element is a linear combination of Lie-trees, which are nested Lie Brackets of the generators, e.g. [a,[[a,b],[a,c]]] where the square brackets are the Lie Brackets.
In the HoriAsso setup: 1. Letters starting with lower case "a" are used as generators, i.e., a Lie tree in Free Lie Algebra with 3 generators (FL4) will/should contain only a's, b's, and/or c's.
2. Only two tree structures are used and allowed, the right Comb, and the Lyndon Word.
Right-Combs represent the tree structure [a,[a,[a,[a,[a,[a,[a,[a...[a,b]]]]]]]]]... is represented in our setup, for example, as
In[2]:=
|
RCombExample=RComb[a,a,a,a,a,a,a,a,...a,b]
|
Lyndon Words are words that are smaller by alphabetical order than any of its right subwords. Since they are Hall Words, and each word implies a unique tree structure. They are represented, for example, as
In[2]:=
|
LyndonWordExample=LW[a,a,b,a,b,a,b,a,b]
|
You can check to see if a word satisfies the definition of a Lyndon Word:
In[3]:=
|
IsLyndon[LW[a,b,a]
|
Out[3]=
|
False
|
Note: In Java, you could replace the left or right subtree of a Lie tree by any tree, giving structures that are neither Right-Combs or Lyndon. However, the interface assumes that if it is not a Lyndon Word, it would be a Right Comb; using those Java methods (namely javatree@setLeft(or right)Subtree(new_left(or_right)_subtree)) directly in Mathematica will cause errors in calculations.
3, Free Lie Algebra elements are represented as a linear combination of Lyndon Words (LW) and Right-Combs (RComb) with an enveloping head FLn, where n is the number of generators + 1, e.g.:
In[2]:=
|
LieAlgebraElementExample=FL3[LW[a,a,b,a,b,a,b,a,b]+3RComb[a,b,a]]
|
Algebraic Operation
1. Scalar multiplication and Addition
You could form either linear combinations of words (RComb and LW) as you would with other Mathematica expressions, or form the linear combinations and give them context by putting them under the head of FL2, FL3, FL4. The difference is that in the first case, the sum is simply formal and is the original Mathematica plus, times function, whereas in the case with the FL2(or 3 or 4) heads do the sum in the Lyndon basis.
At the moment the coefficients for the FLn elements need to be Integers. This will be replaced with rational numbers soon.
Sum of Linear combination of WordS:
In[3]:=
|
LinCombOfWords = 2 RComb[a, b, a, b] + LW[a, b, b, a, b, b, b] - 4LW[a, b, a, b, a, b, b] - RComb[a, b, a, b] + LW[a, b, b, a, b, b, b]
|
Out[3]=
|
-4 LW[a, b, a, b, a, b, b] + 2 LW[a, b, b, a, b, b, b] + RComb[a, b, a, b]
|
Sum of Free Lie Algebra elements (a linear combination of words wraps around
In[3]:=
|
SumOfFL3Elements = FL3[ -4 LW[a, b, a, b,
a, b, b]] + FL3[2LW[a, b, b, a, b, b, b]+RComb[a, b, a, b]]
|
Out[3]=
|
FL3[-LW[a, a, b, b] - 4 LW[a, b, a, b, a, b, b] + 2 LW[a, b, b, a, b, b, b]]
|
Note that the FLn elements itself is not automatically reduce to the Lyndon basis form, but a sum of the FLn elements is.
2. Reduce to linear combination of Lyndon basis elements
You could reduce a single word (RComb and LW) or a Free Lie Algebra elements into a linear combination of Lyndon basis elements.
For reducing a word to Lyndon form, the word length is only limited by performance. For a good size example:
In[3]:=
|
ReduceToLyndon[RComb[a, b, b, a, a, b, a, b, a, b, b, a, b]]
|
Out[3]=
|
LW[a, a, a, a, a, a, b, b, b, b, b, b, b] + 4 LW[a, a, a, a, a, b, a, b, b, b,
|
For reducing an FLn element to Lyndon form, the word length has to be smaller than the maximum word length specified in "iniatializeHoriAssoSpace(maxWordLength)":
In[4]:=
|
ReduceToLyndon[FL3[LW[a, a, b, a, b] + 4RComb[a, b, a, b, a, b, a]]]
|
Out[4]=
|
FL3[LW[a, a, b, a, b] - 4 LW[a, a, a, a, b, b,
|
Note: the two notations will probably merge.
4, Lie Brackets
Finally, you could compute the Lie bracket of two individual words (RComb and/or LW) or two Free Lie Algebra elements (FL2,3,4 elements), the results of which are reduced into the Linear combinations of lyndon words already:
In[4]:=
|
Bracket[RComb[a, b, b, a], RComb[b, a, a, b, a]]
|
Out[4]=
|
-LW[a, a, a, b, b, a, a, b, b] + LW[a, a, b, a, b, a, a, b, b]</nowiki>
|
In[4]:=
|
Bracket[FL4[LW[a, b, c, a, c] + 2RComb[a, b, c, b]], FL4[-2RComb[a, b, b, c, a, b] + 4RComb[b, a, c]]]
|
Out[4]=
|
FL4[8 LW[a, b, b, c, a, c, b] - 4 LW[a, b, c, a, c, a, c, b] -
|