A Lie algebra homomorphism $M \ \to\ L$ is defined using map(LieAlgebra,LieAlgebra,List) by giving the values in $L$ of the generators of $M$. A homomorphism preserves weight and sign, and M#Field must be the same as L#Field.




Like the situation for ring maps, the meaning of map(L,M) is that a generator in $M$ is sent to the generator in $L$ with the same name, weight and sign if there is such a generator, otherwise it is sent to zero.




Another similarity with ring maps is that a map $M \ \to\ L$ need not be well defined, in the sense that the relations in $M$ need not be sent to zero in $L$. It may also happen that the map does not commute with the differentials in $M$ and $L$. All this can be checked up to a certain degree using isWellDefined(ZZ,LieAlgebraMap). If $M$ is finitely presented, see Quotient Lie algebras and subspaces, then it is possible to get the information that the map is well defined and commutes with the differentials for all degrees, if the first input $n$ in isWellDefined(n,f) is big enough.








Surjectivity for a Lie algebra map may be tested using isSurjective(LieAlgebraMap). The input map might not be well defined. The method function isIsomorphism(LieAlgebraMap) may be used to test if a Lie algebra map $f: M \ \to\ L$ is an isomorphism. Here $M$ and $L$ must be equal, but not necessarily identical. Also, $M$ must be finitely presented. It is tested that the map is well defined, commutes with the differentials and is surjective. Injectivity follows from this by dimension reasons. See Holonomy Lie algebras and symmetries for applications where the map is a permutation of the variables.







A derivation $d: M \ \to\ L$ is defined using lieDerivation by giving a Lie algebra map $f: M \ \to\ L$ and a list of elements in $L$ that are the values of $d$ on the generators of $M$. One may use isWellDefined(ZZ,LieDerivation) to test if a derivation is well defined, which means that the relations in $M$ are sent to zero (the derivation need not commute with the differentials).







Omitting the first input in lieDerivation gives derivations $d: L \ \to\ L$ with the identity map on $L$ as the defining map.
The following example shows a way to determine the derivations of a Lie algebra studied by David Anick, which may be seen as the positive part of the twisted loop algebra on sl_2. This also explains the periodic behaviour of the Lie algebra.


The space of derivations of degree 0 is 2dimensional, and contains the Euler derivation, see euler(LieAlgebra), which is the identity in degree 1.


We will now prove that the space of derivations of degree 6 is 2dimensional. The space of linear maps from degree 1 to degree 7 is 4dimensional. Not all of them define derivations.









The output displayed above shows that da61 and db62 are derivations. To determine whether a linear combination of db61 and da62 is well defined (i.e., maps the relations in $L$ to zero), we consider derivations from the free Lie algebra $M$ on $a,b$ to $L$.








It follows from the output displayed above that the only linear combination of dMb61 and dMa62 that is zero on (a a a b) is a multiple of dMb61, but we have seen that dMb61 is not a derivation on $L$. Hence, the space of derivations of degree 6 is 2dimensional. Also, da61 + db62 is the inner derivation corresponding to right multiplication with the basis element of degree 6, (b a b a b a). This is seen by using innerDerivation.


Since the dimension of the Lie algebra in degree 8 is 1, the dimension of the space of derivations of degree 7 is at most 2.






It follows from the output displayed above that the space of derivations of degree 7 is also 2dimensional, but consists only of inner derivations. The conclusion is that the space of derivations of $L$ of positive degree modulo the inner derivations is 1dimensional in all even degrees, and 0 in all odd degrees. We may also use LieDerivation LieDerivation to examine the structure of this quotient Lie algebra.



Define $dn$ ($n\ \ge\ 2$, $n$ even) as the derivation which maps $a$ to (a b a b ... a) of length $n+1$ and $b$ to 0. It follows from the output displayed above that [ $d2$, $d4$ ] = $d6$.




It follows from the output displayed above that [ $d2$, $d6$ ] = $2d8$ and [ $d2$, $d16$ ] = $7d18$. In fact, this Lie algebra is the infinite dimensional filiform Lie algebra, which is the Witt algebra in positive degrees (with a degree doubling).