(**:Title: Bryant Surfaces and integral Representation - Formulas **)
(** Copyright 2003 Hubert Gollek **)
(** Version of Oktober 5, 2003 **)

(**:Keywords:
	Constant mean curvature 1 Surfaces in H^3,
	graphics tools,
	differential invariants of null curves in Sl(2,C),
	natural parametrization,
	algebraic representation formulas**)
(**:Requirements: none. **)
(**:Warnings: Some commands are thought for former and future developing. So it's
	meaning might not become clear to other users. Other commands deserve improvements
	(for instance nullcurveToBallmodel[nullcurve][u, v] and
	nullcurveToUpperhalfSpace[nullcurve][u, v] are to slow even for simple nullcurves.**)

	(************************************************************
	Summary: According to R. Bryant, constant mean curvature (CMC-1) surfaces in
	hyperbolic space H^3 are related to null curves in SL(2,C), i.e., to holomorphic
	curves FF:z\in C---> FF[z_]={{a11[z],a12[z]},{a21[z],a22[z]}}\in Sl(2,C), so called
	Bryantframes, i.e., FF[z] has determinant=1 and solves the linear system
	(x) 	FF'[z]=FF[z].{{g[z],-g[z]^2},{1,-g[z]}}*om[z],
	where g[z] is a holomorphic function and omega[z] a  holomorphic 1-form. Similar to
	minimal curves in complex space, null curves in SL(2,C) are characterised by the fact,
	that their tangent vector has length = 0 with respect to the invariant complex Riemannian
	metric g(X,Y) induced on SL(2,C) by 1/8 of the Killing form of sL(2,C).


	The package provides among others 

	(i) A modification of Bryant's formula obtained by the reduction procedure for
	systems of linear differential equations (due to D'Alembert) that leads to
	an integral representation formula {a[z],b[z]} --> Sl2CFrameModified[a,b][z]
	for null curves.
	
	(ia) A double sequence of invariant algebraic representation formulas
	{f[z],h[z]} --> Sl2CFrameMeromorphic[n,k][f, h][z] (n-1>k>1, n=3,4,5,6,...)
	for null curves defined on Riemann surfaces derived from  formula together with
	the (integral) formula for the inverse. 

	(ib) The invariant algebraic representation formula for null curves that was
	found by A. J. Small ('Surfaces of constant mean
        curvature 1 in H^3 and algebraic curves on a quadric',
        Proc. AMS, vol 122, No. 4, (1994), 1211- 1220).)
        Later on it turned out that the surface analogue was already known to L. Bianchi
        and his students.(see Levi L. de Lima; Pedro Roitman;
	Constant mean curvature one surfaces in hyperbolic 3-space using the 
	Bianchi - Cal\`{o} method, Anais de Academia Brasileira de Ci\^{e}ncias
	(2002) 74(1), 19-24 or R. Bryant's homepage)
               
	(ii) plotting facilities together with transformations between the various models
	(Lorentzian-, Hermitian-, ball-, upperhalfspace model) of hyperbolic 3-space
	for the parametrized surfaces for the  CMC-1 surfaces
	obtained from Bryant's formula. Moreover, programs to

	(iii) compute the invariants of null curves,
	
	(iv) the Levi civita connection and covariant derivative of the invariant
	complex Riemannian metric g(X,Y) on Sl(2,C),
	
	(v) invariants such as 1-st and 2-nd fundamentalform, Gaussian and mean curvature 
	of surfaces in H^3,
	
	+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	Remark (for personal use, in german) concerning the reduction procedure of d'Alembert

	Die Differentialgleichung für die Sl(2,C)-Bryantframes ist das lineare System
	(1)			F'[z]=F[z]*X[z],
	wobei X die von zwei Funktionen g[z] und omega[z] abhängende Matrix
	nilpotentsl2MatrixBasic[g,omega][z] ist. Wir betrachten nur die erste Zeile {a[z],b[z]},
	nehmen a[z],b[z] als Eingangsgröße und bestimmen aus diesen g[z] und omega[z].


	Dann erfüllen a[z] und b[z] das Differentialgleichungssystem (1),
	wenn g[z] und omega[z] so gesetzt werden,
	wie oben errechnet und mit basicFunctionG[a,b][z] und
	basicFunctionOmega[a,b][z] explizit angegeben.
	Wie erhält man alle Lösungen??


	Das geht mit dem Reduktionsverfahren von D'Alembert
	(siehe R. Walter, Gewöhnliche Differentialgleichungen (SK520), Seite 113)
	Ein Fundamentalsystem erhält man durch Integration.
	++++++++++++++++++++++++++++++++++++++++++++++++++
	************************************************************)

Off[Remove::"rmnsm"]

Unprotect["CMCSurfaces`*"];

Remove["CMCSurfaces`*"];


BeginPackage["CMCSurfaces`"]


(***************** Start of usages. ***************)
directPlotUpperhalfSpace::usage="directPlotUpperhalfSpace[nullcurve][u0,u1,v0,v1,pu,pv,options]
	generates the graphics of the CMC-surface in the upper half space model of the
	hyperbolic space corresponding to the given nullcurve. The command is thought to avoid
	time consuming algebraic conversions by generating immediately the numerical values
	of the vertices of the polygons to be drawn.
	The parameter regions are determined by u0<u<u1 and v0<v<v1 and pu, pv are
	the numbers of plot points. Plot options can be assigned with 'options'."

directPlotUpperhalfSpacePolar::usage="
	directPlotUpperhalfSpacePolar[nullcurve][r0,r1,phi0,phi1,pr,pphi,options]
	is similar to  as directPlotUpperhalfSpace[nullcurve][u0,u1,v0,v1,pu,pv,options] but uses
	polar coordinates z=r*Exp[I*phi] instead cartesian coordinates z=u+I*v."

directPlotBallmodel::usage="directPlotBallmodel[nullcurve][u0,u1,v0,v1,pu,pv,options]
	generates the graphics of the CMC-surface in the Poincare (ball) model of the
	hyperbolic space corresponding to the given nullcurve. The command is thought to avoid
	time consuming algebraic conversions by generating immediately the numerical values
	of the vertices of the polygons to be drawn.
	The parameter regions are determined by u0<u<u1 and v0<v<v1 and pu, pv are
	the numbers of plot points. Plot options can be assigned with 'options'."

directPlotBallmodelDisplay::usage="directPlotBallmodelDisplay[nullcurve][u0,u1,v0,v1,pu,pv,options]
	is the same as directPlotBallmodel, but the option  DisplayFunction->Identity is automatic."


directPlotBallmodelPolar::usage="directPlotBallmodelPolar[nullcurve][r0,r1,phi0,phi1,pr,pphi,options]
	is similar to directPlotBallmodel[nullcurve][u0,u1,v0,v1,pu,pv,options] but uses
	polar coordinates z=r*Exp[I*phi] instead cartesian coordinates z=u+I*v."

directPlotBallmodelPolarDisplay::usage="directPlotBallmodelPolarDisplay[nullcurve][u0,u1,v0,v1,pu,pv,options]
	is the same as directPlotBallmodelPolar, but the option  DisplayFunction->Identity is automatic."


gridToball::usage="gridToball[om1,om2,temp][gridpoint,z] gives the coordinates of a point
	of the cmc-surface corresponding to a null curve and given parameter value
	'gridpoint' in the ball model. The idea is to avoid huge algebraic expressions
	of the parametrization and time consuming numerical evaluation of the values of
	Weierstraßfunction, computing the numerical value WeierstrassP[gridpoint,{g2,g3}]
	at first and transforming the corresponding Sl(2,C)-matrix to the corresponding
	point in the ball."

gitter::usage="The integers pu, pv give the number of plot points and
	gitter[om1,om2,nullcurve][pu,pv] generates the set of (pu+1)x(pv+1)
	vertices of the polygons of the plot of the cmc-surface corresponding to
	the fundamental parallelogram in C determined by the periods om1, om2 of the
	Weierstraßfunction under consideration. At the poles 0,om1,om2,om1+om2 of
	WeierstrassP[z,{g2,g3}],{g2,g3} = the WeierstrassInvariants of
	om1,om2, we assign a formal value 'IdentityMatrix[2]//matrixToballmodel'."

verzerrung::usage="verzerrung[viereck] assumes that 'viereck' is a quadrangle
	(graphics object)  of the form Graphics3D[Polygon[{p1, p2, p3, p4}]]
	and returns a pair {m,s} of real numbers, where m the mean value
	of all lengths of all edges and diagonals and s = dispersion of this set
	of 6 numbers divided by m. It gives two measures that can be used to
	select distorted or oversized quadrilaterals from a plot."

weiPCcurveBallModelverzerrung::usage="
	weiPCcurveBallModelverzerrung[om1,om2,nullcurve][dist,pu,pv] returns a 2x2 matrix
	whose entries contain the maximal (resp. minimal) distortion  (resp. extent)
	of the polygons of the surface plot corresponding to nullcurve[z] under
	the operations gg=gitter[om1,om2,nullcurve][pu,pv] and gg --> polygons[gg, dist]."

Sl2CFrameMeromorphicCPP::usage = "{f,cpp} --->Sl2CFrameMeromorphicCPP[f,cpp][c1,c2,c3][z]
	is an integral representation formula that assigns to two functions f[z] and cpp[z]
	a null curve in Sl(2,C) such that the derivative of the natural parameter is
	Sqrt[cpp[z]]. The Hopf differential of the corresponding cmc-surface is cpp[z].
	The numbers c1,c2,c3 are constants of integration and
	Sl2CFrameMeromorphicCPP[f,cpp][z] is Sl2CFrameMeromorphicCPP[f,cpp][0,0,1][z]."

Sl2CFrameMeromorphicCPPExp::usage = "{f,cpp} --->Sl2CFrameMeromorphicCPPExp[f,cpp][z] is
	Sl2CFrameMeromorphicCPP[Exp[f[#]]&,cpp][0,0,1][z].Type\n
	Sl2CFrameMeromorphicCPP[Exp[f[#]]&,cpp][0,0,1][z]-Sl2CFrameMeromorphicCPPExp[f,cpp][z]//Simplify\n
	to convince yourself."

Sl2CFrameModifiedCPP::usage = "{f,cpp} ---> Sl2CFrameModifiedCPP[a,cpp][c1,c2][z] is an integral
	representation formula that assigns to two functions f[z] and cpp[z] a null curve in Sl(2,C)
	whose natural parameter is the root Sqrt[cpp[z]] of the given function cpp[z]. The Hopf
	differential of the corresponding cmc-surface is the square of cpp[z]. The numbers c1 and c2
	are constants of integration and Sl2CFrameMeromorphicCPP[f,cpp][z] is
	Sl2CFrameMeromorphicCPP[f,cpp][1,0][z]."

funHforprescribedCPP::usage="funHforprescribedCPP[f,cpp][c1,c2,c3][z] -
	an auxiliary command for 'Sl2CFrameMeromorphicCPP'."

funHforprescribedCPPInvers::usage="funHforprescribedCPPInvers[f,hh][c1,c2,c3][z] -
	an auxiliary command for 'Sl2CFrameMeromorphicCPPInvers'."

Sl2CFrameMeromorphicCPPInvers1::usage="Sl2CFrameMeromorphicCPPInvers1[nullcurve_][c1_,c2_,c3_][z_]:=
	Sl2CFrameMeromorphicInvers1[nullcurve][z] gives the first component f[z] of the
	inverse operator of {f,cpp}--->Sl2CFrameMeromorphicCPP[f,cpp][c1,c2,c3][z].";

Sl2CFrameMeromorphicCPPInvers2::usage="Sl2CFrameMeromorphicCPPInvers2[nullcurve][c1,c2,c3][z]
	gives the second component cpp[z] of the inverse operator of
	{f,cpp} --->Sl2CFrameMeromorphicCPP[f,cpp][c1,c2,c3][z].";

Sl2CFrameMeromorphicCPPInvers::usage="Sl2CFrameMeromorphicCPPInvers[nullcurve][c1,c2,c3][z]
	is a left inverse operator of {f,cpp} --->Sl2CFrameMeromorphicCPP[f,cpp][c1,c2,c3][z].";

nullcurveCanParameterPrime::usage="nullcurveCanParameterPrime[nullcurve_][z_]:=
	cmcCPPKAN[nullcurveToModifiedData1[ff],nullcurveToModifiedData2[ff]][z] is the
	square of the derivative of the natural parameter of a null curve ff[z] in Sl(2,C).
	Note: The natural parameter of a null curve ff[z] is defined as
	the 4-th root of the scalar product of the second covariant derivative of ff[z] with itself.
	nullcurveCanParameterPrime[nullcurve][z] gives only the 2-nd root of this.
	For a simple check type for instance:\n
	Clear[ff,cc,ccp,ccpp];ff[z_]=BianchiCaloSmallDouble[Exp[#]&,#^n&][z]\n
	cc[z_]=Sl2CIwasawaParInvers[ff[z]][[1]]\n
	ccp[z_]=cc'[z]//Simplify\n
	ccpp[z_]=covDerofVectorfieldKANalongCurve[cc,ccp][z]//Simplify\n
	invariantmetricKAN[cc[z]][ccp[z]][ccp[z]]//Simplify\n
	invariantmetricKAN[cc[z]][ccpp[z]][ccpp[z]]//Simplify\n
	cmcCPPKAN[nullcurveToModifiedData1[ff],nullcurveToModifiedData2[ff]][z]."

nullcurveCurvature::usage="nullcurveCurvature[gamma_][z_]:=
	cmcKappaKAN[nullcurveToModifiedData1[gamma],nullcurveToModifiedData2[gamma]][z]//Simplify
	is the second differential invariant, called here Sl(2,C) null curve curvature,
	of an arbitrary null curve gamma[z] in Sl(2,C).
	In some sense a complex analogue of the curvature of a curve in a 3-dimensional
	Riemannian manifold."

nullcurveCheck::usage = "nullcurveCheck[ff][z] expects a square matrix ff[z]
	(in general an Sl(2,C)-matrix) of functions as input and returns
	the determinant of its Maurer-Cartan-derivative, which should be 0 for a null curve."

ballmodelPlot::usage="ballmodelPlot[nullcurve_][u0,u1,v0,v1,pu,pv,options] plots the
	ball model version of the CMC-surface x[u,v] corresponding to the null curve
	nullcurve[z] in Sl(2,C) in conformal parametrization. The ranges of u and v
	are given by u0 < u1 resp v0 < v1, while pu, pv give the number of plot points.
	Options of Graphics3D can be used. The command avoids to determine an explicit
	parametrization of x[u,v] and uses the numerical values of nullcurve[ui+I*vj]
	at the corresponding grid points (ui,vj)."

ballmodelPlotPolar::usage="ballmodelPlotPolar[nullcurve_][u0,u1,v0,v1,pu,pv,options]
	plots the ball model version of the CMC-surface x[u,v] corresponding to the
	null curve nullcurve[z] in Sl(2,C) in polar coordinates. The ranges of u and v
	are given by u0 < u1 resp v0 < v1, while pu, pv give the number of plot points.
	Options of Graphics3D can be used. The command avoids to determine an explicit
	parametrization of x[u,v] and uses the numerical values of
	nullcurve[ui*Exp[I*vj]] at the corresponding grid points (ui,vj)."

upperHalfspacePlot::usage="upperHalfspacePlot[nullcurve_][u0,u1,v0,v1,pu,pv,options]
	plots the upper half space version of the CMC-surface x[u,v] corresponding
	to the null curve nullcurve[z] in Sl(2,C) in conformal parametrization. The
	ranges of u and v are given by u0 < u1 resp v0 < v1, while pu, pv give the
	number of plot points. Options of Graphics3D can be used. The command avoids
	to determine an explicit parametrization of x[u,v] and uses the numerical
	values of nullcurve[ui+I*vj] at the corresponding grid points (ui,vj)."

upperHalfspacePlotPolar::usage="upperHalfspacePlotPolar[nc][u0,u1,v0,v1,pu,pv,options]
	plots the upper half space version of the CMC-surface x[u,v] corresponding to
	the null curve nc[z] in Sl(2,C) in polar coordinates. The ranges of u and v
	are given by u0 < u1 resp v0 < v1, while pu, pv give the numer of plot points.
	Options of Graphics3D can be used. The command avoids to determine an explicit
	parametrization of x[u,v] and uses the numerical values of nc[ui*Exp[I*vj]]
	at the corresponding grid points (ui,vj)."

Sl2CFrameMeromorphic::usage="Sl2CFrameMeromorphic[n,k][f,h][z] is a double sequence of
algebraic representation formulas for null curves in Sl(2,C). The arguments n,k are integers
with n-1>k>0, while f[z] and h[z] are meromorphic functions. In the global setting,
f[z] is a meromorphic function and h[z] a meromorphic vector field on a Riemann surface.
The differential operator (f,h)-->Sl2CFrameMeromorphic[n,k][f,h][z] can be inverted.
Sl2CFrameMeromorphic[f,h][z] is Sl2CFrameMeromorphic[3,1][f,h][z] - the first, simplest,
and most important member of the whole sequence,"

Sl2CFrameMeromorphicInvers1::usage="matrix[z] --> Sl2CFrameMeromorphicInvers1[n,k][matrix][z]
is the first component f[z] of the inverse of the operator
(f,h)-->Sl2CFrameMeromorphic[n,k][f,h][z]. The argument matrix[z] must be an Sl(2,C)-matrix
of meromorphic functions. Sl2CFrameMeromorphicInvers1[matrix][z] is
Sl2CFrameMeromorphicInvers1[3,1][matrix][z]. Integrations do not occur in this command."

Sl2CFrameMeromorphicInvers2::usage="matrix --> Sl2CFrameMeromorphicInvers2[n,k][matrix][z]
is the second component h[z] of the inverse of the operator
(f,h)-->Sl2CFrameMeromorphic[n,k][f,h][z]. The argument matrix[z] must be an Sl(2,C)-matrix of
meromorphic functions. Sl2CFrameMeromorphicInvers2[matrix][z] is
Sl2CFrameMeromorphicInvers2[3,1][matrix][z]. Constants of integration are set to 0."

Sl2CFrameMeromorphicInverswithConstants1::usage="
Sl2CFrameMeromorphicInverswithConstants[n,k][matrix][z] does not exist."

Sl2CFrameMeromorphicInverswithConstants2::usage="
matrix --> Sl2CFrameMeromorphicInverswithConstants2[n,k][matrix][z] is almost the same as
matrix --> Sl2CFrameMeromorphicInvers2[n,k][matrix][z], but displaying the constants of
integration. Sl2CFrameMeromorphicInverswithConstants2[matrix][z] is the case n=3, k=1.";

Sl2CFrameMeromorphicInvers::usage="matrix --> Sl2CFrameMeromorphicInvers[n,k][matrix][z]
is the inverse of the operator
(f,h)-->Sl2CFrameMeromorphic[n,k][f,h][z]. The argument matrix[z] must be an Sl(2,C)-matrix of
meromorphic functions. Sl2CFrameMeromorphicInvers[f,h][z] is the case n=3, k=1.
Constants of integration are set to 0."

Sl2CFrameMeromorphicInverswithConstants::usage="
matrix --> Sl2CFrameMeromorphicInverswithConstants[n,k][matrix][z] is almost the same as
matrix --> Sl2CFrameMeromorphicInvers[n,k][matrix][z], but displaying the constants of
integration. Sl2CFrameMeromorphicInverswithConstants[matrix][z] is the case n=3, k=1.";

Sl2CFrameMeromorphicToSl2CModified1::usage="Sl2CFrameMeromorphicToSl2CModified1[m][z]
is the first component u[z] of Sl2CFrameMeromorphicToSl2CModified1[m][z]." ;

Sl2CFrameMeromorphicToSl2CModified2::usage="Sl2CFrameMeromorphicToSl2CModified2[n,k][m][z]
is the second component b[z] of Sl2CFrameMeromorphicToSl2CModified1[m][z]." ;

Sl2CFrameMeromorphicToSl2CModified::usage="m[z] --> Sl2CFrameMeromorphicToSl2CModified[m][z],
where m[z] is an Sl(2,C)-matrix, gives the pair {u[z],b[z]} of meromorphic functions such
that m[z]=dd.Sl2CFrameModified[u,b][z].dd, where dd={{1,0},{0,-1}}.
Actually, our aim was to get m[z]=Sl2CFrameModified[u,b][z]. Still, this has to be achieved.
May be, something has to be changed in the term 
-{{1,bb},{-int,aa^2-bb*int}}/aa // Simplify of Sl2CFrameMeromorphic[f, h][z], Testexample:\n

n=5;k=3;mm[z_]=Sl2CFrameMeromorphic[n,k][f,h][z];\n
u[z_]=Sl2CFrameMeromorphicToSl2CModified1[mm][z]//Simplify\n
b[z_]=Sl2CFrameMeromorphicToSl2CModified2[mm][z]//Simplify\n
dd={{1,0},{0,-1}};
mm[z]-dd.Sl2CFrameModified[u,b][z].dd//Simplify";

meromorphicBRIntegral::usage="phi_{n,k}=meromorphicBRIntegral[n,k][f,h][z]
is the algebraic formula for the integrals of the meromorphic 1-forms f[z]^k*pp_n,
where pp_n=meromorphicBRToExactForms[n][f,h][z]. The program code of 
'meromorphicBRIntegral' uses the recursive construction
phi_{n,0}= pp_{n-1}/f'[z];
phi_{n,k}= f[z]^k*pp_{n-1}/f'[z]-k*phi_{n-,k-}
of the operators (f,h)->phi_{n,k}(f,h).";

meromorphicBRIntegralDirect::usage=
"phi_{n,k}=meromorphicBRIntegralDirect[n,k][f,h][z] is the algebraic formula 
for the integrals of the meromorphic 1-forms f[z]^k*pp_n, where 
pp_n=meromorphicBRToExactForms[n][f,h][z]. The program code is given by
a linear combination of the operators meromorphicBRToExactForms[i][f,h][z] with 
certain integer coefficients, namely:
Sum[meromorphicBRToExactForms[j+n-k-1][f,h][z]*Factorial[k]/Factorial[j]*
f[z]^j*(-1)^(k-j)/D[f[z],z],{j,0,k}]/;n>k."      

meromorphicBRToExactForms::usage="omega=meromorphicBRToExactForms[n][f,h][z],
(n a positive integer), is a natural differential operator 
assigning to pairs (f,h) of meromorphic functions a meromorphic
1-form omega such that the 3 1-forms omega, f*omega and f^2*omega are exact.
This command is copied from the same command in 'n-dimwei.m, where
in combination with the Weierstrass representation formula it gives rise
to a natural differential-algebraic representation formula for minimal
curves in C^3. meromorphicBRToExactForms[n][f,h][z] is 'almost bijective'
(see the command meromorphicBRToExactForms3Invers[f,r][a,b,c][z]).
Here it is used to produce algebraic representation "

meroBRInversDirect::usage="form -> meroBRInversDirect[n][f,form][z] is the inverse
operation to h -> form = meromorphicBRToExactForms[n][f,h][z]. Practically the same as
meroBRInvers[n][f,form][z], but given by a simple algebraic expression.
Constants of Integration are not considered."

meroBRInvers::usage="form -> meroBRInvers[n][f,form][z] is the inverse operation 
to h -> form=meromorphicBRToExactForms[n][f,h][z], obtained by inverting the
recursion process  defining meromorphicBRToExactForms[n][f,h][z]. See also 
meroBRInversDirect[n][f,form][z]. Constants of Integration are not considered."

meroBRInverswithConstants::usage="Similar to meroBRInvers[n][f,form][z], but taking into
account n constants of integration."

meroBRInversDirectwithConstants::usage="Similar to meroBRInversDirect[n][f,form][z],
but taking into account n constants of integration."

basicFunctionG::usage="basicFunctionG[a,b][z] together with  basicFunctionOmega[a,b][z] is a
	transformation {a[z],b[z]}--->{g[z],omega[z]} such that a solution vector of
	the linear 2x2-system with matrix {{g[z],-g[z]^2},{1,-g[z]}}*omega[z]
	is just formed by the two given functions sol1={a[z],b[z]}. This can be
	checked by typing  qq=nilpotentsl2MatrixBasic[{basicFunctionG[a,b][#],
	basicFunctionOmega[a,b][#]}&][z]//Transpose;
	qq.{a[z],b[z]}//Simplify. A second solution vector sol2 of this system such
	that sol1 and sol2 are linearly independent is obtained by the reduction
	procedure of d'Alembert  (see for instance Walter, gewöhnliche
	Differentialgleichungen (SK520), page 113). The final fundamental system is
	then obtained with the function Sl2CFrame[a,b][z]."
	
basicFunctionOmega::usage="basicFunctionOmega[a,b][z] see: basicFunctionG[a,b][z]."

basicFunctionGModified::usage="basicFunctionGModified[u,b][z] together with 
	basicFunctionOmegaModified[u,b][z] is a transformation {u[z],b[z]}--->{g[z],omega[z]}
	such that a solution vector sol1={-1/u[z],b[z]} of the linear 2x2-system with matrix 
	{{g[z],-g[z]^2},{1,-g[z]}}*omega[z] is expressed directly by the two given functions 
	{u[z],b[z]}. This can be checked by typing\n
	qq = nilpotentsl2MatrixBasic[basicFunctionGModified[a, b],\n
	basicFunctionOmegaModified[a, b]][z]//Transpose//Simplify;\n
	vv = {-1/a[z], -b[z]/a[z]}; qq.vv - D[vv, z] // Together\n
	This simplifies the integral appearing in the solution formula FF[z]=Sl2CFrame[a, b][z]
	of the linear system FF'[z]=FF[z].basicFunctionG[a,b][z].";

basicFunctionOmegaModified::usage="see: basicFunctionGModified[a,b][z]."

basicFunctionGMeromorphic::usage="{f[z],h[z]} --> basicFunctionGMeromorphic[f,h][z] together with 
	{f[z],h[z]} --> basicFunctionOmegaMeromorphic[a,b][z] is the operation that gives the pair 
	{g[z],omega[z]} of functions such that the Maurer-Cartan derivative of Sl2CFrameMeromorphic[f,h][z]
	equals nilpotentsl2MatrixBasic[g,omega][z]. This is an explicit formula written as a quick
	tool for the case n=3, k=1 of Sl2CFrameMeromorphic[n,k][f,h][z]. For general n, k use for instance
	nullcurveToBryantdata[Sl2CFrameMeromorphic[n,k][f,h]][z] and concrete values of n and k. The
	complexity of the results is rapidly growing with n and k."

basicFunctionOmegaMeromorphic::usage="See under basicFunctionGMeromorphic[f,h][z]."

Sl2CFrame::usage="F=Sl2CFrame[a,b][z] is an Sl(2,C)-matrix that solves the
	linear system F'=F*X, where X is the null 
	matrix X=nilpotentsl2Matrix[a, b][z] of sl(2,C) (see the command
	nilpotentsl2Matrix[a,b][z]) and where a[z] and b[z] are two arbitrary
	meromorphic functions of one variable."

Bryantframe::usage="Bryantframe[a,b][z] is the same as Sl2CFrame[a,b][z]."


nullcurveToBryantdata::usage="nullcurveToBryantdata[nullMatrix][z] is the inverse
	operation to the Bryant representation formula {g[z],omega[z]} -->FF[z]=nullMatrix[z];
	where FF[z] is a solution of FF'[z]=FF[z].XX[z] with
	XX[z_]=nilpotentsl2MatrixBasic[g,omega][z]={{g[z],-g[z]^2},{1,-g[z]}}*om[z].
	It checks whether FF[z] is really null, i.e., whether Det[FF[z]^(-1).FF'[z]] is zero
	and returns a pair {g[z],omega[z]} of meromorphic functions."

nullcurveToBryantdata1::usage="nullcurveToBryantdata1[nullMatrix][z] is the first component
	g[z] of nullcurveToBryantdata[nullMatrix][z]. A check of nullMatrix[z] is omitted for
	simplicity." 

nullcurveToBryantdata2::usage="nullcurveToBryantdata2[nullMatrix][z] is the second component
	omega[z] of nullcurveToBryantdata[nullMatrix][z]. A check of nullMatrix[z] is omitted for
	simplicity." 

nullcurveToModifiedData::usage="nullcurveToModifiedData[nullMatrix][z] is the inverse operation
	to the representation formula {a[z],b[z]} --> FF[z]=Sl2CFrameModified[a,b][z].
	It checks whether FF[z] is really null, i.e., whether Det[FF[z]^(-1).FF'[z]] is zero and
	returns a pair {a[z],b[z]} of meromorphic functions."

nullcurveToModifiedData1::usage="nullcurveToModifiedData1[nullMatrix][z] is the first component
	a[z] of nullcurveToModifiedData[nullMatrix][z]. A check of nullMatrix[z] is omitted for
	the sake of simplicity."

nullcurveToModifiedData2::usage="nullcurveToModifiedData2[nullMatrix][z] is the second component
	b[z] of nullcurveToModifiedData[nullMatrix][z]. A check of nullMatrix[z] is omitted for
	the sake of simplicity."

BryantframeModified::usage="BryantframeModified[a,b][z] is the same as
	Sl2CFrameModified[a,b][z]."
	
Sl2CFrameModified::usage="Sl2CFrameModified[u,b][z] is
	Sl2CFrame[a,bb][z] with a[z_]=-1/u[z] and bb[z_]=b[z]*a[z].
	This yields a simpler form of this
	expression. The resulting expression contains  only one integral, namely
	Integrate[Derivative[1][u][z]^2/Derivative[1][b][z],z].
	Sl2CFrameModified[a][z] is Sl2CFrameModified[a,bbcan[a]][z], i.e., a representation
	formula for null curves such that z is the natural parameter."

nilpotentsl2MatrixModified::usage="nilpotentsl2MatrixModified[u,b][z] is
	nilpotentsl2Matrix[a,bb][z] with  a[z_]=-1/u[z] and bb[z_]=b[z]*a[z].
	This yields a simple form for the explicit solution F=Sl2CFrameModified[u,b][z] of
	the cporresponding 2x2-linear system. The resulting expression for F contains only one
	integral, namely Integrate[Derivative[1][u][z]^2/Derivative[1][b][z],z]."

Sl2CFrameBianchiCaloSmall::usage="f[z] --> Sl2CFrameBianchiCaloSmall[f][z] is an implementation of
	the algebraic representation formula for null curves in Sl(2,C) found by
	A. J. Small with methods of algebraic geometriy (see 'Surfaces of constant mean
	curvature 1 in H^3 and algebraic curves on a quadric',
	Proc. AMS, vol 122, No. 4, (1994), 1211- 1220). It seems to be some kind of analogue
	of the Study formula used in minimal surface theory in R^3.\n
	The  operator {f[z],g[z]} --> Sl2CFrameBianchiCaloSmall[f, g][z] is the reparametrization
	Sl2CFrameBianchiCaloSmall[f_, g_][z_]:=Sl2CFrameBianchiCaloSmall[f][g[z]] of the first one.
	The Bryant data of Sl2CFrameBianchiCaloSmall[f][z] are g[z]=z and
	omega[z]=1/4 the square of the Schwarzian derivative of f[z] (implemented here
	as schwarzderbr[f][z]).
	Analogously, the same holds for Sl2CFrameBianchiCaloSmall[f,g][z].
	(Type for instance\n nullcurveToBryantdata[Sl2CFrameBianchiCaloSmall[f]][z].\n
	\tnilpotentsl2MatrixBasic[# &, schwarzderbr[f][#]^2/4 &][z] // Simplify)\n
	This shows, that Bryant's linear system FF'[z]==FF[z].nilpotentsl2MatrixBasic[g,omega][z]
	for null curves can be solved explicitely for omega[z_]=schwarzderbr[g][z]^2/4. Type\n
	D[Sl2CFrameBianchiCaloSmall[f][z], z] - Sl2CFrameBianchiCaloSmall[f][z].\n
	nilpotentsl2MatrixBasic[# &, schwarzderbr[f][#]^2/4 &][z] // Simplify\n.
	Observe that Mathematica's NDSolve is not able to produce the solution Sl2CFrameBianchiCaloSmall[f][z]
	from Sl2CFrameBR[# &, schwarzderbr[f][#]^2/4 &][z].\n
	A note on the two basic differential invariants of the curve Sl2CFrameBianchiCaloSmall[f][z]:\n
	\t1) The natural parameter (Hopf differential) is schwarzderbr[f][z]^2/4
	(type cmcCPPKAN[nullcurveToModifiedData[BianchiCaloSmallFrame[f]]][z])\n
	\t2). The representation formula for CMC-1-surfaces in H^3 corresponding to the formula
	of A. J. Small was rederived by Levi L. de Lima and Pedro Roitman with methods
	of classical Euclidean differential geometry in the paper 'Constant mean curvature
	one surfaces in hyperbolic 3-space using the Bianchi-Cal\`{o} method,
	An. Acad. Bras. Cien\^{e}c. 74, No.1, 19-24, (2002) by considering
	envelopes of 2-parameter families of spheres in R^3 and classical results of L. Bianchi
	(Lezione di Geometria Differenziale, Terza Editione, Bologna 1927, see also the
	german translation, Page 500 ff, Leipzig 1910) and B. Cal\`{o} (Risoluzione di
	alcuni problemi sull' applicabilitat\`{a} delle superficie,
	Annali di Mathematica IV, (1899))"

ErgebnisEinerfalschenFormelfuerdieKruemmung="The curvature is given by
	kappa[z_]=-(s[z]^2*(s[z]^4 - 24*s'[z]^2 + 8*s[z]*s''[z]))/32,
	where s[z]=schwarzderbr[f][z]. Type\n

	Module[{schw0=schwarzderbr[f][z],schw1,schw2},schw1=D[schw0,z];schw2=D[schw1,z];\n
	-(schw0^2*(schw0^4-24*schw1^2+8*schw0*schw2))/32]-\n
		cmcKappaKAN[nullcurveToModifiedData[BianchiCaloSmallFrame[f]]][z]//Simplify\n
	to verify this assertion with Mathematica.\n"

BianchiCaloSmallFrame::usage="BianchiCaloSmallFrame[f][z] and BianchiCaloSmallFrame[f,g][z]
	are the same as Sl2CFrameBianchiCaloSmall[f][z] or Sl2CFrameBianchiCaloSmall[f,g][z] respectively."

auxBianchiCaloSmall::usage="{f[z],g[z]} --> auxBianchiCaloSmall[f,g][z] is an auxiliary command used
	exclusively to produce the command Sl2CFrameBianchiCaloSmall[f][z] as auxBianchiCaloSmall[f,#&][z]."

BianchiCaloSmallDouble::usage="BianchiCaloSmallDouble[f, g][z] is the invariant algebraic
	representation formula {f[z],g[z]} ---> Sl2CFrameBianchiCaloSmall[f][z].
	Inverse[Sl2CFrameBianchiCaloSmall[g][z]]. The Bryant data of this curve are
	g[z] and the difference of the squares of the Schwarzian derivatives of f and g
	divided by 4 g'[z]. Type\nnullcurveToBryantdata[BianchiCaloSmallDouble[f,g]][z]-\n{g[z],
	(schwarzderbr[f][z]^2-schwarzderbr[g][z]^2)/(4*D[g[z],z])}//Simplify\n
	to convince yourself."

BianchiCaloSmallDoubleInvers::usage="BianchiCaloSmallDoubleInvers[ff][z] assigns to a curve
	ff[z]={{A[z],B[z]},{D[z],C[z]}} in Sl(2,C) the pair f[z]=-D'[z]/A'[z], g[z]=D'[z]/C'[z]
	of functions such that ff[z_]=BianchiCaloSmallDouble[f,g][z], provided ff[z] is a null curve."

BianchiCaloSmallDoubleInvers1::usage="BianchiCaloSmallDoubleInvers1[ff][z] assigns to a curve
	ff[z]={{A[z],B[z]},{D[z],C[z]}} in Sl(2,C) the function f[z]=-C'[z]/A'[z], i.e.,
	the first member of the pair {f[z],g[z]} such that ff[z_]=BianchiCaloSmallDouble[f,g][z],
	provided ff[z] is a null curve."

BianchiCaloSmallDoubleInvers2::usage="BianchiCaloSmallDoubleInvers1[ff][z] assigns to a curve
	ff[z]={{A[z],B[z]},{D[z],C[z]}} in Sl(2,C) the function g[z]=C'[z]/D'[z], i.e.,
	the second member of the pair {f[z],g[z]} such that
	ff[z_]=BianchiCaloSmallDouble[f,g][z], provided ff[z] is a null curve."


squaredlengthOfThirdDerOfBianchiCaloSmallDouble::usage="
	squaredlengthOfThirdDerOfBianchiCaloSmallDouble[f,g][z] is a command
	producing the same response as nullcurveCurvature[ff][z], where
	ff[z_]=BianchiCaloSmallDouble[f,g][z]. It uses the formal expression\n
		-diff[z]^2(Sf[z]+Sg[z])+8*diff'[z]^2-4*diff''[z]*diff[z],\n
	where diff[z]=Sf[z]-Sg[z] of nullcurveCurvature[BianchiCaloSmallDouble[f,g]][z] in
	terms of the squares Sf[z] and Sg[z] of the Schwarzian derivatives of the meromorphic
	functions f[z] and g[z]." ;

BianchiCaloSmallDoubleCurvatureFORMAL::usage="
	BianchiCaloSmallDoubleCurvatureFORMAL[mf,mg][z] is the expression for the curvature
	of the null curve ff[z_]=BianchiCaloSmallDouble[f,g][z] in terms of the Schwarzian
	derivatives mf[z_]=schwarzderbr[f][z] and mg[z_]=schwarzderbr[g][z] respectively.
	It is used to produce the command\n
	BianchiCaloSmallDoubleCurvature[f_,g_][z_]:=
		BianchiCaloSmallDoubleCurvatureFORMAL[schwarzderbr[f],schwarzderbr[g]][z].\n
	and is necessary, since direct calculation of the curvature of
	A command confirming correctness of this could be:\n
	(BianchiCaloSmallDoubleCurvature[f,h][z]//.Join[toSchwarzian[2][f,SF][z],toSchwarzian[2][h,SH][z]])-\n
	BianchiCaloSmallDoubleCurvatureFORMAL[SF, SH][z] // Simplify\n
	The response should be 0."

BianchiCaloSmallDoubleCurvature::usage="
	BianchiCaloSmallDoubleCurvature[f,g][z] is the null curve curvature of
	ff[z_]=BianchiCaloSmallDouble[f,g][z], i.e., it equals
	nullcurveCurvature[BianchiCaloSmallDouble[f,g][z]. It can be used, when
	direct calculation of the curvature of BianchiCaloSmallDouble[f,g][z]
	takes too much time."

BianchiCaloSmallDoubleCanParameterPrime::usage="BianchiCaloSmallDoubleCanParameterPrime[f,g][z]
	is the square root of the derivative of the natural parameter of the null curve 
	ff[z_]=BianchiCaloSmallDouble[f,g][z]. This means for instance that\n
	nullcurveCanParameterPrime[BianchiCaloSmallDouble[f,g]][z] and\n
	BianchiCaloSmallDoubleCanParameterPrime[f,g][z]\n
	are equal expressions for any functions f[z], g[z]."

hermitianTypeSurface::usage="(u,v)--->hermitianTypeSurface[a,b][u,v] is a command
	for parametrized surfaces of constant mean curvature 1 in the space of all
	2x2 Hermitian matrices that serves as a model for the 3-dimensional hyperbolic space.
	It depends on two meromorphic functions a[z] and b[z].
	It's definition: hermitianTypeSurface[a,b][u,v]=F.F^*, where
	F=Sl2CFrame[a,b][u+I*v] and F^* is the adjoint matrix of F.";

hermitianTypeSurfaceModified::usage="(x,y)--->hermitianTypeSurfaceModified[a,b][x,y] is an
	integral representation formula for parametrized surfaces of constant mean curvature 1
	in the space of all 2x2 Hermitian matrices that serves as a model for the
	3-dimensional hyperbolic space. It depends on two meromorphic functions a[z] and b[z].
	It's definition: hermitianTypeSurfaceModified[a,b][u,v]=F.F^*, where
	F=Sl2CFrameModified[a,b][x+I*y] and F^* is the adjoint matrix of F.";

lorentzianTypeSurface::usage="(u,v)--->lorentzianTypeSurface[a,b][u,v] is the Lorentzian version of
	(u,v)--->hermitianTypeSurface[a,b][u,v], i.e., the parametrized surface in
	the Lorentzian model of the hyperbolic space H^3 obtained as
	hermitean2by2ToLorentz[hermitianTypeSurface[a,b][u,v]]";

lorentzianTypeSurfaceModified::usage="(u,v)--->lorentzianTypeSurfaceModified[a,b][u,v] is the
	Lorentzian version of (u,v)--->hermitianTypeSurfaceModified[a,b][u,v], i.e., the parametrized
	surface in the Lorentzian model of the hyperbolic space H^3 obtained as
	hermitean2by2ToLorentz[hermitianTypeSurfaceModified[a,b][u,v]]";

ballmodelTypeSurface::usage="(u,v)--->ballmodelTypeSurface[a,b][u,v] is the projection of 
	(u,v)--->lorentzianTypeSurface[a,b][u,v] by the map 
	x in R^4 ----> lorentzmodelToBallmodel[x] in the 3-dimensional ball D^3 -
	the usual transformation between the Lorentzian- and the ball-model of the hyperbolic space";

ballmodelTypeSurfaceModified::usage="(u,v)--->ballmodelTypeSurfaceModified[a,b][u,v] is the projection of 
	(u,v)--->lorentzianTypeSurfaceModified[a,b][u,v] by the map 
	x in R^4 ----> lorentzmodelToBallmodel[x] in the 3-dimensional ball D^3 -
	the usual transformation between the Lorentzian- and the ball-model of the hyperbolic space";

nullcurveToBallmodel::usage="nullCurve[z]-->nullcurveToBallmodel[nullCurve][u,v] gives
	the parametrization of the surface corresponding to a given null curve z --> nullCurve[z]
	in the ballmodel of hyperbolic 3-space, replacing the complex variable z by u+I*v."

nullcurveToBallmodelPolar::usage="nullCurve[z]-->nullcurveToBallmodelPolar[nullCurve][r,phi] gives
	the parametrization of the surface corresponding to a given null curve z --> nullCurve[z]
	in the ballmodel of hyperbolic 3-space, replacing the complex variable z by r*Exp[I*phi]."

nullcurveToUpperhalfSpace::usage="nullCurve[z]-->nullcurveToUpperhalfSpace[nullCurve][u,v]
	gives the parametrization of the surface corresponding to a given null curve
	z -->nullCurve[z]in the upper half space model of hyperbolic 3-space, replacing 
	the complex variable z by u+I*v."

nullcurveToUpperhalfSpacePolar::usage="nullCurve[z]-->nullcurveToUpperhalfSpace[nullCurve][r,phi]
	gives the parametrization of the surface corresponding to a given null curve 
	z --> nullCurve[z] in the upper half space model of hyperbolic 3-space, replacing the
	complex variable z by r*Exp[I*phi]."

nullcurveToHermiteanmodelPolar::usage="nullCurve[z]-->
	nullcurveToHermiteanmodelPolar[nullCurve][r,phi] gives the parametrization of
	the surface in the model of hermitean 2x2-matrices of determinant 1 corresponding
	to the given null curve z --> nullCurve[z]. The operation sends ff[z] to the
	matrix product of ff[z] with the adjoint Matrix of ff[z], replacing the complex
	variable z by r*Exp[I*phi]. "

nullcurveToHermiteanmodel::usage="nullCurve[z]-->nullcurveToHermiteanmodel[nullCurve][u,v]
	gives the parametrization of the surface in the model of hermitean 2x2-matrices of
	determinant 1 corresponding to the given null curve z --> nullCurve[z].
	replacing the complex variable z by u+I+v. The operation sends ff[z] to the matrix
	product of ff[z] with the adjoint Matrix of ff[z], replacing the complex
	variable z by u+I+v."

drahtrahmenderspaehreX::usage="drahtrahmenderspaehreX[m,n] plots a wire frame of the
	2-sphere in R^3 using n longitudes and m latitudes, displaying straight line segments."

drahtrahmenderspaehreY::usage="drahtrahmenderspaehreY[m,n] plots a wire frame of the
	2-sphere in R^3 using n longitudes and m latitudes displaying smooth curves."

drahtrahmen::usage="drahtrahmen=drahtrahmenderspaehreX[17,11]."


lorentzmodelToBallmodel::usage="lorentzmodelToBallmodel[x0,x1,x2,x3]:={x1,x2,x3}/(1+x0)//Simplify
	or lorentzmodelToBallmodel[vec] is the transformation of H^3 to the 
	3-dimensional open ball D^3 , i.e., the central projection of the Lorentzian
	space R^4 to R^3 from the point (-1,0,0,0) mapping the hyperbolic space H^3 
	to the 3-dimensional open ball D^3.";

ballmodelToLorentzmodel::usage="ballmodelToLorentzmodel[y1,y2,y3]
	or ballmodelToLorentzmodel[n-dimvector] is the transformation of the 
	3-dimensional open ball D^3 to the hyperbolic space H^3, i.e., the 
	right-inverse of {x0,x1,x2,x3}--->lorentzmodelToBallmodel[x0,x1,x2,x3].
	The command
	lorentzmodelToBallmodel[ballmodelToLorentzmodel[y1,y2,y3]]//Simplify
	returns {y1,y2,y3}.";

upperhalfSpaceToBallmodel::usage="upperhalfSpaceToBallmodel[x1,x2,x3]
	or upperhalfSpaceToBallmodel[n-dimvector] is the isometric transformation of 
	the upper half space x3>0 to the 3-dimensional open ball D^3. The command 
	also works in higher dimensions."

ballmodelToUpperhalfSpace::usage="ballmodelToUpperhalfSpace[x1,x2,x3]
	or ballmodelToUpperhalfSpace[n-dimvector] is the isometric transformation of
	the 3-dimensional ball D^3 in R^3 to the upper half space x3>0. The command 
	also works in higher dimensions."

upperhalfSpaceToLorentzmodel::usage="upperhalfSpaceToLorentzmodel[x1,x2,x3] or
	upperhalfSpaceToLorentzmodel[n-dimvector] is the isometric transformation
	of the upper half space x3>0 to the hyperbolic space H^3. The command also
	works in higher dimensions."

lorentzmodelToUpperhalfSpace::usage="lorentzmodelToBallmodel[x1,x2,x3] or 
	upperhalfSpaceToLorentzmodel[n-dimvector] is the isometric transformation 
	of the hyperbolic space H^3 to the upper half space x3>0."

normalofH3::usage="normalofH3[x0,x1,x2,x3] or
	normalofH3[vec] is the normal vector of the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4. Confirm this with the commands
	alpha[t_]=hyperbolicPolarCoords[a[t],b[t],c[t]];
	lorentzMetrik[normalofH3[alpha[t]],alpha'[t]]//Simplify";

hyperbolicE::usage="hyperbolicE[x][u,v] is the first coefficient of the
	induced metric tensor of a parametrized surface (u,v)-->x[u,v] in the 
	3-dimensional hyperbolic space H^3, realized as a hypersurface of R^4.";

hyperbolicF::usage="hyperbolicF[x][u,v] is the second coefficient of the induced metric tensor of a
	parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";

hyperbolicG::usage="hyperbolicG[x][u,v] is the third coefficient of the induced metric tensor of a
	parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";


hyperbolicL::usage="hyperbolicL[x][u,v] is the first coefficient of the second fundamental
	form of a parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";

hyperbolicM::usage="hyperbolicM[x][u,v] is the second coefficient of the second fundamental
	form of a parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";

hyperbolicN::usage="hyperbolicN[x][u,v] is the third coefficient of the second fundamental
	form of a parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";

hyperbolicfirstFF::usage="hyperbolicfirstFF[x][u,v] is the induced metric tensor of a
	parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";

hyperbolicsecondFF::usage="hyperbolicsecondFF[x][u,v] is the second fundamental form of a
	parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";

hyperbolicWeingartenmap::usage="hyperbolicWeingartenmap[x][u,v] is the Weingarten map of a
	parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";

hyperbolicGaussiancurvature::usage="hyperbolicGaussiancurvature[x][u,v] is the Gaussian curvature of a
	parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";

hyperbolicMeancurvature::usage="hyperbolicMeancurvature[x][u,v] is the mean curvature of a
	parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,
	realized as a hypersurface of R^4.";

hyperbolicSurfaceNormalVector::usage="n=hyperbolicNormal[x][u,v] is the normal vector of a
	parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space
	H^3, where H^3 is realized as a hypersurface of R^4. This means that n is a vector of R^4
	tangent to H^3 and normal to the surface x[u,v].";

hyperbolicSurfaceNormalVectorwithCheck::usage="hyperbolicNormalwithCheck[x][u,v] is the same as
	hyperbolicSurfaceNormalVector[x][u,v], but
	a checks whether the derivatives of x[u,v] are tangent to H^3 at the point x[u,v] of H^3 is
	included."

spur::usage="spur[m] is the trace of a the square matrix m."
	
commutator::usage="commutator[x,y] is the ordinary commutator of two square matrices x and y.
	commutator[{x,y}] or pair//commutator applies two pairs of matrices."

adjointRepresentation::usage="adjointRepresentation[n][x][y] is the n-th power of the operator
	ad[x]:y-->x.y-y.x acting on the Lie algebra of all square matrices of some fixed order. 
	This command is used for instance for the investigation of power series of ad[x]."

hyperbolicunitNormal::usage="n=hyperbolicunitNormal[x][u,v] is the unit normal vector of a
	parametrized surface (u,v)-->x[u,v] in the 3-dimensional hyperbolic space H^3,realized as a hypersurface
	of R^4. This means that n is a vector of R^4 of unit length with respect to the Lorentzian scalar product.
	It is tangent to H^3 and normal to the surface x[u,v].";

hyperbolicCross::usage="hyperbolicCross[v,w][point] is the cross product of
	two tangent vectors v and w
	of the tangent space T_point(H^3) of the hyperbolic space H^3 at a point
	'point' of H^3 with respect to the metric induced from the lorentzian metric
	of the ambient space R^4. H^3 is considered as a 3-dimensional hyperspace of R^4."


hyperbolicCrosswithCheck::usage="hyperbolicCrosswithCheck[v,w][point] is
	the same as hyperbolicCross[v,w][point] but
	checks whether v and w are tangent to H^3 at the point 'point' of H^3."

hyperbolicTangentVectorofH3::usage=
	"{x1,x2,x3}-->hyperbolicTangentVectorofH3[a,b,c][x1,x2,x3] is a bijective
	linear map of R^3 to the tangent space of H^3 at the point
	p=hyperbolicPolarCoords[a,b,c]."

hyperbolicTangentVectorofH3Invers::usage=
	"{xx0,xx1,xx2,xx3}-->hyperbolicTangentVectorofH3Invers[a,b,c][xx0,xx1,xx2,xx3]
	is the left-inverse linear map of
	hyperbolicTangentVectorofH3[a,b,c][x1,x2,x3]. To see it's relation to this
	command type for instance
	hyperbolicTangentVectorofH3Invers[a,b,c][xx0,xx1,xx2,xx3]//hyperbolicTangentVectorofH3[a,b,c]
	or
	hyperbolicTangentVectorofH3[a,b,c][x1,x2,x3]//hyperbolicTangentVectorofH3Invers[a,b,c]";

hyperbolicComplexargumentrule::usage="hyperbolicComplexargumentrule=hyperbolicComplexargumentrule:={
	Arg[z_]:>ArcTan[Simplify[ComplexExpand[Im[z]]/ComplexExpand[Re[z]]]],
	Abs[z_]:>Sqrt[Simplify[PowerExpand[ComplexExpand[Im[z]]^2+ComplexExpand[Re[z]]^2]]],
	Log[`x_^n_]:>n*Log[`x],ArcTan[Tan[y_]]:>y,ArcTan[Cot[y_]]:>Pi/2-y} forces
	complex expression containing 'Abs' and 'Arg' to be evaluated to the corresponding
	real expressions."

hyperbolicComplexExpand::usage="hyperbolicComplexExpand[term_]:=
	(term//.hyperbolicComplexargumentrule)//Simplify is used to complete the operation
	'ComplexExpand' by evaluating 'Abs' and 'Arg' in a the way presribed by
	hyperbolicComplexargumentrule."

(********************* second fundamental form ********************)

hyperbolicL::usage="hyperbolicL[x][u,v] is the first coefficient of the second fundamental
	form of a parametrized surface x[u,v] in the hyperbolic space H^3.";

hyperbolicM::usage="hyperbolicM[x][u,v] is the second coefficient of the second fundamental
	form of a parametrized surface x[u,v] in the hyperbolic space H^3.";

hyperbolicN::usage="hyperbolicN[x][u,v] is the third coefficient of the second fundamental
	form of a  parametrized surface x[u,v] in the hyperbolic space H^3.";

hyperbolicsecondFF::usage="hyperbolicsecondFF[x][u,v] is the matrix of the second fundamental form
	of a parametrized surface x[u,v] in the hyperbolic space H^3.";


hyperbolicLeviCivita::usage="hyperbolicLeviCivita[x,v][{r,s}][u,v] is the covariant derivative of a
	vector field v[u,v] defined on a parametrized surface x[u,v] in the
	hyperbolic space H^3.";

hyperbolicOrthogonalProjection::usage="hyperbolicOrthogonalProjection[x][a] is the
	orthogonal projection of Lorentzian space R^4 of a vector x of R^4 in the
	direction of a nonisotropic vector a giving the direction of orthogonal projection.
	This command is used in defining the Levi-Civita connection of the hyperbolic
	space H^3.";

hyperbolicMeancurvature::usage="hyperbolicMeancurvature[x][u,v] is the mean 
	curvature of a parametrized surface x[u,v] in the hyperbolic space H^3.";

hyperbolicGaussiancurvature::usage="hyperbolicGaussiancurvature[x][u,v] is the 
	Gaussian curvature of a parametrized surface x[u,v] in the hyperbolic space H^3.";

hyperbolicWeingartenmap::usage="hyperbolicWeingartenmap[x][u,v] is the shape operator of a parametrized 
	surface x[u,v] in the hyperbolic space H^3.";


(********************************************************************************
	Quaternionen, Sl(2,C), Spur, Lorentzmetrik,
	Transformation H^3<--->HermitescheMatrizen etc. 
********************************************************************************)


adjointMatrix::usage="M=matrix-->adjointMatrix[M] is the matrix of all determinants
	of square submatrices of order n-1 of M, where n is the minimum of the two dimensions of M."

nilpotentsl2MatrixBasic::usage="nilpotentsl2MatrixBasic[g,omega][z] is a matrix valued
	function depending on a meromorphic function g[z] and a meromorphic
	differential 1-form omega[z] with values in the Lie-algebra of Sl(2,C)
	that presents R. Bryants analogue of the Weierstrass-formula for
	CMC-surfaces in the hyperbolic space H^3. Namely, solving the linear
	matrix-system F'=F*X of differential equations yields an Sl(2,C)-Matrix
	F[z] such that the map z->Transpose[Conjugate[F[z]]].F[z] yields a
	CMC-surface parametrized by z\in C. Here, the hyperbolic space
	H^3 is identified with the subset of Hermitian matrices of the Lie
	algebra of Gl(2,C) by the map lorentzToHermitean2by2[x0,x1,x2,x3].";

nilpotentsl2Matrix::usage="X=nilpotentsl2Matrix[a,b][z] is a version
	of nilpotentsl2MatrixBasic[g,omega][z] with
	g[z_]=basicFunctionG[a,b][z] and omega[z_]=basicFunctionOmega[a,b][z]. 
	The advantage is that a fundamental solution of the linear system F'=F.X
	can be expressed by quadratures in terms of a[z] and b[z]. The exact form of
	this F is provided by the operator Sl2CFrame[a,b][z],z]. This can be conformed by typing
	D[Sl2CFrame[a,b][z],z]-Sl2CFrame[a,b][z].nilpotentsl2Matrix[a,b][z]//Simplify.
	The result will be the 2x2-0-matrix.";

lorentzToHermitean2by2::usage="lorentzToHermitean2by2[x0,x1,x2,x3] or
	lorentzToHermitean2by2[vec] transforms a point vec={x0,x1,x2,x3} of the Lorentzian space
	R^4 into a Hermitean matrix of gl(2,C). The mapping {x0,x1,x2,x3}--->
	lorentzToHermitean2by2[x0,x1,x2,x3] is a bijection onto the space of Hermitean matrices
	and it's inverse is given by the command hermitean2by2ToLorentz.
	Moreover, the determinant of I*lorentzToHermitean2by2[x0,x1,x2,x3] is the negative
	square of the length of vec with respect the Lorentzian scalarproduct in R^3.";

hermitean2by2ToLorentz::usage="hermitean2by2ToLorentz[m] or
	hermitean2by2ToLorentz[m11,m12,m21,m22], where m={{m11,m12},{m21,m22}}
	is a complex 2x2-matrix, is the inverse transformation of lorentzToHermitean2by2."

lorentzMetrik::usage="lorentzMetrik[{x0,x1,x2,x3},{y0,y1,y2,y3}]=-x0*y0+x1*y1+x2*y2+x3*y3 is
	the Lorentzian indefinite scalar product of R^4 of signature (1,3).";

lorentzmetric::usage="lorentzmetric=DiagonalMatrix[{-1, 1, 1, 1}] is the diagonal matrix
	defining the Lorentzian indefinite scalar product of R^4 of signature (1,3).";

lorentzLength::usage="lorentzLength[{x0,x1,x2,x3}] is the length of the vector
	{x0,x1,x2,x3} with respect to the indefinite Lorentzian scalar product (see 'lorentzMetrik').";

lorentzGroup::usage="lorentzGroup[a,b,c,d,e,f] is a parametrization of
	the 6-dimensional group of Lorentzian transformations of R^4, i.e., the group of all
	matrices preserving the indefinite Lorentzian scalar product lorentzMetrik[v ,w].
	Try the commands/n
	mm=lorentzGroup[a,b,c,d,e,f];
	Transpose[mm].lorentzmetric.mm//Simplify"

lorentzGroupIwasawa0::usage="lorentzGroupIwasawa0[a,b,c,d,x,y] is a preliminary version of
	lorentzGroupIwasawa[a,b,c,d,x,y]. Was used to design this operator and can serve now as
	an information how several 1-parametric subgroups of the Lie group SO(1,3) are combined
	to obtain this formula."

lorentzGroupIwasawa::usage="lorentzGroupIwasawa[a,b,c,d,x,y] is an other parametrization of
	the Lorentzgroup SO(1,3) of the Minkowski space (compare ?lorentzGroup), arranged so that it
	commutes with 'Sl2CToSO13' and 'Sl2CIwasawaPar', i.e, lorentzGroupIwasawa[a,b,c,d,x,y]
	fits to the Iwasawa decomposition of Sl(2,C) in a way that is pictured by
	the following command (yielding the 4x4-nullmatrix):\n
	lorentzGroupIwasawa[a,b,c,d,x,y]-
	Sl2CToSO13[Sl2CIwasawaPar[Exp[(a+I*b)],Exp[c+d*I],x+I*y]]//Simplify.";

lorentzGroupIwasawaInvers::usage="4x4-matrix-->lorentzGroupIwasawaInvers[matrix] is an attempt
	to provide an inverse operation of {a,b,c,d,x,y}-->lorentzGroupIwasawa[a,b,c,d,x,y].
	Limitations: Up to now, various tests do not work.\n
	So for instance, the following numerical test with random SO(1,3)-matrices gives sometimes
	results differing from  {0}:\n
	randomSO13matrix:=(Clear[rr,zz,x,xx];\n
	rr[g_]:=Random[Real,{-g,g}];zz[g_]:=rr[g]+I*rr[g];r:=rr[7];\n
	lor=DiagonalMatrix[{-1,1,1,1}];ii=IdentityMatrix[4];\n
	x={{0,r,r,r},{0,0,r,r},{0,0,0,r},{0,0,0,0}};\n
	xx=(x-Transpose[x]).lor;aa=(ii+xx).Inverse[xx-ii]);\n
	mm=randomSO13matrix;Transpose[mm].lorentzmetric.mm//Chop\n
	mmi=lorentzmetric.Transpose[mm].lorentzmetric;mmi-Inverse[mm]//Chop\n
	mm1=lorentzGroupIwasawa[lorentzGroupIwasawaInvers[mm]//Chop]\n
	Chop[mmi.mm1-IdentityMatrix[4]]//Flatten//Union\n\n

	Comments on the genesis of this command:\n
	Looking at the formula zz=lorentzGroupIwasawa[a,b,c,d,x,y] above we observe
	that the sum qq of its 1-st an 4-th column is the following simple 4-vector
	{E^(2*c)*Cosh[2*a],-(E^(2*c)*Sin[2*b]),-(Sinh[2*a]*(Cosh[2*c]+Sinh[2*c])),
	Cos[2*b]*(Cosh[2*c]+ Sinh[2*c])}\n
	containing only a,b,c. From this a,b,c can be elimimated. We use
	an auxiliary command logexpand[term], that turns expressions of the form
	Log[Exp[u]] into u. Next we eliminate a, b, c from zz by multipiying it on the left
	with llLoren[1,4][-2*c].llEukl[2,4][-2*b].llLoren[1,3][2a] - the invers of the matrix
	llLoren[1,3][-2a].llEukl[2,4][2b].llLoren[1,4][2c] occuring as factor in the original
	substantial definition tt0=lorentzGroupIwasawa0[a,b,c,d,x,y] of this formula
	(see ?lorentzGroupIwasawa0).
	Computing the remaining factor qqq=llEukl[2,3][2d].MatrixExp[x*mmx].MatrixExp[y*mmy]//Simplify
	of zz0, we find that its entries qqq[[1,2]] and qqq[[1,3]]
	(as well as qqq[[4,2]] and qqq[[4,3]]) are just x and y respectively.
	Having computed a,b,c,x,y, there are many ways to eliminate d from
	any of the entries of zz. We decided for the way that can be seen from
	our construction below."

QuaternionicMatrix::usage="QuaternionicMatrix[a,b,c,d] is a general quaternionic matrix.
	hermitean2by2ToLorentz[QuaternionicMatrix[a,b,c,d]] yields {a,I*d,-I*c,I*b}.";

Quaternions::usage="Quaternions is a list of 8 complex 2x2-matrices
	representing the group
	{e,i,j,k,-e,-i,-j,-k} of quaternions. The following term produces the
	muliplication table of the group
	of quaternions:
	quaternionicmultiplicationtable=(qq=Thread[Quaternions->{e,i,j,k,e1,i1,j1,k1}];
	qq1=Thread[{e1,i1,j1,k1}->{-e,-i,-j,-k}];
	ruleReverse[rule_]:=Table[rule[[i,2]]->rule[[i,1]],{i,Length[rule]}];
	qqi=ruleReverse[qq];qq1i=ruleReverse[qq1];
	quaternions/.qq/.qq1;
	multiplikationstabelle=Table[Quaternions[[i]].Quaternions[[j]],{i,8},{j,8}]
	/.qq/.qq1;TableForm[multiplikationstabelle,TableSpacing->{1,1,1,1,1,1,1,1}])"

hyperbolicSurfaceNormalInhyperbolicPolarCoords::usage=
	"hyperbolicSurfaceNormalInhyperbolicPolarCoords[a,b,c][u,v] is the explicit
	expression of the
	surface normal of a surface in the hyperbolic space H^3 defined by three
	functions a[u,v], b[u,v], c[u,v] and
	the assignment (u,v)--->surfaceInhyperbolicPolarCoords[a,b,c][u,v]. It is the
	same operation as
	hyperbolicSurfaceNormalVector[surfaceInhyperbolicPolarCoords[a,b,c]][u,v].";

surfaceInhyperbolicPolarCoords::usage=
	"surfaceInhyperbolicPolarCoords[a,b,c][u,v] is a parametrized
	surface in the hyperbolic space H^3 defined by three functions a[u,v],
	b[u,v], c[u,v] and
	the parametrization of H^3 by hyperbolic polar coordinates, i.e.,
	surfaceInhyperbolicPolarCoords[a_,b_,c_][u_,v_]:=
	hyperbolicPolarCoords[a[u,v],b[u,v],c[u,v]]."
	
hyperbolicPolarCoords::usage="hyperbolicPolarCoords[a,b,c]:={Cosh[a]
	Cosh[b] Cosh[c],Cosh[b] Cosh[c] Sinh[a],Cosh[c] Sinh[b],Sinh[c]} is a
	parametrization of the 3-dimensional hyperbolic space, realized as
	the hyperquadric -x0^2+x1^2+x2^2+x3^3=-1 of R^4. hyperbolicPolarCoords[a,b,c]
	is the first line of the 4x4-matrix lorentzGroup[a,b,c,d,e,f]."
	
llLoren::usage="llLoren[1,2][a], llLoren[1,3][b], llLoren[1,4][c] are the
	elementary Lorentzian matrizes of SO(1,3)."
	llEukl::usage="llEukl[2,3][a], llEukl[2,4][b], llEukl[3,4][c] are the elementary
	matrizes of SO(1,3)." 

(************** KAN-Parametrisierung, inv. Metrik, kovariante Ableitung ********************)

covDerVectorKAN1::usage="covDerVectorKAN1[a,b][z] is the tangent vector of the curve\n
	sl2KAN[z_]=Sl2CIwasawaParInvers[Sl2CFrameModified[a,b][z]][[1]]";

covDerVectorKAN2::usage="covDerVectorKAN2[a,b][z] is the second order tangent vector of the curve\n
	sl2KAN[z_]=Sl2CIwasawaParInvers[Sl2CFrameModified[a,b][z]][[1]]\n
	obtained as covariant derivative of covDerVectorKAN1[a,b][z] along sl2KAN[z].";

covDerVectorKAN3::usage="covDerVectorKAN3[a,b][z] is the 3-rd order tangent vector of the curve\n
	sl2KAN[z_]=Sl2CIwasawaParInvers[Sl2CFrameModified[a,b][z]][[1]]\n
	obtained as covariant derivative of covDerVectorKAN2[a,b][z] along sl2KAN[z].";

covDerVectorKAN4::usage="covDerVectorKAN3[a,b][z] is the 4-th order tangent vector of the curve\n
	sl2KAN[z_]=Sl2CIwasawaParInvers[Sl2CFrameModified[a,b][z]][[1]]\n
	obtained as covariant derivative of covDerVectorKAN3[a,b][z] along sl2KAN[z].";

covDerVectorKAN5::usage="covDerVectorKAN5[a,b][z] is the 5-th order tangent vector of the curve\n
	sl2KAN[z_]=Sl2CIwasawaParInvers[Sl2CFrameModified[a,b][z]][[1]]\n
	obtained as covariant derivative of covDerVectorKAN4[a,b][z] along sl2KAN[z].";

Sl2CAction::usage="Sl2CAction[matrix][pairs] is an action of Sl(2,C) on pairs {g,om}
	that is induced from the invariance of the space of nilpotent sl(2,C)-matrices of the
	form X=nilpotentsl2MatrixBasic[g,om][z] under the adjoint representation of Sl(2,C).
	It is designed so that {g,om} ---> nilmatrix[g_,om_]:=om*{{g,-g^2},{1,-g}} is equivariant.
	The equivariance can be seen by typing\n\n
	nilmatrix[g_,om_]:=om*{{g,-g^2},{1,-g}};\n
	nilmatrix[x_List]:=nilmatrix[x[[1]],x[[2]]]\n
	pp={g[z],om[z]};mm={{a,b},{c,d}};mmInvers={{d,-b},{-c,a}};\n
	nilmatrix[Sl2CAction[mm][pp]]-mm.nilmatrix[{g[z],om[z]}].mmInvers//Expand\n\n
	Another check of the action property is given with\n
	matrix1={{a1,b1},{c1,d1}};matrix2={{a2,b2},{c2,d2}};pair={f[z],om[z]};\n
	Sl2CAction[matrix2][Sl2CAction[matrix1][pair]]-Sl2CAction[matrix2.matrix1][pair]//Simplify.\n\n
	Sl2CAction[matrix][function,form], Sl2CAction[a,b,c,d][function,form] and 
	Sl2CAction[a,b,c,d][pair] are similar commands that accept other forms of inputs."

Sl2CFramerule::usage="Sl2CFramerule[n][a11,a12,a21,a22][g,om][z]is a rule that substitutes
	all derivatives of the functions a11[z], a12[z], a21[z],a22[z]  up to order n by the
	expressions that they are correspond to if the matrix FF[z_]={{a11[z],a12[z]},{a21[z],a22[z]}}
	is a Bryantframe, i.e., has determinant=1 and solves the linear system
	FF'[z]=FF[z].nilpotentsl2MatrixBasic[g,om][z]=FF[z].{{g[z],-g[z]^2},{1,-g[z]}}*om[z].
	This rule is used to investigate higher order derivatives of Bryantframes, i.e., of null-curves
	in Sl(2,C).";

toBryantframeData::usage="toBryantframeData[n][a11, a12, a21, a22][g, om][z][term]=
	(term//.Sl2CFramerule[n][a11,a12,a21,a22][g,om][z])//Simplify reduces
	an expression 'term' containing the four functions a11[z],a12[z],a21[z],a22[z],
	together with their derivatives up to order n to an expression containing only the
	functions g[z] and om[z] and their derivatives. The correspondence is made so that the
	aij[z] are to be regarded as entries of a solution FF[z_]={{a11[z],a12[z]},{a21[z],a22[z]}}
	of the linear system FF'[z]=FF[z].{{g[z],-g[z]^2},{1,-g[z]}}*om[z].
	Examples: The first command shows that null curves have vanishing arc length:\n
	sl2[z_] = {{a11[z], a12[z]}, {a21[z], a22[z]}}\n
	tt = Sl2CIwasawaParInvers[sl2[z]][[1]]\n
	invariantmetricKAN[tt][D[tt, z]][D[tt, z]] // toBryantframeData\n
	
	The following commands compute the metric invariants of a null curve\n
	sl2KAN[z_] = Sl2CIwasawaParInvers[sl2[z]][[1]]\n
	t1 = highercovDerKANofCurve[1][sl2KAN][z] // toBryantframeData;\n
	t2 = highercovDerKANofCurve[2][sl2KAN][z] // toBryantframeData;\n
	t3 = highercovDerKANofCurve[3][sl2KAN][z] // toBryantframeData;\n
	{invariantmetricKAN[sl2KAN[z]][t1][t1],invariantmetricKAN[sl2KAN[z]][t1][t2],
	invariantmetricKAN[sl2KAN[z]][t2][t2],invariantmetricKAN[sl2KAN[z]][t2][t3],
	invariantmetricKAN[sl2KAN[z]][t3][t3]} // Simplify";

cppKAN2::usage="cppKAN2[a,b][z] is the expression in KAN-parametrization for the square
	of the derivative of the natural parameter of the Sl2CFrameModified[a,b][z].
	The command can be designed in the following way: Transfer
	Sl2CFrameModified[a,b][z] into KAN-parametrization by\n
	sl2KAN[z_]=SSl2CIwasawaParInvers[Sl2CFrameModified[a,b][z]][[1]].
	Next put t2=highercovDerKANofCurve[2][sl2KAN][z]//Simplify;
	Finally cppKAN2[a,b][z] is given by invariantmetricKAN[sl2KAN[z]][t2][t2]//Simplify.\n
	Note that this natural parameter is defined as the root of the length
	invariantmetricKAN[sl2KAN[z]][t2][t2] of the second tangent vector t2 of
	Sl2CFrameModified[a,b][z] and that it is given in terms R. Bryants representation formula
	Sl2CFrameBROBS[g,om][z] simply by (g'[z]*om[z])^2.";


matrixOfScalarproducts::usage="matrixDerSkalarprodukte[a][z] is a 5x5-matrix whose
	entries are the scalar products invariantmetricKAN[sl2KAN[z]][tttx[[i]]][tttx[[j]]]
	of the tangent vectors tttx[[i]] of order i and j respectively of the null curve
	Sl2CFrameModified[a,b][z] in natural parametrization, 1<=i,j<=5. More detailed explanation:
	We transfer Sl2CFrameModified[a,b][z] into KAN-parametrization putting\n
	sl2[z_]=Sl2CFrameModified[a,b][z];\n
	sl2KAN[z_]=Sl2CIwasawaParInvers[sl2[z]][[1]]//Simplify;\n
	Next we compute a list of higher order tangent vectors by\n
	tttx={ttt1[a_,b_][z_]=FullSimplify[D[sl2KAN[z],z]],\n
	ttt2[a_,b_][z_]=FullSimplify[covDerofVectorfieldKANalongCurve[sl2KAN,ttt1[a,b]][z]],\n
	ttt3[a_,b_][z_]=FullSimplify[covDerofVectorfieldKANalongCurve[sl2KAN,ttt2[a,b]][z]],\n
	ttt4[a_,b_][z_]=FullSimplify[covDerofVectorfieldKANalongCurve[sl2KAN,ttt3[a,b]][z]],\n
	ttt5[a_,b_][z_]=FullSimplify[covDerofVectorfieldKANalongCurve[sl2KAN,ttt4[a,b]][z]]};\n
	Finally, the entries cij of matrixDerSkalarprodukte[a][z] are obtained by\n
	cij=(mm[a_,b_][z_]=invariantmetricKAN[sl2KAN[z]][tttx[[i]]][tttx[[j]]]//Simplify;
	 mm[a,bbcan[a]][z]//Simplify).";


schwarzderbr::usage="schwarzderbr[f][z]=Sqrt[3*D[f[z],z,z]^2-2*D[f[z],z]*D[f[z],{z,3}]]/D[f[z],z]
	 is the Schwarzian derivative of a function f[z]."


aFunModifiedForEqualG::usage="aFunModifiedForEqualG[qq,b][z] is an operator designed 
	so that the matrix xc=nilpotentsl2MatrixModified[aFunModifiedForEqualG[q,b],b][z]
	satisfies xc[[1,1]]/xc[[2,1]]=q[z], i.e., the g[z]-term of the Bryantdata of all
	matrices nilpotentsl2MatrixModified[aFunModifiedForEqualG[q,b],b][z]
	is the same function.";

aFunForEqualG::usage="aFunForEqualG[qq,b][z] is is an operator designed so that 
	xc=nilpotentsl2Matrix[aFunForEqualG[q,b],b][z] satisfies xc[[1,1]]/xc[[2,1]]=q[z],
	i.e., the g[z]-term of the Bryantdata of all matrices 
	nilpotentsl2Matrix[aFunForEqualG[q,b],b][z] is the same function.";

bbcan::usage="bbcan[c1,c2][a][z]:=c1+c2*Integrate[D[a[z],z]*E^(-Integrate[a[z]/D[a[z],z],z]),z]
	is a function that solves the differential equation
	cmcKappa[a,bbcan][z]=1, where cmcKappaKANOBS[a,b][z]
	is the length of the second covariant derivative of the curve Sl2CFrameModified[a,b][z]
	with respect to the invariant complex Riemannian metric 'invariantmetricKAN'.
	bbcan[a][z] is bbcan[0,1][a][z]."

partielIntegrationbbcan::usage="partielIntegrationbbcan[a,z][term] transforms any expression
	'term' containing the integral bbcan[a][z] into an equivalent expression by transforming
	bbcan[a][z] according to the rule of partielle integration."

Sl2CFrameBROBS::usage="{g[z],om[z]} --> Sl2CFrameBROBS[g,om][z] is an implementation of
	R. Bryant's representation formula for nullcurves in Sl(2,C). It uses 'DSolve'
	for the corresponding system of linear differential equations.
	Therefore, it will not be very efficient. One should try 'Sl2CFrameBR', 'Sl2CFrameBR1'
	or 'Sl2CFrameBR2' instead."

yyFunForSl2CFrameBRaux::usage="{g[z],om[z]} --> yyFunForSl2CFrameBRaux[g,om][z] is an auxiliary
	operator needed by 'Sl2CFrameBR'."

riccatiEquationforSl2CFrameBR::usage="riccatiEquationforSl2CFrameBR[y][g,om][z]:=y[z]^2-2y'[z]==
	om[z]*4*g'[z] + schwarzderbr[g][z]^2 is the differential equation needed
	by the commands 'yyFunForSl2CFrameBRaux` and `Sl2CFrameBR`."

Sl2CFrameBR::usage="{g[z],om[z]} --> Sl2CFrameBR[g,om][z] is an implementation of
	R. Bryants representation formula for nullcurves in Sl(2,C). It assigns to any
	pair {g[z],om[z]} consisting of a meromorphic function g[z] and a meromorphic
	1-form om[z] a nullcurve null[z] by first solving the differential equation\n
	(1)\t(S[f][z]^2 - S[g][z]^2)/(4g'[z]) ==om[z]\n
	for f[z], where S[f][z] is the Schwarz derivative of a function f[z]. This solution
	is achieved by substituting y[z_] = f''[z]/f'[z], which gives S[f][z]^2=y[z]^2-2y'[z]
	and turns (1) into a (1-st order) Riccatti equation for y[z], that can be displayed with\n
	riccatiEquationforSl2CFrameBR[y][g,om][z]\nand which can be solved
	explicitely in terms of special functions by Mathematica in many cases.
	It can be displayed with riccatiEquationforSl2CFrameBR[y][g,om][z]
	Then f[z]=Integrate[Exp[Integrate[y[z],z]],z] is determined from y[z] and finally
	null[z_]=BianchiCaloSmallDouble[f, g][z] is the final result.
	Observe that BianchiCaloSmallDouble[f, g][z] is an algebraic representation
	formula for nullcurves that gives a result for almost any input data {f[z],g[z]}
	and that the two Bryant data of BianchiCaloSmallDouble[f, g][z] are just g[z] and
	(S[f][z]^2 - S[g][z]^2)/(4g'[z]). Therefore, it is an appropriate tool for reducing
	the solution of Bryants system to a first order differential equation and two integrations.
	There are 2 other versions, 'Sl2CFrameBR1' and 'Sl2CFrameBR2', of this command that can be
	tried, if this does not work.\n
	Note: Sl2CFrameBR[g,om][z] gives the correct result, while Sl2CFrameBR2[g,om][z] does not.
	The reason is a bug in Mathematica's (Version4.1) 'DSolve', that returnes fake solutions
	for many Eulerian equations. Type for instance:\n
	eulerDiffEquation[m_,n_]:=(eulerequ[a_][z_]=m*a[z]/z^2+n*a'[z]/z+a''[z];\n
		aa[z_]=a[z]/.Flatten[DSolve[eulerequ[a][z]==0,a[z],z]];eulerequ[aa][z]//Simplify)\n
	r=25;tab1=Flatten[Table[{m,n,eulerDiffEquation[m,n]},{m,-r,r},{n,-r,r}],1];\n
	tab2=Complement[tab1,Select[tab1,Last[#]==0&]];\n
	Drop[Transpose[tab2],-1]//TableForm\nIn Mathematica4.2 this error does not occur."

functionAforSl2CFrameBR1::usage="a[z_]=functionAforSl2CFrameBR1[g_,om_][c1_,c2_][z_]:=\nc2/
	Exp[Integrate[(functionBforSl2CFrameBR1[g,om][c1][zz]+g[zz])*om[zz],zz]]/.zz->z
	is a function needed by Sl2CFrameBR1[g,om][c1,c2][z] for solving the Bryantsystem via
	Sl2CFrameModified[a,b][z]; c1 and c2 being constants of integration.";

functionBforSl2CFrameBR1::usage="b[z_]=functionBforSl2CFrameBR1[g,om][c1][z] is the solution
	of riccatiEquationforSl2CFrameBR1[b][g,om][z], c1 being a constant of integration.
	Needed by Sl2CFrameBR1[g,om][c1,c2][z] for solving the Bryantsystem via
	Sl2CFrameModified[a,b][z]. If Mathematica can not solve this equation, the string
	'RiccatiequationNOTsolvable' is returned."

riccatiEquationforSl2CFrameBR1::usage="
	riccatiEquationforSl2CFrameBR1[y_][g_,om_][z_]:={y'[z]==-(y[z]+g[z])^2*om[z]} is
	a differential equation needed by functionAforSl2CFrameBR2."

Sl2CFrameBR1::usage="{g[z],om[z]} -->ff[z]=Sl2CFrameBR1[g,om][c1,c2][z] is an other implementation
	of R. Bryants representation formula for nullcurves in Sl(2,C) reducing the problem to a Ricatti
	equation (type 'riccatiEquationforSl2CFrameBR1[b][g,om][z]' to see it)
	by trying to establish explicit functions {a[z],b[z]} such that
	ff[z]=Sl2CFrameModified[a,b]][z]. If Mathematica can not solve it and
	riccatiEquationforSl2CFrameBR1[b][g,om][z] is returned unchanged, the string
	'RiccatiequationNOTsolvable' is returned. c1 are c2 being constants of integration.
	Sl2CFrameBR1[g,om][z] is Sl2CFrameBR1[g,om][1,1][z].
	There are 2 other versions, 'Sl2CFrameBR2' and 'Sl2CFrameBR', of this command that could succeed
	by chance if Sl2CFrameBR1 does not.";

linearDiffEqof2ndOrder::usage="{g[z],omega[z]} --> linearDiffEqof2ndOrder[a][g,om][z]
	gives the 2-nd order homogeneous linear differential equation
	a''[z]==-(a[z]*omega[z]*g'[z])+a'[z]*omega'[z])/omega[z]] for a function a[z] whose solution is the
	crucial term for the solution Sl2CFrameBR2[g,om][c1,c2][z] of the Bryant system corresponding to
	g[z] and omega[z].";

functionAforSl2CFrameBR2::usage="a[z_]=functionAforSl2CFrameBR2[g,om][c1,c2][z] is the solution
	of the linear differential equation linearDiffEqof2ndOrder[a][g,om][z]. It is needed by
	Sl2CFrameBR2[g,om][c1,c2][z] for solving the Bryantsystem via Sl2CFrame[a,b][z]; c1 and c2 being
	constants of integration.";

functionBforSl2CFrameBR2::usage="b[z_]=functionBforSl2CFrameBR2[g,om][c1,c2][z] is the second function
	needed by Sl2CFrameBR2[g,om][c1,c2][z] for solving the Bryantsystem via Sl2CFrame[a,b][z];
	c1 and c2 being constants of integration. b[z] is derived from
	a[z_]=functionAforSl2CFrameBR2[g,om][c1,c2][z] via b[z_]=a'[z]/om[z]-a[z]*g[z]";

Sl2CFrameBR2::usage="{g[z],om[z]} --> ff[z]=Sl2CFrameBR2[g,om][c1,c2][z] is an other implementation
	of R. Bryants representation formula for nullcurves in Sl(2,C) reducing the problem to a 2-nd
	order linear differential equation, using DSolve to determine explicit functions {a[z],b[z]}
	such that ff[z]=Sl2CFrame[a,b]][z]. The solutions of the system
	gl=Thread[nullcurveToBryantdata[Sl2CFrame[a,b]][zz]=={g[zz],om[zz]}], if explicit solutions
	are found, are provided by a[z_]=functionAforSl2CFrameBR2[g,om][c1,c2][z] and
	b[z_]=functionBforSl2CFrameBR2[g,om][c1,c2][z] respectively.
	Sl2CFrameBR2[g,om][z] is Sl2CFrameBR2[g,om][1,0][z],c1 and c2 being constants of integration.
	There are 2 other versions, 'Sl2CFrameBR1' and 'Sl2CFrameBR', of this command that can be
	tried if 'Sl2CFrameBR2' does not work."

cmcCPPKAN::usage="cmcds2[z]=cmcCPPKAN[a,b][z] is the derivative of the natural
	parameter of the null curve in Sl(2,C) given by the integral representation formula
	Sl2CFrameModified[a,b][z]. The expression is obtained as the length of the
	2-nd covariant derivative of Sl2CFrameModified[a,b][z]. Explicit computation:
	cmcds2[z_]=invariantmetricKAN[sl2KAN[z]][covDerVectorKAN2[a,b][z]][covDerVectorKAN2[a,b][z]]//Sqrt
	where sl2KAN[z] serves temporarily as short expression for
	Sl2CIwasawaParInvers[Sl2CFrameModified[a,b][z]][[1]]//Simplify;\n
	cmcCPPKAN[pair][z] is cmcCPPKAN[a,b][z] where pair[z_]={a[z],b[z]}."

cmcKappaKANOBS::usage="cmcCurvature[z_]=cmcKappaKANOBS[a,b][z] is the square of the length of the
	3-rd covariant derivative of the null curve in Sl(2,C) given by the integral representation formula
	Sl2CFrameModified[a,b][z]. As such, it is an analogue of the Study parameter that
	occurs in minimal surface theory. The expression is obtained using the commands
	covDerVectorKAN[a,b][z] and invariantmetricKAN[point][vec1][vec2]:
	cmcKappaKANOBSroot[z_]=
		invariantmetricKAN[sl2KAN[z]][covDerVectorKAN3[a,b][z]][covDerVectorKAN3[a,b][z]]//Sqrt
	where sl2KAN[z] serves temporarily as short expression for
	Sl2CIwasawaParInvers[Sl2CFrameModified[a,b][z]][[1]]//Simplify;\n
	cmcKappaKANOBS[pair][z] is cmcKappaKANOBS[a,b][z] where pair[z_]={a[z],b[z]}."

cmcKappaKANOriginal::usage="cmcCurvature[z_]=cmcKappaKANOriginal[a,b][z]
	is our preliminary version of cmcKappaKAN[a,b][z]."

cmcKappaKAN::usage="cmcCurvature[z_]=cmcKappaKAN[a,b][z] is the second differential invariant of
	a null curve gamma[z] in Sl(2,C) given by the integral representation formula
	gamma[z_]=Sl2CFrameModified[a,b][z] in terms of two arbitrary meromorphic functions a[z] and b[z].
	We call this invariant the Sl(2,C)-nullcurve-curvature. It is defined as the length of the vector field
	t3[z] along gamma[z] given as the third covariant derivative of gamma[z] with respect to the
	natural parameter of gamma[z]. This means that in the case when z is the natural parameter of
	gamma[z], then cmcKappaKANOBS[a,b][z] and cmcKappaKAN[a,b][z] give the same results.
	The Sl(2,C)-nullcurve-curvature is an analogue of the Study parameter that occurs in minimal
	surface theory. The expression is obtained by computing the 3-rd order tangent vector with
	the help of the 3-rd order chain rule. Next its
	(complex) length is computed by using the identities <t1,t1>=<t1,t2>=0, <t2,t2>=pz^4=-<t1,t3>,
	and <t2,t3>=2*pz^2*pzz for the mutual scalar products of the tangent vectors t1,t2,t3 of order 1,2,3
	resp. of gamma[z], where pz is the derivative of
	the natural parameter of gamma[z], given by the formula  pz = Sqrt[cmcCPPKAN[a, b][z]].
	The resulting formula is
	cmcKappaKAN[a, b][zx]/pz^6 + 2*pzzz/pz^3 - 9*pzz^2/pz^4
	where pzz and pzzz are 2-nd and 3-rd derivatives of the natural parameter."

nilpotent::usage="nilpotent[a_]:={{1,a},{0,1}}//Simplify"

abelian::usage="abelian[a_]:=DiagonalMatrix[{a,1/a}]//Simplify"

compact::usage="compact[c_]:={{Cos[c],-Sin[c]},{Sin[c],Cos[c]}}//Simplify"

Sl2CIwasawaPar::usage="Sl2CIwasawaPar[a_,b_,c_]:=
	compact[I*Log[a]].abelian[b].nilpotent[c] is an algebraic parametrization
	of the special linear group Sl(2,C) related to the canonical decomposition
	of its Lie-algebra into a compact, abelien and nilpotent part.
	Sl2CIwasawaPar[vec_] is the same but expects a list of variables as input.";

Sl2CToSO13::usage="matrix --> Sl2CToSO13[matrix] is a 'quasi-group homomorphism' of
	the full linear group Gl(2,C) to SO(1,3), where 'quasi' means, that it is not
	uniquely defined. It is not an accurate homomorphism, since we were forced to
	include the root of the square of the complex norm of the determinant of 'matrix',
	which is not a unique-valued function, except in Mathematica
	where in combination with 'PowerExpand' unique (sometimes fake) results are returned.
	However, restricted to the subgroup Sl(2,C), an accurate
	group homomorphism is obtained from Sl2CToSO13. Possible tests:\n
	test1:=(ma=Sl2CIwasawaPar[a,b,c];mb=Sl2CIwasawaPar[ax,bx,cx];\n
	\tSl2CToSO13[ma].Sl2CToSO13[mb]-Sl2CToSO13[ma.mb]//Simplify)\n
	test2:=(ma={{ar,br},{cr,dr}}+I*{{af,bf},{cf,df}};\n
	\tmb={{arr,brr},{crr,drr}}+I*{{aff,bff},{cff,dff}};\n
	\tkk=Sl2CToSO13[ma].Sl2CToSO13[mb]//hyperbolicComplexExpand//PowerExpand//Simplify\n;
	\tttzu:=(Inverse[Sl2CToSO13[ma.mb]]//.hyperbolicComplexargumentrule)//
	PowerExpand//Simplify//PowerExpand//Simplify;
	\tkk.ttzu//Simplify)//Timing\n
	Out[41]={270.35 Second, {{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}}}\n
	Sl2CToSO13[a11,a12,a21,a22,b11,b12,b21,b22] is the same, accepting 8 real numers, namely
	the real and imaginary parts of the entries of 'matrix' as input.\n

	The relations to the 1-parameter subgroups
	Sl2CIwasawaPar[a,1,0]], Sl2CIwasawaPar[1,b,0]], Sl2CIwasawaPar[1,1,c]] and
	the subgroups llLoren[1,2][a], llLoren[1,3][b], llLoren[1,4][c] and\n
	llEukl[2,3][a], llEukl[2,4][b], llEukl[3,4][c] of SO(1,3)\n
	are shown by the following terms, wich return the null matrix:\n
	Sl2CToSO13[Sl2CIwasawaPar[a+b*I//Exp,1,0]]-llLoren[1,3][-2a].llEukl[2,4][2b]//Simplify\n
	Sl2CToSO13[Sl2CIwasawaPar[1,c+d*I//Exp,0]]-llLoren[1,4][2c].llEukl[2,3][2*d]//Simplify\n
	Sl2CToSO13[Sl2CIwasawaPar[1,e+f*I//Exp,0]]-llLoren[1,4][2e].llEukl[2,3][2*f]//Simplify"

Sl2CToSO13Differential::usage="matrix --> Sl2CToSO13Differential[matrix] is the Lie algebra homomorphism
	of sl(2,C) to so(1,3), defined as the differential of  the group homorphism 'Sl2CToSO13'.
	It assigns to an sl(2,C)-matrix ma={{a11,a12},{a21,-a11}}+I*{{b11,b12},{b21,-b11}} the
	so(1,3)-matrix D[Sl2CToSO13[IdentityMatrix[2]+t*ma],t]/.t->0.
	Sl2CToSO13Differential[a11,a12,a21,b11,b12,b21] is the same, but expecting 6 real numbers,
	the real and imaginary parts of the entries ma11, ma12, ma21 of ma as input.";

Sl2CToSO13InversDifferential::usage="s --> Sl2CToSO13InversDifferential[s] is the Lie algebra homomorphism
	of so(1,3) to sl(2,C) inverse to Sl2CToSO13Differential.";

Sl2CToSO13Invers::usage="SO13matrix --> Sl2CToSO13[SO13matrix] is a right inverse of the
	group homomorphism Sl2Cmatrix --> Sl2CToSO13[Sl2Cmatrix]. The command is defined
	by means of 'lorentzGroupIwasawaInvers' and `Sl2CIwasawaPar` as follows:\n
	r6Toc3[v_]:={v[[1]]+v[[2]]*I,v[[3]]+v[[4]]*I,v[[5]]+v[[6]]*I}//Chop;\n
	c3Exp[v_]:={Exp[v[[1]]],Exp[v[[2]]],v[[3]]};\n
	r6Toc3Exp[v_]:=v//r6Toc3//c3Exp;\n
	Sl2CToSO13Invers[mm_]:=mm//lorentzGroupIwasawaInvers//r6Toc3Exp//Sl2CIwasawaPar;\n
.
	Unfinished up to now (June 30, 2003).
	Some failures might be caused by 'lorentzGroupIwasawaInvers'."

Sl2CIwasawaParInversX::usage="w-->Sl2CIwasawaParInversX[w] is a
	version of Sl2CIwasawaParInvers[w] whose construction uses the fact that under
	matrix multiplikation w-->Transpose[w].w the compact part factors out immediately.
	Together with the command 'PowerExpand' a unique result {a,b,c} is obtained,
	that has to be completed by a second {-a,-b,c} however."
	
Sl2CIwasawaParInvers1::usage="w -->Sl2CIwasawaParInvers1[w] is the
	first component of the inverse map to the parametrization
	{a,b,c}--->Sl2CIwasawaPar[a,b,c], i.e., a pair {a,-a}, where a and -a are 
	complex numbers such that w=compact[I*Log[a]].abelian[b].nilpotent[c]=
	compact[I*Log[-a]].abelian[b].nilpotent[c].";

Sl2CIwasawaParInvers2::usage="w -->Sl2CIwasawaParInvers1[w] is the
	second component of the inverse map to the parametrization 
	{a,b,c}--->Sl2CIwasawaPar[a,b,c], i.e., a  pair {b,-b}, where b and -b are 
	complex numbers such that w=compact[I*Log[a]].abelian[b].nilpotent[c]=
	compact[I*Log[a]].abelian[-b].nilpotent[c].";

Sl2CIwasawaParInvers3::usage="w --> Sl2CIwasawaParInvers1[w] is the
	third component of the inverse map to the parametrization 
	{a,b,c}--->Sl2CIwasawaPar[a,b,c], i.e., a complex number c 
	(better to say the pair {c,c}), such that w=compact[I*Log[a]].abelian[b].nilpotent[c].";

Sl2CIwasawaParInvers::usage="w-->Sl2CIwasawaParInvers[w] is the
	inverse map to the parametrization {a,b,c}--->Sl2CIwasawaPar[a,b,c]. 
	More precisely, Sl2CIwasawaParInvers[w] gives two triples {a,b,c} and {-a,-b,c}
	such that w=Sl2CIwasawaPar[a,b,c]=Sl2CIwasawaPar[-a,-b,c].
	The three components of Sl2CIwasawaParInvers[w] can be obtained separately with 
	Sl2CIwasawaParInversi[w] (i=1,2,3).
	Note  that c is unique in contrast to a and b. 
	A convincing check is given by the following term:
	(ii=2;(**or ii=1;**)
	  zz:=Random[Real,{-99,99}];z:=zz+I*zz
	  test:=Module[{w=Sl2CIwasawaPar[z,z,z],aa,bb,cc,e},
	  aa=Sl2CIwasawaParInvers1[w][[ii]];
	  bb=Sl2CIwasawaParInvers2[w][[ii]];
	  cc=Sl2CIwasawaParInvers3[w][[ii]];
	  e=Chop[w-Sl2CIwasawaPar[aa,bb,cc],10^-7]//Flatten//Union;e[[1]]];
		Table[test,{1000}])"

Sl2CIwasawaParDifferential::usage="
	{point,vector}={{a,b,c},{x,y,z}}--> Sl2CIwasawaParDifferential[a,b,c][x,y z]
	is the differential (i.e., the tangent map) of {a,b,c} -> Sl2CIwasawaPar[a,b,c].
	Inverse operation to Sl2CIwasawaParDifferentialInvers. In other words and in formulas:
	Sl2CIwasawaParDifferential[a,b,c][x,y,z] is the same as\n
	(Inverse[Sl2CIwasawaPar[a,b,c]].(D[Sl2CIwasawaPar[a+t*x,b+t*y,c+t*z],t]//.t->0))//Simplify.\n
	The return is a matrix X of sl(2,C) (i.e., a tracefree 2x2-matrix), that has to
	be considered has as tangent vector at the point P=Sl2CIwasawaPar[{a,b,c}] of C^3 defined
	as transform of X by left translation with P.\n
	Sl2CIwasawaParDifferential[point][vector],\n
	Sl2CIwasawaParDifferential[a,b,c][vector],\n
	Sl2CIwasawaParDifferential[point][x,y,z]\n
	are the same but expecting lists as input."
	
Sl2CIwasawaParDifferentialInvers::usage="
	{matrix,tangentmatrix}={{{a11,a12},{a21,a22}},{{x11,x12},{x21,x22}}} -->
	Sl2CIwasawaParDifferentialInvers[a11,a12,a21,a22][x11,x12,x21,x22] is the
	differential (i.e., the tangent map) of matrix -> Sl2CIwasawaParInvers[matrix].
	Inverse operation to Sl2CIwasawaParDifferential. In other words and in formulas:
	For mu={{a,b},{c,d}} and xu={{x11,x12},{x21,x22}} holds
	Sl2CIwasawaParDifferentialInvers[mu][xu]-(D[Sl2CIwasawaParInvers[mu+t*mu.xu],t][[1]]/.t->0)//Simplify\n
	The return is a vector of C^3, that has to be considered as tangent vector
	at the point Sl2CIwasawaParInvers[{{a11,a12},{a21,a22}}] of C^3.\n
	Sl2CIwasawaParDifferential[matrix][tangentmatrix],\n
	Sl2CIwasawaParDifferential[a11,a12,a21,a22][tangentmatrix],\n
	Sl2CIwasawaParDifferential[matrix][x11,x12,x21,x22]\n
	are the same but expecting as input four variables in place
	of the corresponding matrices."

Sl2CIwasawaParInversXX::usage="m={{a,b},{c,d}} --> Sl2CIwasawaParInversXX[signum][m] or
	Sl2CIwasawaParInversXX[signum][a,b,c,d] is another version of Sl2CIwasawaParInvers[{{a,b},{c,d}}]
	based on Mathematica's response to\n
	pp={a,b,c};mm=Sl2CIwasawaPar[pp];mmx={{ax,bx},{cx,dx}};\n
	gl=Join[FullSimplify[Thread[Flatten[mmx-mm]=={0,0,0,0}]],{Det[mmx]==1}];\n
	sol=Solve[gl,pp];\n
	The cariable 'sign' should be +1 or -1 and determines, which of the two solutions 
	of this equation is used."

Sl2CIwasawaParInversXX1::usage="m={{a,b},{c,d}} --> Sl2CIwasawaParInversXX1[m] or Sl2CIwasawaParInversXX1[a,b,c,d]
	is Sl2CIwasawaParInversXX[-1][m] resp. Sl2CIwasawaParInversXX[-1][a,b,c,d]."

Sl2CIwasawaParInversXX2::usage="m={{a,b},{c,d}} --> Sl2CIwasawaParInversXX2[m] or Sl2CIwasawaParInversXX2[a,b,c,d]
	is Sl2CIwasawaParInversXX[1][m] resp. Sl2CIwasawaParInversXX[1][a,b,c,d]."

Sl2CIwasawaParDifferentialInversXX::usage="(m={{a,b},{c,d}},n={{x,y},{u,v}}) --> 
	Sl2CIwasawaParDifferentialInversXX[sign][m][n] or 
	Sl2CIwasawaParDifferentialInversXX[sign][{{a,b},{c,d}}][{{x,y},{u,v}}] is the differential
	of the map m --> Sl2CIwasawaParInversXX[signum][m]. This expression was defined as the 
	Mathematica-output of the command\n
	Sl2CIwasawaParDifferentialInversXXoriginal[sign_][m_][x_]:=
	\t(D[Sl2CIwasawaParInversXX[sign][m+t*m.x],t]//.t->0)//Simplify"

Sl2CIwasawaParDifferentialInversXX1::usage="(m={{a,b},{c,d}},n={{x,y},{u,v}} --> 
	Sl2CIwasawaParDifferentialInversXX1[m][n] or
	Sl2CIwasawaParDifferentialInversXX1[{{a,b},{c,d}}][{{x,y},{u,v}}] is 
	Sl2CIwasawaParDifferentialInversXX[-1][m][n] resp. 
	Sl2CIwasawaParDifferentialInversXX[-1][{{a,b},{c,d}}][{{x,y},{u,v}}].
	Mixed versions available are Sl2CIwasawaParDifferentialInversXX1[{{a,b},{c,d}}][][n] and 
	Sl2CIwasawaParDifferentialInversXX1[m][{{x,y},{u,v}]."

Sl2CIwasawaParDifferentialInversXX2::usage="(m={{a,b},{c,d}},n={{x,y},{u,v}} --> 
	Sl2CIwasawaParDifferentialInversXX2[m][n] or
	Sl2CIwasawaParDifferentialInversXX2[{{a,b},{c,d}}][{{x,y},{u,v}}] is 
	Sl2CIwasawaParDifferentialInversXX[1][m][n] resp. 
	Sl2CIwasawaParDifferentialInversXX[1][{{a,b},{c,d}}][{{x,y},{u,v}}].
	Mixed versions available are Sl2CIwasawaParDifferentialInversXX2[{{a,b},{c,d}}][][n] and 
	Sl2CIwasawaParDifferentialInversXX2[m][{{x,y},{u,v}]."

commutatorKAN::usage="{{p={a,b,c},v1={x1,y1,z1},v2={x2,y2,z2}} --> commutatorKAN[p][v1,v2]
	is the coordinate expression for the comutator of two tangent vectors v1,v2 at a point
	p of Sl(2,C) in KAN-parametrisation {a,b,c} --> Sl2CIwasawaPar[a,b,c]. The arguments
	p,v1,v2 must be given as the corresponding tripels of complex numbers. 
	The notion of commutator has to be understood as follows: The tangent vectors v1, v2
	define unique left invariant vector fields X1, X2 on the Lie-group Sl(2,C) such that
	X1[p]=v1 and X2[p]=v2. The commutator X=[X1,X2] of these is a new left 
	invariant vector field on Sl(2,C), defined in the sense of the 
	basic notion the commutator of two vector fileds in differential geometry.
	The value X[p] of X at p commutatorKAN[p][v1,v2]. The command\n\n
	commutatorKANoriginal[point_][vector1_,vector2_]:=Module[{\n
	\tcorrespondingMatrix=Sl2CIwasawaPar[point],inversematrix,\n
	\tcorrespondingsltwoCmatrix1,correspondingsltwoCmatrix2,comm},\n
	\tinversematrix=correspondingMatrix//Inverse;\n
	\tcorrespondingsltwoCmatrix1=inversematrix.Sl2CIwasawaParDifferential[point][vector1];\n
	\tcorrespondingsltwoCmatrix2=inversematrix.Sl2CIwasawaParDifferential[point][vector2];\n
	\tcomm=commutator[correspondingsltwoCmatrix1,correspondingsltwoCmatrix2];\n
	\tSl2CIwasawaParDifferentialInvers[correspondingMatrix][correspondingMatrix.comm]//Simplify]\n\n
	transfers this idea into a Mathematica expression and returns the explicit formula by
	commutatorKANoriginal[{a,b,c}][{x1,y1,z1},{x2,y2,z2}].\n
	commutatorKAN[a,b,c][x1,y1,z1][x2,y2,z2] and commutatorKAN[a,b,c][v1,v2] are 
	the same but accepting different type of input.
	Numerical check:"
	
(**is written in conformity with this idea**)

commutatorKANoriginal::usage="An other version of commutatorKAN[p][v1,v2]."

varexplicitKANcan::usage="varexplicitKANcan[u1,u2,u3][a][z] is the linear combination\n
	u1[z]*vv1[a,b][z]+u2[z]*vv2[a,b][z]+u3[z]*vv3[a,b][z]\n
	of the three sl(2,C)-matrices vvi[a,b][z] (i=1,2,3) that represent the covariant
	derivatives of orders i=1,2,3 of the curve Sl2CFrameModified[a,b][z],
	for b[z]=bbcan[a][z] (see under ?bbcan), i.e., for the case of natural parametrization.
	and where u1[z],u2[z],u3[z] are arbitrary
	coefficient functions.\n
	We obtain the derivatives vvi with the help of the KAN-parametrization
	{x,y,z}-->Sl2CIwasawaPar[x,y,z] and retain the results under covDerVectorKAN1[a,b][z], 
	covDerVectorKAN2[a,b][z], covDerVectorKAN3[a,b][z] in this package.  We transform these 3-vectors
	into sl(2,C)-matrices by putting for i=1,2,3\n
	vvi[a_,b_][z_]=Sl2CIwasawaParDifferential[sl2KAN[z]][covDerVectorKANi[a,b][z]],\n
	where sl2KAN[z_]=Sl2CIwasawaParInvers[Sl2CFrameModified[a,b][z]][[1]] and
	replace finally b[z] by the function bbcan[a][z] that makes the parameter of the curve
	Sl2CFrameModified[a,b][z] the natural one.";

varexplicitNullKANcan::usage="varexplicitNullKANcan[u2,u3][a][z] is
	varexplicitKAN[(u2[#]^2+cmcStudy[#]*u3[#]^2)/(2*u3[#])&,u2,u3][a][z], 
	where cmcStudy[z] is a symbolic function that stands for cmcKappaKANOBS[a, bbcan[a]][z].
	It is the special case z-->varexplicitKANcan[uNull1,u2,u3][a][z], where 
	uNull1[z_]= (u2[z]^2+cmcStudy[z]*u3[z]^2)/(2*u3[z]) is obtained by solving
	Det[varexplicitKANcan[u1,u2,u3][a][z]]==0 for u1[z], i.e., i.e., the case of
	u1,u2,u3 in which varexplicitKAN[u1,u2,u3][a][z] becomes a null matrix 
	(nilpotent, determinant=0) of sl(2,C). 
	Observe that  L=varexplicitKANcan[u1,u2,u3][a][z]//Det equals L=-u2[z]^2+2*u1[z]*u3[z]-
	cmcKappaKANOBS[a,bbcan[a]][z]*u3[z]^2. Therefore, solving L=0 for u1[z] and inserting
	the resulting expression for u1[z] in varexplicitKANcan[u1,u2,u3][a][z]gives a 
	null matrix of sl(2,C)."

canKANFunctionG::usage="g[z_]=canKANFunctionG[u2,u3][a][z] and 
	om[z_]=canKANFunctionOmega[u2,u3][a][z] are the two functions such that\n
	varexplicitNullKANcan[u2,u3][a][z]==nilpotentsl2MatrixBasic[g,om][z]"
	
(**A simpler expression of canKANFunctionG[u2,u3][a][z] is obtained by applying 
	the additional command 'FullSimplify'.**)

canKANFunctionOmega::usage="See canKANFunctionG[u2,u3][a][z]."

cmcKappaRulecan::usage="cmcKappaRulecan[n][a,cmcCur][z] is a list of rules that
	replaces all derivatives of orders 3 to n of a[z] occuring in the expression
	'term' by the derivatives of orders up to n of the function obtained by solving\n
	cmcCur[z]^2==cmcKappaKANOBS[a,bbcan[a]][z] for a'''[z]."

cmcKappaRule::usage="cmcKappaRule[n][a,b,cmcCur][z] is a list of rules that replaces
	all derivatives of orders 3 to n of a[z] occuring in an expression 'term' by
	the derivatives of orders up to n of the function obtained by solving\n
	cmcCur[z]^2==cmcKappaKANOBS[a,b][z] for a'''[z].\n

	Important note: The intention was that the replacing gives the expression
	in terms of the curvature of the corresponding null curve. This is true only if
	the parametrization of the null curve is the canonical one. The command should
	be improved replacing in the construction cmcKappaKANOBS[a,b][z] by cmcKappaKAN[a,b][z]."

cmcCPPRule::usage="cmcCPPRule[a,b,CPP][z] is a list of rules that replaces all
	derivatives of orders 2 to 8 of a[z] occuring in an expression'term' by
	the derivatives of orders up to 6 of the function CPP[z] obtained by solving\n
	Solve[cmcCPPKAN[a,b][z]==CPP[z],D[a[z],z,z]][[1]] for a''[z].\n
	Important note: The intention was that the replacing gives the expression
	in terms of the curvature of the corresponding null curve. This is true only if
	the parametrization of the null curve is the canonical one. The command should
	be improved replacing in the construction cmcKappaKANOBS[a,b][z] by cmcKappaKAN[a,b][z]."
	
toSchwarzian::usage = "toSchwarzian[n][f,sf][z] is a rule that replaces the derivatives
	of f[z] of orders 3 to n+3 by the Schwarzian derivative sf[z]=schwarzderbr[f][z]
	and its respective derivatives. More precisely:\n
	sol=f'''[z]/.Solve[schwarzderbr[f][z]^2==sf[z]^2,f'''[z]][[1]]\n
	Table[D[f'''[z],{z,i}]->D[sol,{z,i}]//Simplify,{i,0,n}]]
	toSchwarzian[f,sf][z]is toSchwarzian[3][f,sf][z]"

tocmcKappacan::usage="tocmcKappacan[a,curv][term][z] replaces all derivatives D[a[z],{z,i}]
	of a[z] of orders i>2 occuring in the expression 'term' by the derivatives of
	orders up to n of the expression obtained by solving\n
	cmcCur[z]==cmcKappaKANOBS[a,bbcan[a]][z] for a'''[z]. The result will contain only
	a[z], a'[z], a''[z] and derivatives of the function curv[z], that symbolizes
	the differential invariant cmcKappaKANOBS[a,bbcan[a]][z] (CMC Study parameter ) of a
	null curve in natural parametrization. If a[z], a'[z], a''[z] do not occur, 'term'
	is a differential invariant of the given curve and the return 
	tocmcKappacan[a,curv][term] shows it's expression in terms of the CMC Study parameter."

tocmcKappa::usage="tocmcKappa[a,b,curv][term][z] replaces all derivatives D[a[z],{z,i}]
	of a[z] of orders i>2 occuring in the expression 'term' by the corresponding
	derivatives of the function obtained by solving cmcCur[z]^2==cmcKappaKANOBS[a,b][z]
	for a'''[z]. tocmcKappa[a,b,curv,CPP][term][z] is similar, but tries also to substitute
	the derivatives by the natural parameter using cmcCPPRule[a,b,CPP][z]."

tocmcKappaShortXcan::usage="tocmcKappaShortXcan[term] is the same as 
	tocmcKappacan[a,cmcStudy][term][z], replacing only derivatives of a[z] of orders
	k with 2 < k < 9, i.e.,\n
	tocmcKappaShortXcan[term_]:=(term//.cmcKappaRulecan[5][a,cmcStudy][z])//Simplify\n
	This command does not work inside the package, since the variables 'a, curv,z',
	are regarded as private, i.e. as CMCSurfaces`Private`a, 
	CMCSurfaces`Private`cmcCur and CMCSurfaces`Private`z
	We do not want to export them. So one may copy this for temporary use as short
	notation for tocmcKappacan[a,cmcStudy][term][z]."

tocmcKappaShortX::usage="tocmcKappaShortX[term] is the same as tocmcKappa[a,b,cmcStudy][term][z],
	replacing only derivatives of a[z] of orders k with 2 < k < 7, i.e.,\n
	tocmcKappaShortX[term_]:=(term //.cmcKappaRule[5][a,b,curv][z])//Simplify
	This command does not work inside the package, since the variables 'a, curv,z',
	are regarded as private, i.e. as CMCSurfaces`Private`a, 
	CMCSurfaces`Private`cmcCur and CMCSurfaces`Private`z
	We do not want to export them. So one may copy this for temporary use as short
	notation for tocmcKappa[a,b,cmcStudy][term][z]."
	
wurzelausdruck::usage="wurzelausdruck[a,b][z] is a complicated expression occuring as
	solution of the equation\n
	Solve[cmcKappaKANOBS[a,b][z]==cmcCur[z]^2,D[a[z],{z,3}]][[2]]\n
	for a'''[z]."

determineOrder::usage="determineOrder[term] looks in term for all derivatives with
	respect to the first variable x of any function f[x,y,...] of arbitrary number
	of variables occurring in 'term' and returns the maximum of the orders of these
	derivatives. (Still this command needs a refinement that permits to consider only
	derivatives of a fixed given function f.)"

determineOrderBasic::usage="determineOrderBasic[term] looks in 'term' for all
	partial derivatives of all functions f[x,y,...] of arbitrary number of variables
	occurring in 'term' and returns the maximum of the orders of the derivatives
	with respect to the first variable x."

onBasisofsl2C::usage="onBasisofsl2C is a tripel {f1,f2,f3} of matrices
	of sl(2,C) that are orthonormal with respect to the nondegenerate
	bilinear Form  killingFormSl2C[.,.]. The appropriate command that 
	verifies this assertion is:
	Table[killingFormSl2C[onBasisofsl2C[[i]],onBasisofsl2C[[j]]]/8,{i,3},{j,3}]";

sl2basisinCoords::usage="sl2basisinCoords[a][z] is the 3x3-matrix whose lines
	are {aai[[1,1]],aai[[1,2]],aai[[2,1]]}, i=1,2,3,where {aa1,aa2,aa3} is the basis
	of sl(2,C) corresponding to the moving frame of the curve
	Sl2CFrameModified[a,bbcan[a]][z] given in KAN-coordinates by
	{covDerVectorKAN1[a,bbcan[a]][z],covDerVectorKAN2[a,bbcan[a]][z],
	covDerVectorKAN3[a,bbcan[a]][z]}, i.e., \n
	aai=Sl2CIwasawaParDifferential[curveinC3][covDerVectorKANi[a,bbcan[a]][z]].This
	command is needed for the operation sl2CMatrix[z] --> sl2Coords[sl2CMatrix][a][z].";

sl2Coords::usage="sl2Coords[sl2CMatrix][a][z] gives the coefficients x,y,z such that
	sl2CMatrix=x*aa1+y*aa2+z*aa3, where
	aai=Sl2CIwasawaParDifferential[curveinC3][covDerVectorKANi[a,bbcan[a]][z]] are
	the sl(2,C) versions of the 3 first covariant derivatives of the null curve
	Sl2CFrameModified[a,bbcan[a]][z]."



	
killingFormSl2C::usage="killingFormSl2C[x,y]=4*(2*x11*y11+x21*y12+x12*y21)//Simplify
	is the Killing form of two tracefree matrices x={{x11,x12},{x21,-x11}} and 
	y={{y11,y12},{y21,-y11}}.";

killingFormofGln::usage ="{matrixA,matrixB} --> killingFormofGln[matrixA,matrixB]
	gives the killing form of the lie algebra gl(n,K of the full linear group
	Gl(n,K), where K can be the field of real or of complex numbers.";

allgemeinematrix::usage ="allgemeinematrix[a_,n_]:=Table[ToExpression[
	StringJoin[ToString[a],ToString[i],ToString[j]]],{i,n},{j,n}]
	is the matrix {{a11,...,a1n},{a21,...,a2n},...,{an1,...,ann}}."

orthonormierungGln::usage="orthonormierungGln[k][listOfquadraticMatrices] returnes a
	list of length k of quadratic matrices that are orthonormal with respect to
	the Killing form of gl(n,R) (resp. gl(n,C)) and that are produced by a version
	of the orthonormalization procedure that applies to the first k square matrices
	of 'listOfquadraticMatrices' using the symmetric bilinear form
	{a,b} --> killingFormofGln[a,b], a,b matrices of gl(n,R), (resp. gl(n,C)), as
	'scalar product'. If the matrices of 'listOfquadraticMatrices' are not linearly
	independent, the resulting list will contain a certain number of matrices with
	Killing-length 0. The matrix of all 'scalar products' of all pairs from the
	resulting list of matrices will be a diagonal matrix whose entries on the diagonal
	are -1, 0, +1. orthonormierungGln[listOfquadraticMatrices] is the same, but processes
	the whole list.";

normierungGln::usage="normierungGln[matrix]:=Module[{nn=killingFormofGln[matrix,matrix]},
	If[nn==0,1,vv/Sqrt[nn]]] produces a square matrix 'm' of length 
	killingFormofGln[m,m]=-1, 0, or +1, according to the sign of killingFormofGln[matrix,matrix]."

onBasisofGln::usage="onBasisofGln[n]is  the result of orthonormierungGln[standardBasis],
	where 'standardBasis' is the basis of gl(n,R) (resp. gl(n,C)), constructed
	for instance by the Mathematica - command\n
	standardBasis[n_]=(null=Table[0,{n},{n}];\ntemp=Table[null,{n},{n}];
	Do[temp[[i,j,i,j]]=1,{i,n},{j,n}];temp);\n
	It is a sequence of n^2  square matrices that are orthonormal with respect to
	'killingFormofGln'."

matrixofkillingFormofGln::usage="matrixofkillingFormofGln gives the matrix of the killing
	form of the lie algebra gl(n,K of the full linear group Gl(n,K), where K can be the
	field of real or of complex numbers, with respect to the ordinary basis 
	eij = the matrix with all entries null except that of index i,j.";

adXadYvonMatrix::usage="adXadYvonMatrix[basis][x,y,matrix] is the list {a,b,c}
	of the three coefficients a,b,c of ad[x][ad[y][matrix]] with respect to a given 
	basis 'basis'. Type for instance 
		check=adXadYvonMatrix[onBasisofsl2C][xx,yy,e1];
	Inner[Times,check,onBasisofsl2C,Plus]-ad[xx][ad[yy][e1]]//Simplify"

invariantmetricKAN::usage="invariantmetricKAN[aa][tt][ss] is the local expression of
	the invariant complex Riemannian metrik of Sl(2,C) defined by its Killing form in terms of 
	the coordinate system 
	aa={a,b,c}\in C^3 -->Sl2CIwasawaPar[a,b,c]. 
	tt and ss must be lists of complex numbers or functions of length 3 
	that represent their coordinates with respect to this coordinate system. 
	The final short form of the command was computed with 

invariantmetricKAN[aa_][tt_][ss_]:=Module[{
	tvec=(D[Sl2CIwasawaPar[aa+t*tt],t]/.t->0)//Simplify,
	svec=(D[Sl2CIwasawaPar[aa+t*ss],t]/.t->0)//Simplify,
	point=Sl2CIwasawaPar[aa],tx,sx},
	tx=Simplify[Inverse[point].tvec];sx=Simplify[Inverse[point].svec];
	killingFormSl2C[tx,sx]/8//Simplify]"	
	
invariantmetricTensorKAN::usage="invariantmetricTensorKAN[a,b,c] is the complex symmetric
	3x3-matrix that represents the complex Riemannian metric 
	invariantmetricKAN[{a,b,c}][vec1][vec2] on Sl(2,C). invariantmetricTensorKAN[p] is the
	same but expects a point p={a,b,c} as input."

gammaKANcollection::usage="gammaKANcollection[i][a,b,c]:={
	{gammaKAN[i,1,1][a,b,c],gammaKAN[i,2,1][a,b,c],gammaKAN[i,3,1][a,b,c]},\n
	{gammaKAN[i,1,2][a,b,c],gammaKAN[i,2,2][a,b,c],gammaKAN[i,3,2][a,b,c]},\n
	{gammaKAN[i,1,3][a,b,c],gammaKAN[i,2,3][a,b,c],gammaKAN[i,3,3][a,b,c]}},\
	is a collection of Christoffel symbols of the metric metrischerTensorKAN[a,b,c].\n
	gammaKANcollection[a,b,c] is the collection\n
	{gammaKANcollection[1],gammaKANcollection[2],gammaKANcollection[3]}\n
	of all Christoffel symbols."



gammaKAN::usage="gammaKAN[k,j,i][a,b,c] (1<= i,j,k <=3 and a,b,c \in C) are the
	Christoffel sympbols for the invariant complex Riemannian metrik on Sl(2,C) 
	defined by 1/8-th of the killing form of sl(2,C). The command works also for 
	numeric arguments as for instance in gammaKAN[1,2,3][3,I,Pi].
	To get the whole set of gamma's at a time type 'gammaKANcollection'."


covDerivativeKAN::usage="covDerivativeKAN[xx,yy][point] is the covariant derivative
	of two vector fields xx and yy on Sl(2,C) with respect to the Levi-Civita connection
	of the complex Riemannian metric invariantmetricKAN[point]. It is assumed that 
	point={a,b,c} is a triple of complex numbers representing the coordinate system 
	{a,b,c}\in C^3 --> Sl2CIwasawaPar[a,b,c] \in Sl(2,C)
	and that xx={x1[a,b,c],x2[a,b,c],x3[a,b,c]} and yy={y1[a,b,c],y2[a,b,c],y3[a,b,c]} 
	are given as triples of functions whose elements represent the coefficients of xx 
	(resp. yy) with respect to the basis formed by the tangent vectors to the 
	coordinate lines of {a,b,c}-->Sl2CIwasawaPar[a,b,c]."

christoffelSymbols::usage="christoffelSymbols[i,j,k][metrictensor][point]
	computes the Christoffel symbols of a metric tensor 'metrictensor' given as a 
	symmetric n x n-matrix of functions of n-variables point={x1,...,xn}.
	No checks of symmetry, positivity, nondegeneracy, or matching of dimensions are provided.
	2 Examples:\n
	mmm[a_,b_]:={{a,b^2},{b^2,-a}};
	mmm[vvv_]:=mmm[vvv[[1]],vvv[[2]]];
	Table[christoffelSymbols[1,j,k][mmm][{a,b}],{i,2},{j,2},{k,2}];\n

	(*2-nd example:*)n=3;\n
	mm[x_]:=Table[x[[i]]*x[[j]],{i,n},{j,n}]-IdentityMatrix[3]*(Plus@@x);
	mm[{a,b,c}]-Transpose[mm[{a,b,c}]];
	Table[christoffelSymbols[1,j,k][n][mm][{a,b,c}],{i,n},{j,n},{k,n}]//Simplify"

covDerofVectorfieldKANalongCurve::usage="covDerofVectorfieldKANalongCurve[gamma,vec][z]
	gives the coordinate expression of the covariant derivative of a
	vector field vec[z] defined along a curve gamma[z]  with respect to the parametrization
	{a,b,c} --> Sl2CIwasawaPar[a, b, c] of Sl(2,C) and the conformal structure
	invariantmetricKAN[a,b,c]. The curve gamma[z] and the vector field vec[z] must be given
	in terms of these coordinates as well, i.e., must be triples
	gamma[z_]={x1[z],x2[z],x3[z]} (resp. vec[z_]={v1[z],v2[z],v3[z]}) of functions
	of a complex parameter z."

covDerofVectorfieldalongCurveInsl2::usage="{nn[z],xx[z]}-->covDerofVectorfieldalongCurveInsl2[nn,xx][z]
	assigns to two meromorphic functions nn[z],xx[z] with values in the Lie agebra sl(2,C)
	the picture in sl(2,C) of the covariant derivative of the meromorphic vectorfield xx1[z]
	along a null curve ff[z] in Sl(2,C), obtained as solution of the system ff'[z]=ff[z].nn[z],
	where xx1[z] is the left transport xx1[z]=nn[z].xx[z] of the element xx[z] of sl(2,c)
	to the point nn[z]. It is related to the ordinary covariant derivative
	covDerofVectorfieldKANalongCurve on Sl(2,C) by\n
	Inverse[ff[z]].covDerofVectorfieldalongCurveInsl2[nn,xx][z]=
	\tcovDerofVectorfieldKANalongCurve[nnt,xxt][z].\n
	covDerofVectorfieldalongCurveInsl2[n11,n12,n21,x11,x12,x21][z] is the same, expecting the
	2x3 essential entries of nn and xx as input.\n

	A check of this command was carried out by computing the successive covariant derivatives
	of a null curve defined by two functions g[z] and om[z] in terms of the Bryantformula in
	two ways as follows:\n
	ff[z_]={{a11[z],a12[z]},{a21[z],a22[z]}};\n
	pp[z_]=Sl2CIwasawaParInvers[ff[z]][[1]];\n

	vvtemp={v1=toBryantframeData[2][a11, a12, a21, a22][g, om][z][\n
	Sl2CIwasawaParDifferential[pp[z]][tangentVectorKAN1[a11,a12,a21,a22][g,om][z]]],\n
	v2=toBryantframeData[2][a11, a12, a21, a22][g, om][z][\n
	Sl2CIwasawaParDifferential[pp[z]][tangentVectorKAN2[a11,a12,a21,a22][g,om][z]]],\n
	v3=toBryantframeData[2][a11, a12, a21, a22][g, om][z][\n
	Sl2CIwasawaParDifferential[pp[z]][tangentVectorKAN3[a11,a12,a21,a22][g,om][z]]],\n
	v4=toBryantframeData[2][a11, a12, a21, a22][g, om][z][\n
	Sl2CIwasawaParDifferential[pp[z]][tangentVectorKAN4[a11,a12,a21,a22][g,om][z]]],\n
	v5=toBryantframeData[2][a11, a12, a21, a22][g, om][z][\n
	Sl2CIwasawaParDifferential[pp[z]][tangentVectorKAN5[a11,a12,a21,a22][g,om][z]]]};\n

	vv={ableitung1[z_]=nilpotentsl2MatrixBasic[g,om][z],\n
	ableitung2[z_]=covDerofVectorfieldalongCurveInsl2[nilpotentsl2MatrixBasic[g,om],ableitung1][z],\n
	ableitung3[z_]=covDerofVectorfieldalongCurveInsl2[nilpotentsl2MatrixBasic[g,om],ableitung2][z],\n
	ableitung4[z_]=covDerofVectorfieldalongCurveInsl2[nilpotentsl2MatrixBasic[g,om],ableitung3][z],\n
	ableitung5[z_]=covDerofVectorfieldalongCurveInsl2[nilpotentsl2MatrixBasic[g,om],ableitung4][z],\n
	ableitung6[z_]=covDerofVectorfieldalongCurveInsl2[nilpotentsl2MatrixBasic[g,om],ableitung5][z]};\n
	Comparing the results with Take[vv,5]-vvtemp returns 5 zero-matrices.";

highercovDerKANofCurve::usage="highercovDerKANofCurve[n][gamma][t] gives
	the vector field of the n-th covariant derivative of the tangent vector field
	of a curve gamma[t] in Sl(2,C) with respect to the invariant metric invariantmetricKAN[a,b,c]."

(*************** Sl2CMatrixEXPParametrisierung and related stuff ********************)

brCPP::usage="brCPP[g,om][z] is the derivative of the length of the second order
	tangent vector of the null curve Sl2CFrameBROBS[g,om][z]. An analogue of the natural
	parameter of a minimal curve in C^2."

brKappa::usage="brKappa[g,om][z] is the derivative of the length of the third
	tangent vector of the null curve Sl2CFrameBROBS[g,om][z]. An analogue of the
	Study parameter (also called minimal curvature) of a minimal curve in C^2."

tangentVectorKAN1::usage="tangentVectorKAN2[a11,a12,a21,a22][g,om][z] is the tangent vector field
	of the nullcurve FF[z_]=Sl2CFrameBROBS[g,om][z] expressed in terms
	of the coordinate system 'Sl2CIwasawaPar' of Sl(2,C). Since there does not exist a general
	explicit formula expressing FF[z] in terms of g[z] and om[z] the unknown entries aij[z] of FF[z]
	enter into the expression. When forming derivatives or scalarproducts one can use the command
	toBryantframeData to eliminate the aij[z]'s and their derivatives as far as possible.";
tangentVectorKAN2::usage="tangentVectorKAN2[a11,a12,a21,a22][g,om][z] is the second tangent vector field
	of the nullcurve FF[z_]=Sl2CFrameBROBS[g,om][z] expressed in terms
	of the coordinate system 'Sl2CIwasawaPar' of Sl(2,C). Since there does not exist a general
	explicit formula expressing FF[z] in terms of g[z] and om[z] the unknown entries aij[z] of FF[z]
	enter into the expression. When forming derivatives or scalarproducts one can use the command
	toBryantframeData to eliminate the aij[z]'s and their derivatives as far as possible.";
tangentVectorKAN3::usage="tangentVectorKAN3[a11,a12,a21,a22][g,om][z] is the third tangent vector field
	of the nullcurve FF[z_]=Sl2CFrameBROBS[g,om][z] expressed in terms
	of the coordinate system 'Sl2CIwasawaPar' of Sl(2,C). Since there does not exist a general
	explicit formula expressing FF[z] in terms of g[z] and om[z] the unknown entries aij[z] of FF[z]
	enter into the expression. When forming derivatives or scalarproducts one can use the command
	toBryantframeData to eliminate the aij[z]'s and their derivatives as far as possible.";
tangentVectorKAN4::usage="tangentVectorKAN4[a11,a12,a21,a22][g,om][z] is the fourth tangent vector field
	of the nullcurve FF[z_]=Sl2CFrameBROBS[g,om][z] expressed in terms
	of the coordinate system 'Sl2CIwasawaPar' of Sl(2,C). Since there does not exist a general
	explicit formula expressing FF[z] in terms of g[z] and om[z] the unknown entries aij[z] of FF[z]
	enter into the expression. When forming derivatives or scalarproducts one can use the command
	toBryantframeData to eliminate the aij[z]'s and their derivatives as far as possible.";
tangentVectorKAN5::usage="tangentVectorKAN5[a11,a12,a21,a22][g,om][z] is the fifth tangent vector field
	of the nullcurve FF[z_]=Sl2CFrameBROBS[g,om][z] expressed in terms
	of the coordinate system 'Sl2CIwasawaPar' of Sl(2,C). Since there does not exist a general
	explicit formula expressing FF[z] in terms of g[z] and om[z] the unknown entries aij[z] of FF[z]
	enter into the expression. When forming derivatives or scalarproducts one can use the command
	toBryantframeData to eliminate the aij[z]'s and their derivatives as far as possible.";

Sl2CMatrixEXPparam::usage="Sl2CMatrixEXPparam[r,u,v] is a parametrization of
	Sl(2,C) obtained by introducing (with respect the orthogonal frame `onBasisofsl2C')
	3-dimensional polar coordinates {r Cos[u] Cos[v], r Cos[v] Sin[u], r Sin[v]} in the
	Lie-algebra sl(2,C) and then applying the matrix exponential. All together,
	Sl2CMatrixEXPparam is
	{r,u,v} -> X=r*Cos[u]*Cos[v]*e1+r*Cos[v]*Sin[u]*e2+r*Sin[v]*e3-->MatrixExp[X].
	A special feature of this command: The metric tensor has diagonal form
	- type invariantmetricTensorMatrixEXP[{r,u,v}]//MatrixForm"

Sl2CMatrixEXPparamInvers::usage="w\in Sl(2.C)-->Sl2CMatrixEXPparamInvers[w]
	is the inverse map to {r,u,v}->Sl2CMatrixEXPparam[r,u,v]."

Sl2CMatrixEXPparamInvers1::usage="w\in Sl(2.C)-->Sl2CMatrixEXPparamInvers1[w]
	is the first coordinate (radius) of Sl2CMatrixEXPparamInvers[w]."

Sl2CMatrixEXPparamInvers2::usage="w\in Sl(2.C)-->Sl2CMatrixEXPparamInvers2[w]
	is the second coordinate  (azimute??) of Sl2CMatrixEXPparamInvers[w]."

Sl2CMatrixEXPparamInvers3::usage="w\in Sl(2.C)-->Sl2CMatrixEXPparamInvers3[w]
	is the third coordinate of Sl2CMatrixEXPparamInvers[w]."

invariantmetricMatrixEXP::usage="invariantmetricMatrixEXP[aa][tt][ss]is the local expression of
	the invariant complex Riemannian metrik of Sl(2,C) defined by its Killing form in terms
	of the coordinate system  aa={a,b,c}\\in C^3 -->Sl2CMatrixEXPparam[a,b,c].
	tt and ss must be lists of complex numbers or functions of length 3  that
	represent their coordinates with respect to this coordinate system. The final short form
	of the command was computed with
	tvec=(D[Sl2CMatrixEXPparam[aa+t*tt],t]/.t->0)//Simplify
	svec=(D[Sl2CMatrixEXPparam[aa+t*ss],t]/.t->0)//Simplify
	point=Sl2CMatrixEXPparam[aa]
	tx=Simplify[Inverse[point].tvec]
	sx=Simplify[Inverse[point].svec]
	invariantmetricMatrixEXPxxx=killingFormSl2C[tx,sx]/8//Simplify"


invariantmetricTensorMatrixEXP::usage="invariantmetricTensorMatrixEXP[{r,u,v}] is the complex
	symmetric 3x3-matrix that represents the complex Riemannian metric
	invariantmetricMatrixEXP[{a,b,c}][vec1][vec2] on Sl(2,C).
	invariantmetricTensorMatrixEXP[r,u,v] is the same but expects a point p={r,u,v} as
	input. Note that this matrix has diagonal form and that it's Christoffelsymbols can
	be computed with christoffelSymbols[i, j, k][invariantmetricTensorMatrixEXP][{r, u, v}].
	To get a survey on them type
	Table[christoffelSymbols[1,j,k][invariantmetricTensorMatrixEXP][{r,u,v}],{j,3},{k,3}]//TableForm
	Table[christoffelSymbols[2,j,k][invariantmetricTensorMatrixEXP][{r,u,v}],{j,3},{k,3}]//TableForm
	Table[christoffelSymbols[3,j,k][invariantmetricTensorMatrixEXP][{r,u,v}],{j,3},{k,3}]//TableForm"

gammaMatrixEXP::usage="gammaMatrixEXP[i_,j_,k_][point_]:=
	christoffelSymbols[i,j,k][invariantmetricTensorMatrixEXP][{r,u,v}] are the Christoffel
	symbols of the invariant complex metric of SL(2,C) in the coordinate system
	point={r,u,v}-->Sl2CMatrixEXPparam[point]. gammaMatrixEXP[i,j,k][r,u,v] is the same,
	expecting the coordinates r,u,v as separate variables."


covDerofVectorfieldMatrixEXPalongCurve::usage="covDerofVectorfieldEXPalongCurve[gamma,vec][t]
	gives the covariant derivative of a vector field yy defined along a curve gamma[t] in
	Sl(2,C)with respect to the invariant metric invariantmetricMatrixEXP[a,b,c]. The curve gamma[z]
	and the vectorfield vec[z] must be defined as triples gamma[z_]={x1[z],x2[z],x3[z]}
	(resp. vec[z]={v1[z],v2[z],v3[z]} of functions of a complex parameter z.";

invariantmetricMatrixEXP::usage="covDerivativeMatrixEXP[xx,yy][point] is the covariant derivative of
	two vector fields xx and yy on Sl(2,C) with respect to the Levi-Civita connection of
	the complex Riemannian metric invariantmetricMatrixEXP[point]. It is assumed that
	point={a,b,c} is a triple of complex numbers representing the coordinate system
	{a,b,c}\in C^3 --> Sl2CMatrixEXPParametrisierung[a,b,c] \in Sl(2,C) and that
	xx={x1[a,b,c],x2[a,b,c],x3[a,b,c]} and yy={y1[a,b,c],y2[a,b,c],y3[a,b,c]}
	are given as triples of functions whose elements represent the coefficients of xx
	(resp. yy) with respect to the basis formed by the tangent vectors to the
	coordinate lines of {ab,c} --> Sl2CMatrixEXPParametrisierung[a,b,c].";

highercovDerMatrixEXPofCurve::usage="highercovDerMatrixEXPofCurve[n][gamma][t] gives the vector field
	of the n-th covariant derivative of the tangent vector field of a curve gamma[t]
	in Sl(2,C) with respect to the invariant metric invariantmetricMatrixEXP[a,b,c]."



(*************** usages - end ********************)


Begin["`Private`"]

nullcurveCanParameterPrime[nullcurve_][z_]:=
	cmcCPPKAN[nullcurveToModifiedData1[nullcurve],nullcurveToModifiedData2[nullcurve]][z]//Simplify;

nullcurveCurvature[nullcurve_][z_]:=
	cmcKappaKAN[nullcurveToModifiedData1[nullcurve],nullcurveToModifiedData2[nullcurve]][z]//Simplify;

nullcurveCheck[ff_][z_]:=Inverse[ff[z]].D[ff[z],z]//Det//Simplify

funHforprescribedCPP[f_,cpp_][c1_,c2_,c3_][z_]:=Module[{fp=Derivative[1][f][z],ff},
	ff=(c1+Integrate[f[z]*(c2+c3*Integrate[(E^Integrate[(-cpp[z]*f[z])/fp,z]*fp)/f[z]^2,z])*fp,z])/fp;
	Simplify[ff]];

Sl2CFrameMeromorphicCPP[f_,cpp_][c1_,c2_,c3_][z_]:=
	Sl2CFrameMeromorphic[f,funHforprescribedCPP[f,cpp][c1,c2,c3]][z]//Simplify;

Sl2CFrameMeromorphicCPP[f_,cpp_][z_]:=Sl2CFrameMeromorphicCPP[f,cpp][0,0,1][z]

Sl2CFrameMeromorphicCPPExp[f_,cpp_][z_]:=Module[{fp,x,a,t,v,w},fp=D[f[x],x];
	a=Exp[f[x]-Integrate[cpp[x]/fp,x]];
	v=Integrate[(a*fp)/E^(2*f[x]),x];
	w=E^Integrate[cpp[x]/fp,x];
	t={{-w,-(w*(a-E^(2*f[x])*v+2*Integrate[E^(2*f[x])*fp*v,x]))},
		{E^(-f[x])+v*w,(-(E^(4*f[x])*v^2)+2*(a+E^(2*f[x])*v)*
		Integrate[E^(2*f[x])*fp*v,x])/(a*E^f[x])}};
	(t/.x->z)//Simplify]

checkSl2CFrameMeromorphicCPPExp:=
	Sl2CFrameMeromorphicCPP[f,cpp][z]-Sl2CFrameMeromorphicCPP[Exp[f[#]]&,cpp][z]//Simplify

(**** leftinvers operations to Sl2CFrameMeromorphicCPP of 28.11.2002.******)

Sl2CFrameMeromorphicCPPInvers1[nullcurve_][c1_,c2_,c3_][z_]:=Sl2CFrameMeromorphicInvers1[nullcurve][z]


funHforprescribedCPPInvers[f_,fun_][c1_,c2_,c3_][zz_]:=Module[{f1=Derivative[1][f][z],t1,t2},
	t1=D[fun[z]*f1,z]/(f[z]*f1)//Simplify;t2=f[z]^2*D[t1,z]/(c3*f1);
	t1=-f1*D[t2,z]/(t2*f[z])/.z->zz;Simplify[t1]]

Sl2CFrameMeromorphicCPPInvers2[nullcurve_][c1_,c2_,c3_][z_]:=Module[{
	ff=Sl2CFrameMeromorphicCPPInvers1[nullcurve][c1,c2,c3][#]&,
	hh=Sl2CFrameMeromorphicInvers2[nullcurve][#]&},
	funHforprescribedCPPInvers[ff,hh][c1,c2,c3][z]//Simplify]

Sl2CFrameMeromorphicCPPInvers[nullcurve_][c1_,c2_,c3_][z_]:=Module[{
	ff=Sl2CFrameMeromorphicCPPInvers1[nullcurve][c1,c2,c3][#]&,
	hh=Sl2CFrameMeromorphicInvers2[nullcurve][#]&},
	{ff[z],funHforprescribedCPPInvers[ff,hh][c1,c2,c3][z]}//Simplify]

Sl2CFrameMeromorphicCPPInvers1[nullcurve_][z_]:=Sl2CFrameMeromorphicCPPInvers1[nullcurve][0,0,1][z]
Sl2CFrameMeromorphicCPPInvers2[nullcurve_][z_]:=Sl2CFrameMeromorphicCPPInvers2[nullcurve][0,0,1][z]
Sl2CFrameMeromorphicCPPInvers[nullcurve_][z_]:=Sl2CFrameMeromorphicCPPInvers[nullcurve][0,0,1][z]

Sl2CFrameModifiedCPPx[a_,cpp_][c1_,c2_][z_]:=Module[{
	qq=nullcurveCanParameterPrime[Sl2CFrameModified[a,b]][z],t},
	t=Sl2CFrameModified[a,b/.DSolve[qq==cpp[z],b,z][[1]]][z]//Simplify;
	t/.{C[1]->c1,C[2]->c2}(**unschöne Variante**)]

Sl2CFrameModifiedCPPWrong[a_,cpp_][c1_,c2_][z_]:=Module[{t,
	qq=nullcurveCanParameterPrime[Sl2CFrameModified[a,b]][z],
	bb=Function[{z},c2+c1*Integrate[E^Integrate[(-(a[t]*cpp[t])+
		Derivative[2][a][t])/Derivative[1][a][t],t],{t,0,z}]]},
	Sl2CFrameModified[a,bb][z]//Simplify]

Sl2CFrameModifiedCPP[a_,cpp_][c1_,c2_][z_]:=Module[{t,
	bb=Function[{z},c2+c1*Integrate[E^Integrate[(-(a[t]*cpp[t])+
		Derivative[2][a][t])/Derivative[1][a][t],t],{t,0,z}]]},
	Sl2CFrameModified[a,bb][z]//Simplify]

Sl2CFrameModifiedCPP[a_,cpp_][z_]:=Sl2CFrameModifiedCPP[a,cpp][1,0][z]

MESSAGEx:=Print["Numerical computations finished."];
MESSAGE:={};

directPlotUpperhalfSpace[ff_][u0_,u1_,v0_,v1_,pu_,pv_,opts___]:=
	Module[{du=(u1-u0)/pu,dv=(v1-v0)/pv,herm=ff[#].Conjugate[Transpose[ff[#]]]&,ecken,polygons},
	ecken=Table[herm[u+I*v]//N//hermitean2by2ToLorentz//lorentzmodelToUpperhalfSpace//Chop,
		{u,u0,u1,du},{v,v0,v1,dv}];MESSAGE;
	polygons=Flatten[Table[Graphics3D[
		Polygon[{ecken[[i,j]],ecken[[i+1,j]],ecken[[i+1,j+1]],ecken[[i,j+1]]}]],
			{i,pu},{j,pv}]];Clear[ecken];
	Show[polygons,opts]]


directPlotUpperhalfSpacePolar[ff_][r0_,r1_,phi0_,phi1_,pr_,pphi_,opts___]:=
	Module[{dr=(r1-r0)/pr,dphi=(phi1-phi0)/pphi,herm=ff[#].Conjugate[Transpose[ff[#]]]&,ecken,polygons},
	ecken=Table[herm[r*Exp[I*phi]]//N//hermitean2by2ToLorentz//lorentzmodelToUpperhalfSpace//Chop,
		{r,r0,r1,dr},{phi,phi0,phi1,dphi}];MESSAGE;
	polygons=Flatten[Table[Graphics3D[
		Polygon[{ecken[[i,j]],ecken[[i+1,j]],ecken[[i+1,j+1]],ecken[[i,j+1]]}]],
			{i,pr},{j,pphi}]];Clear[ecken];
	Show[polygons,opts]]

directPlotBallmodelDisplay[ff_][u0_,u1_,v0_,v1_,pu_,pv_,opts___]:=
	Module[{du=(u1-u0)/pu,dv=(v1-v0)/pv,herm=ff[#].Conjugate[Transpose[ff[#]]]&,ecken,polygons},
	ecken=Table[herm[u+I*v]//N//hermitean2by2ToLorentz//lorentzmodelToBallmodel//Chop,
		{u,u0,u1,du},{v,v0,v1,dv}];MESSAGE;
	polygons=Flatten[Table[Graphics3D[
		Polygon[{ecken[[i,j]],ecken[[i+1,j]],ecken[[i+1,j+1]],ecken[[i,j+1]]}]],
			{i,pu},{j,pv}]];Clear[ecken];
	Show[{drahtrahmen,polygons},DisplayFunction->$DisplayFunction,opts]]

directPlotBallmodel[ff_][u0_,u1_,v0_,v1_,pu_,pv_,opts___]:=
	Module[{du=(u1-u0)/pu,dv=(v1-v0)/pv,herm=ff[#].Conjugate[Transpose[ff[#]]]&,ecken,polygons},
	ecken=Table[herm[u+I*v]//N//hermitean2by2ToLorentz//lorentzmodelToBallmodel//Chop,
		{u,u0,u1,du},{v,v0,v1,dv}];MESSAGE;
	polygons=Flatten[Table[Graphics3D[
		Polygon[{ecken[[i,j]],ecken[[i+1,j]],ecken[[i+1,j+1]],ecken[[i,j+1]]}]],
			{i,pu},{j,pv}]];Clear[ecken];
	Show[{drahtrahmen,polygons},opts]]

directPlotBallmodelPolarDisplay[ff_][r0_,r1_,phi0_,phi1_,pr_,pphi_,opts___]:=
	Module[{dr=(r1-r0)/pr,dphi=(phi1-phi0)/pphi,herm=ff[#].Conjugate[Transpose[ff[#]]]&,ecken,polygons},
	ecken=Table[herm[r*Exp[I*phi]]//N//hermitean2by2ToLorentz//lorentzmodelToBallmodel//Chop,
		{r,r0,r1,dr},{phi,phi0,phi1,dphi}];MESSAGE;
	polygons=Flatten[Table[Graphics3D[
		Polygon[{ecken[[i,j]],ecken[[i+1,j]],ecken[[i+1,j+1]],ecken[[i,j+1]]}]],
			{i,pr},{j,pphi}]];Clear[ecken];
	Show[{drahtrahmen,polygons},DisplayFunction->$DisplayFunction,opts]]

directPlotBallmodelPolar[ff_][r0_,r1_,phi0_,phi1_,pr_,pphi_,opts___]:=
	Module[{dr=(r1-r0)/pr,dphi=(phi1-phi0)/pphi,herm=ff[#].Conjugate[Transpose[ff[#]]]&,ecken,polygons},
	ecken=Table[herm[r*Exp[I*phi]]//N//hermitean2by2ToLorentz//lorentzmodelToBallmodel//Chop,
		{r,r0,r1,dr},{phi,phi0,phi1,dphi}];MESSAGE;
	polygons=Flatten[Table[Graphics3D[
		Polygon[{ecken[[i,j]],ecken[[i+1,j]],ecken[[i+1,j+1]],ecken[[i,j+1]]}]],
			{i,pr},{j,pphi}]];Clear[ecken];
	Show[{drahtrahmen,polygons},opts]]

ballmodelPlot[nullcurve_][u0_,u1_,v0_,v1_,pu_,pv_,opts___]:=Module[{
	du=(u1-u0)/pu,dv=(v1-v0)/pv,p,h,g},
	p=Table[(h=Chop[N[nullcurve[u0+i*du+I*(v0+j*dv)]]];
		g=Chop[hermitean2by2ToLorentz[h.Conjugate[Transpose[h]]]];
		lorentzmodelToBallmodel[g]),{i,0,pu},{j,0,pv}];
	h=Table[Graphics3D[
		Polygon[{p[[i,j]],p[[i+1,j]],p[[i+1,j+1]],p[[i,j+1]]}]],
		{i,1,pu},{j,1,pv}]//Flatten;
	Show[h,opts]];

ballmodelPlotPolar[nullcurve_][u0_,u1_,v0_,v1_,pu_,pv_,opts___]:=Module[{
	du=(u1-u0)/pu,dv=(v1-v0)/pv,p,h,g},
	p=Table[(h=Chop[N[nullcurve[(u0+i*du)*Exp[I*(v0+j*dv)]]]];
		g=Chop[hermitean2by2ToLorentz[h.Conjugate[Transpose[h]]]];
		lorentzmodelToBallmodel[g]),{i,0,pu},{j,0,pv}];
	h=Table[Graphics3D[
		Polygon[{p[[i,j]],p[[i+1,j]],p[[i+1,j+1]],p[[i,j+1]]}]],
		{i,1,pu},{j,1,pv}]//Flatten;
	Show[h,opts]];

upperHalfspacePlot[nullcurve_][u0_,u1_,v0_,v1_,pu_,pv_,opts___]:=Module[{
	du=(u1-u0)/pu,dv=(v1-v0)/pv,p,h,g},
	p=Table[(h=Chop[N[nullcurve[u0+i*du+I*(v0+j*dv)]]];
		g=Chop[hermitean2by2ToLorentz[h.Conjugate[Transpose[h]]]];
		lorentzmodelToUpperhalfSpace[g]),{i,0,pu},{j,0,pv}];
	h=Table[Graphics3D[
		Polygon[{p[[i,j]],p[[i+1,j]],p[[i+1,j+1]],p[[i,j+1]]}]],
	{i,1,pu},{j,1,pv}]//Flatten;
	Show[h,opts]];

upperHalfspacePlotPolar[nullcurve_][u0_,u1_,v0_,v1_,pu_,pv_,opts___]:=Module[{
	du=(u1-u0)/pu,dv=(v1-v0)/pv,p,h,g},
	p=Table[(h=Chop[N[nullcurve[(u0+i*du)*Exp[I*(v0+j*dv)]]]];
		g=Chop[hermitean2by2ToLorentz[h.Conjugate[Transpose[h]]]];
		lorentzmodelToUpperhalfSpace[g]),{i,0,pu},{j,0,pv}];
	h=Table[Graphics3D[
		Polygon[{p[[i,j]],p[[i+1,j]],p[[i+1,j+1]],p[[i,j+1]]}]],
	{i,1,pu},{j,1,pv}]//Flatten;
	Show[h,opts]];

meromorphicBRToExactForms[0][f_,h_][z_]:=D[f[z],z]^2*h[z]

meromorphicBRToExactForms[n_Integer][f_,h_][z_]:=Simplify[
	D[meromorphicBRToExactForms[n-1][f,h][z]/D[f[z],z],z]]/;n>0

meromorphicBRIntegralDirect[n_,k_][f_,h_][z_]:=
	Sum[meromorphicBRToExactForms[j+n-k-1][f,h][z]*
	Factorial[k]/Factorial[j]*
	f[z]^j*(-1)^(k-j)/D[f[z],z],{j,0,k}]/;n>k

meromorphicBRIntegral[n_Integer,0][f_,h_][z_]:=
	meromorphicBRToExactForms[n-1][f,h][z]/D[f[z],z]

meromorphicBRIntegral[n_Integer,k_Integer][f_,h_][z_]:=Simplify[
	f[z]^k*meromorphicBRToExactForms[n-1][f,h][z]/D[f[z],z]-
	k*meromorphicBRIntegral[n-1,k-1][f,h][z]]/;n>k

meroBRInversDirect[0][f_,form_][z_]:=form[z]/D[f[z],z]^2;

meroBRInversDirect[n_Integer][f_,form_][z_]:=Expand[(Plus@@Table[f[z]^(n-1-i)*
	Integrate[form[z]*(-f[z])^(i)*Binomial[n-1,i],z],{i,0,n-1}])/(D[f[z],z]*
	Factorial[n-1])]/;n>0;

meroBRInversDirectwithConstants[n_Integer][f_,form_][z_]:=
	meroBRInversDirect[n][f,form][z]+(f[z]^(Range[n]-1)/D[f[z],z]).Table[C[i-1],{i,n}]

meroBRInverswithConstants[n_Integer][f_,form_][z_]:=
	meroBRInvers[n][f,form][z]+(f[z]^(Range[n]-1)/D[f[z],z]).Table[C[i-1],{i,n}]

intBR/:intBR[f_/(n_?IntegerQ),z]:=intBR[f,z]/n
intBR[a_+b_,z]:=intBR[a,z]+intBR[b,z]
intBR[-a_,z]:=-intBR[a,z]

partintBR[f_,term_][z_]:={intBR[xxx_./2,z]->intBR[xxx,z]/2,
	intBR[f[z]^k_*(a_+b_),z]->intBR[f[z]^k*a,z]+intBR[f[z]^k*b,z],
	intBR[intBR[term[z],z]*D[f[z],z],z]->
	f[z]*intBR[term[z],z]-intBR[term[z]*f[z],z],
	intBR[f[z]*intBR[term[z],z]*D[f[z],z],z]->
		f[z]^2*intBR[term[z],z]/2-intBR[term[z]*f[z]^2/2,z],
	intBR[Power[f[z],k_Integer]*intBR[term[z],z]*D[f[z],z],z]->
		(f[z]^(k+1)*intBR[term[z],z]-intBR[term[z]*f[z]^(k+1),z])/(k+1)}

miBR[0][f_,form_][z_]:=form[z]/D[f[z],z]^2

miBR[n_Integr][f_,form_][z_]:=Module[{fo=D[f[#],#]*intBR[form[#],#]&,temp},
	temp=miBR[n-1][f,fo][z]//Expand;
	fo=(temp//.partintBR[f,form][z])//Expand]

meroBRInvers[n_Integer][f_,form_][z_]:=If[n>49||n<0,
	Print[Bad order n. Choose n so that 0 <= n < 50.],
		miBR[n][f,form][z]//.intBR->Integrate]
(**Test:
nn=19;miBR[nn][f,r][z]
hh[z_]=MeroInvers[nn][f,r][z]
MeromorphicToExactForms[nn][f,hh][z]**)

Sl2CFrameMeromorphic[n_Integer,k_Integer][f_,h_][z_]:=Module[{int,aa,bb},
	If[n>k+1&&k>0,
		(int=meromorphicBRIntegralDirect[n,k-1][f,h][z];
		aa=meromorphicBRIntegralDirect[n,k][f,h][z];
		bb=meromorphicBRIntegralDirect[n,k+1][f,h][z];
		{{-1,-bb},{int,bb*int-aa^2}}/aa//Simplify),
	Print["The integers n and k do not satisfy n>k+1 and k>0."]]]

Sl2CFrameMeromorphic[f_,h_][z_]:=Sl2CFrameMeromorphic[3,1][f,h][z]//Simplify;

Sl2CFrameMeromorphicInvers1[n_,k_][MATRIX_][z_]:=Module[{d=Det[MATRIX[z]]//Simplify,aa,bb},
	If[d==1&&n>k+1&&k>0,(aa=-1/MATRIX[z][[1,1]]//Simplify;
		bb=-MATRIX[z][[1,2]]*aa//Simplify;D[bb,z]/D[aa,z]//Simplify),
		Print["Matrix is not an Sl(2,C)-matrix or the condition\n
			n>k+1 and k>0 is not satisfied."],
			Print["Can not decide whether the matrix has determinant 1."]]]

Sl2CFrameMeromorphicInvers1[MATRIX_][z_]:=Sl2CFrameMeromorphicInvers1[3,1][MATRIX][z]//Simplify;

Sl2CFrameMeromorphicInvers2[n_,k_][MATRIX_][z_]:=Module[{
	ffun=Sl2CFrameMeromorphicInvers1[n,k][MATRIX][#]&,d=Det[MATRIX[z]]//Simplify,aa,ppn},
	If[d==1&&n>k+1&&k>0,
		(aa=-1/Part[MATRIX[#],1,1]&//Simplify;
		ppn=D[aa[#],#]/ffun[#]^k&//Simplify;
		meroBRInversDirect[n][ffun,ppn][z]),
			Print["Matrix[z] is not an Sl(2,C)-matrix or the condition\n
			n>k+1 and k>0 is not satisfied."],
     				Print["Can not decide whether the matrix has determinant 1." ]]]

Sl2CFrameMeromorphicInvers2[MATRIX_][z_]:=Sl2CFrameMeromorphicInvers2[3,1][MATRIX][z]//Simplify;

Sl2CFrameMeromorphicInverswithConstants1[n_,k_][MATRIX_][z_]:=Print["This command does not exist."]


Sl2CFrameMeromorphicInverswithConstants2[n_,k_][MATRIX_][z_]:=Module[{
	ffun=Sl2CFrameMeromorphicInvers1[n,k][MATRIX][#]&,d=Det[MATRIX[z]]//Simplify,aa,ppn},
	If[d==1&&n>k+1&&k>0,
		(aa=-1/Part[MATRIX[#],1,1]&//Simplify;
		ppn=D[aa[#],#]/ffun[#]^k&//Simplify;
		meroBRInversDirectwithConstants[n][ffun,ppn][z]),
			Print["Matrix[z] is not an Sl(2,C)-matrix or the condition\n
			n>k+1 and k>0 is not satisfied."],
     				Print["Can not decide whether the matrix has determinant 1." ]]]

Sl2CFrameMeromorphicInverswithConstants2[MATRIX_][z_]:=
	Sl2CFrameMeromorphicInverswithConstants2[3,1][MATRIX][z]//Simplify;

Sl2CFrameMeromorphicInverswithConstants[n_,k_][MATRIX_][z_]:=Module[{
	ffun=Sl2CFrameMeromorphicInvers1[n,k][MATRIX][#]&,d=Det[MATRIX[z]]//Simplify,aa,bb},
	If[d==1&&n>k+1&&k>0,
	(aa=-1/Part[MATRIX[#],1,1]&//Simplify;bb=-MATRIX[z][[1,2]]*aa[z]//Simplify;
	ppn=D[aa[#],#]/ffun[#]^k&//Simplify;
	{D[bb,z]/D[aa[z],z]//Simplify,meroBRInversDirectwithConstants[n][ffun,ppn][z]}),
		Print["Matrix[z] is not an Sl(2,C)-matrix or the condition\n
		n>k+1 and k>0 is not satisfied."],
			Print["Can not decide whether the matrix has determinant 1."]]]

Sl2CFrameMeromorphicInverswithConstants[MATRIX_][z_]:=
	Sl2CFrameMeromorphicInverswithConstants[3,1][MATRIX][z]//Simplify;

Sl2CFrameMeromorphicInvers[n_,k_][MATRIX_][z_]:=Module[{
	ffun=Sl2CFrameMeromorphicInvers1[n,k][MATRIX][#]&,d=Det[MATRIX[z]]//Simplify,aa,bb},
	If[d==1&&n>k+1&&k>0,
	(aa=-1/Part[MATRIX[#],1,1]&//Simplify;bb=-MATRIX[z][[1,2]]*aa[z]//Simplify;
	ppn=D[aa[#],#]/ffun[#]^k&//Simplify;
	{D[bb,z]/D[aa[z],z]//Simplify,meroBRInversDirect[n][ffun,ppn][z]}),
		Print["Matrix[z] is not an Sl(2,C)-matrix or the condition\n
		n>k+1 and k>0 is not satisfied."],
			Print["Can not decide whether the matrix has determinant 1."]]]

Sl2CFrameMeromorphicInvers[MATRIX_][z_]:=Sl2CFrameMeromorphicInvers[3,1][MATRIX][z]//Simplify;

Sl2CFrameMeromorphicToSl2CModified1[MATRIX_][z_]:=-1/Part[MATRIX[z],1,1]//Simplify

Sl2CFrameMeromorphicToSl2CModified2[MATRIX_][z_]:=
	-Part[MATRIX[z],1,2]/Part[MATRIX[z],1,1]//Simplify;

Sl2CFrameMeromorphicToSl2CModified[MATRIX_][z_]:=
	-{1,Part[MATRIX[z],1,2]}/Part[MATRIX[z],1,1]//Simplify

lorentzToHermitean2by2[x0_,x1_,x2_,x3_]:={{x0+x3,x1+I*x2},{x1-I*x2,x0-x3}};

lorentzToHermitean2by2[v_List]:=(lorentzToHermitean2by2@@v)//Simplify

hermitean2by2ToLorentz[a11_,a12_,a21_,a22_]:={a11+a22,a12+a21,I(a21-a12),a11-a22}/2//Simplify

hermitean2by2ToLorentz[m_]:=hermitean2by2ToLorentz[m[[1,1]],m[[1,2]],m[[2,1]],m[[2,2]]]

adjointMatrix[m_]:=Module[{dim=Dimensions[m],z,x},n=Min[dim];z=Minors[m,n-1];
	x=Table[z[[i,j]]*(-1)^(i+j),{i,n},{j,n}];
	x//Reverse//Transpose//Reverse//Simplify]

QuaternionicMatrix[a_,b_,c_,d_]:={{a+I*b,c+I*d},{-c+I*d,a-I*b}}

commutator[x_List,y_List]:=x.y-y.x//Simplify

commutator[pair_]:=commutator[pair[[1]],pair[[2]]]

adjointRepresentation[0][x_][y_]:=y

adjointRepresentation[1][x_][y_]:=commutator[x,y]//Simplify

adjointRepresentation[n_Integer][x_][y_]:=commutator[x,adjointRepresentation[n-1][x][y]]

spur[m_List]:=Sum[m[[i,i]],{i,Length[m]}]//Simplify

QuaternionicMatrix[a_,b_,c_,d_]:={{a+I*b,c+I*d},{-c+I*d,a-I*b}}

Quaternions:={{{1,0},{0,1}},{{I,0},{0,-I}},{{0,1},{-1,0}},{{0,I},{I,0}},
	{{-1,0},{0,-1}},{{-I,0},{0,I}},{{0,-1},{1,0}},{{0,-I},{-I,0}}}

basicFunctionG[a_,b_][z_]:=-D[b[z],z]/D[a[z],z]

basicFunctionOmega[a_,b_][z_]:=Module[{p=D[a[z],z],q=D[b[z],z]},p^2/(b[z]*p-a[z]*q)]

basicFunctionGModified[u_,b_][z_]:=basicFunctionG[modifiedU[u],modifiedB[u,b]][z]//Simplify

basicFunctionOmegaModified[u_,b_][z_]:=basicFunctionOmega[modifiedU[u],modifiedB[u,b]][z]//Simplify


basicFunctionGMeromorphic[f_,h_][z_]:=Module[{f1,f2,zz,h1},
	f1=D[f[zz],zz];h1=D[h[zz],zz];f2=D[f1,zz];
	(f[z]*h1+h[z]*((f[z]*f2)/f1-2*f1)/.zz->z)//Simplify]

basicFunctionOmegaMeromorphic[f_,h_][z_]:=Module[{f1,f2,f3,f4,zz,h1,h2,h3,qqd,qqn,qq},
	f1=D[f[zz],zz];h1=D[h[zz],zz];f2=D[f1,zz];h2=D[h1,zz];f3=D[f2,zz];h3=D[h2,zz];f4=D[f3,zz];
	qqn=f1*f2*(3*f2*h1+4*f3*h[z])-f1^3*h3-f1^2*(2*f3*h1+h[z]*f4)-3*f2^3*h[z];
	qqd=f1^2*(f1*h1+f2*h[z])-f[z]*(f1*(f2*h1+f1*h2)+(-f2^2+f1*f3)*h[z]);
	qq=qqn*f1^2/qqd^2;
	(qq/.zz->z)//Simplify]
nilpotentsl2MatrixBasic[g_,omega_][z_]:=omega[z]*Transpose[{{g[z],1}}].{{1,-g[z]}}

nilpotentsl2MatrixBasic[vv_][z_]:=nilpotentsl2MatrixBasic[vv[#][[1]]&,vv[#][[2]]&][z]

nilpotentsl2Matrix[a_,b_][z_]:=nilpotentsl2MatrixBasic[basicFunctionG[a,b],
	basicFunctionOmega[a,b]][z]

nilpotentsl2MatrixModified[u_,b_][z_]:=nilpotentsl2Matrix[modifiedU[u],modifiedB[u,b]][z]//Simplify

modifiedU[u_][z_]:=-1/u[z];

modifiedB[u_,b_][z_]:=1*b[z]*modifiedU[u][z];

Sl2CFrame[a_,b_][z_]:=Module[{zeile1={a[z],b[z]},wronski,phiz,zz,temp},
	wronski=Det[{temp={a[zz],b[zz]},D[temp,zz]}];
	phiz=Integrate[-(D[a[zz],zz]/a[zz])^2/wronski,zz]/.zz->z;
	temp={zeile1,phiz*zeile1+{0,1/a[z]}}//Simplify];

Bryantframe[a_,b_][z_]:=Sl2CFrame[a,b][z]

BryantframeModified[a_,b_][z_]:=Sl2CFrameModified[a,b][z]

Sl2CFrameModified[u_,b_][z_]:=Sl2CFrame[modifiedU[u],modifiedB[u,b]][z]//Simplify

Sl2CFrameModified[a_][z_]:=Sl2CFrameModified[a,bbcan[a]][z]

auxBianchiCaloSmall[f_,g_][z_]:=Module[{f1=D[f[zz],zz]/D[g[zz],zz],
	f2=D[f[zz],zz,zz]/D[g[zz],zz]^2,a11,a12,a21,a22},
	a22=(f1^(-1/2)+g[z]*f1^(-3/2)*f2/2);
	a11=Sqrt[f1]-f[z]*f1^(-3/2)*f2/2;
	a12=f[z]*a22-g[z]*Sqrt[f1];a21=-f1^(-3/2)*f2/2;
	({{a11,a12},{a21,a22}}//.zz->z)//Simplify]

Sl2CFrameBianchiCaloSmall[f_][z_]:=auxBianchiCaloSmall[f,#&][z]//Simplify

Sl2CFrameBianchiCaloSmall[f_,g_][z_]:=Sl2CFrameBianchiCaloSmall[f][g[z]]//Simplify

BianchiCaloSmallFrame[f_][z_]:=Sl2CFrameBianchiCaloSmall[f][z]

BianchiCaloSmallFrame[f_,g_][z_]:=Sl2CFrameBianchiCaloSmall[f,g][z]

BianchiCaloSmallDouble[f_,g_][z_]:=Sl2CFrameBianchiCaloSmall[f][z].
	Inverse[Sl2CFrameBianchiCaloSmall[g][z]]//Simplify

Sl2CAction[m_][fun_,form_]:={(m[[1,1]]*fun+m[[1,2]])/(m[[2,1]]*fun+m[[2,2]]),
	(m[[2,1]]*fun+m[[2,2]])^2*form}

BianchiCaloSmallDoubleInvers2[nullcurve_][z_]:=
	-D[nullcurve[z][[1,2]],z]/D[nullcurve[z][[1,1]],z]//Simplify

BianchiCaloSmallDoubleInvers1[nullcurve_][z_]:=
	D[nullcurve[z][[1,2]],z]/D[nullcurve[z][[2,2]],z]//Simplify

BianchiCaloSmallDoubleInvers[nullcurve_][z_]:=
	D[nullcurve[z][[1,2]],z]/{D[nullcurve[z][[2,2]],z],-D[nullcurve[z][[1,1]],z]}//Simplify


BianchiCaloSmallDoubleCanParameterPrime[f_,g_][z_]:=FullSimplify[schwarzderbr[f][z]^2-schwarzderbr[g][z]^2]/4

squaredlengthOfThirdDerOfBianchiCaloSmallDouble[f_,g_][z_]:=Module[{Sf=schwarzderbr[f][z]^2//FullSimplify,
	Sg=schwarzderbr[g][z]^2//FullSimplify,t0,t1,t2},
	t0=Simplify[Sf-Sg];t1=Simplify[-t0^2(Sf+Sg)];
	t2=Simplify[D[t0,z]];t3=Simplify[-4D[t2,z]*t0];
	(t1+8t2^2+t3)/32//Simplify]


BianchiCaloSmallDoubleCurvatureFORMAL[mf_,mg_][z_]:=
	(-2*(mf[z]^6-mf[z]^4*mg[z]^2+4*mf[z]^3*Derivative[2][mf][z]-
	4*mf[z]*mg[z]*(-5*Derivative[1][mf][z]*Derivative[1][mg][z]+
	mg[z]*Derivative[2][mf][z])+mg[z]^2*(mg[z]^4-4*Derivative[1][mf][z]^2-
	6*Derivative[1][mg][z]^2+4*mg[z]*Derivative[2][mg][z])-
	mf[z]^2*(mg[z]^4+6*Derivative[1][mf][z]^2+4*Derivative[1][mg][z]^2+
	4*mg[z]*Derivative[2][mg][z])))/(mf[z]^2-mg[z]^2)^3

BianchiCaloSmallDoubleCurvature[f_,g_][z_]:=
	BianchiCaloSmallDoubleCurvatureFORMAL[schwarzderbr[f],schwarzderbr[g]][z]

Sl2CAction[matrix_List][pair_List]:=Sl2CAction[matrix][pair[[1]],pair[[2]]]

Sl2CAction[a_,b_,c_,d_][pair_List]:=Sl2CAction[{{a,b},{c,d}}][pair[[1]],pair[[2]]]

Sl2CAction[a_,b_,c_,d_][x_,y_]:=Sl2CAction[{{a,b},{c,d}}][x,y]

Sl2CFramerule[order_][a11_,a12_,a21_,a22_][g_,om_][z_]:=Module[{
		k,y,np=nilpotentsl2MatrixBasic[g,om][z],sl2={{a11[z],a12[z]},{a21[z],a22[z]}},
			ableitungen,bryantframebedingung},
		ableitungen=Union[Flatten[D[sl2,z]]];
		bryantframebedingung=Thread[Flatten[D[sl2,z]-sl2.np]=={0,0,0,0}];
		k=ableitungen//.Flatten[Solve[bryantframebedingung,ableitungen]];
		y=Table[Thread[D[ableitungen,{z,i}]->Simplify[D[k,{z,i}]]],{i,0,order}];
		Flatten[{y,Solve[Det[sl2]==1,a22[z]],
			Table[D[a22[z],{z,i}]->-D[a11[z],{z,i}],{i,0,order+1}]}]];

Sl2CFramerule4:=Sl2CFramerule[4][a11,a12,a21,a22][g,om][z];

toBryantframeData[n_][a11_,a12_,a21_,a22_][g_,om_][z_][x_]:=
		(x//.Sl2CFramerule[n][a11,a12,a21,a22][g,om][z])//Simplify

nullcurveToBryantdata1[nullMatrix_][z_]:=
	-D[nullMatrix[z][[1,2]],z]/D[nullMatrix[z][[1,1]],z]//Simplify

nullcurveToBryantdata2[nullMatrix_][z_]:=D[nullMatrix[z][[1,1]],z]/
	(nullMatrix[z][[1,1]]*nullcurveToBryantdata1[nullMatrix][z]+nullMatrix[z][[1,2]])//Simplify

nullcurveToBryantdata[nullMatrix_][z_]:=Module[{
	xi=Inverse[nullMatrix[z]],xp=D[nullMatrix[z],z],om,g,determinante,qq},
	determinante=Det[Simplify[xi.xp]]//FullSimplify;
	qq:=(g=-xp[[1,2]]/xp[[1,1]]//Simplify;om=xp[[1,1]]/
		(g*nullMatrix[z][[1,1]]+nullMatrix[z][[1,2]])//Simplify;{g,om});
	If[TrueQ[determinante==0],qq,Print["The given matrix is not null."],
		(Print["Check whether the matrix is a null matrix."];qq)]]

nullcurveToModifiedData1[nullMatrix_][z_]:=-1/nullMatrix[z][[1,1]]//Simplify

nullcurveToModifiedData2[nullMatrix_][z_]:=nullMatrix[z][[1,2]]/nullMatrix[z][[1,1]]//Simplify

nullcurveToModifiedData[nullMatrix_][z_]:=Module[{
	xi=Inverse[nullMatrix[z]],xp=D[nullMatrix[z],z],om,g,determinante,qq},
	determinante=Det[Simplify[xi.xp]]//FullSimplify;
	qq:={-1,nullMatrix[z][[1,2]]}/nullMatrix[z][[1,1]]//Simplify;
	If[TrueQ[determinante==0],qq,Print["The given matrix is not null."],
		(Print["Check whether the matrix is a null matrix."];qq)]]

(************** konkrete Formeln für die graphischen Darstellungen in
				den verschiedenen Modellen. ********************)

hermitianTypeSurface[a_,b_][u_,v_]:=Module[{sl2frame=Sl2CFrame[a,b][u+I*v],imt},
	imt=sl2frame.Transpose[Conjugate[sl2frame]]//ComplexExpand//Simplify;
	imt//hyperbolicComplexExpand//Simplify]
	
hermitianTypeSurfaceModified[u_,b_][x_,y_]:=Module[{
	sl2frame=Sl2CFrameModified[u,b][x+I*y],imt},
	imt=sl2frame.Transpose[Conjugate[sl2frame]]//ComplexExpand//Simplify;
	imt//hyperbolicComplexExpand//Simplify]

lorentzmodelToBallmodel[x0_,x1_,x2_,x3_]:={x1,x2,x3}/(1+x0)//Simplify

lorentzmodelToBallmodel[v_]:=Drop[v,1]/(1+v[[1]])

ballmodelToLorentzmodel[y1_,y2_,y3_]:=Module[{x0=Simplify[y1^2+y2^2+y3^2-1]},
	{-(2+x0),-2y1,-2y2,-2y3}/x0//Simplify//Simplify]

ballmodelToLorentzmodel[v_]:=Module[{x0=Simplify[v.v-1]},
	Prepend[-2v,-(2+x0)]/x0//Simplify//Simplify]

upperhalfSpaceToBallmodel[vec_]:=ballmodelToUpperhalfSpace[vec]
(**ballmodelToUpperhalfSpace is self-inverse**)

upperhalfSpaceToLorentzmodel[v_]:=v//upperhalfSpaceToBallmodel//ballmodelToLorentzmodel//Simplify
lorentzmodelToUpperhalfSpace[v_]:=v//lorentzmodelToBallmodel//ballmodelToUpperhalfSpace//Simplify

ballmodelToUpperhalfSpace[v_]:=Module[{l=Length[v],en,y},en=Last[IdentityMatrix[l]];
	y=v+en;2y/(y.y)-en//Simplify]

ballmodelToUpperhalfSpace[x1_,x2_,x3_]:=ballmodelToUpperhalfSpace[{x1,x2,x3}]

lorentzianTypeSurface[a_,b_][u_,v_]:=
	Simplify[hermitean2by2ToLorentz[hermitianTypeSurface[a,b][u,v]]]

lorentzianTypeSurfaceModified[a_,b_][u_,v_]:=
	Simplify[hermitean2by2ToLorentz[hermitianTypeSurfaceModified[a,b][u,v]]]

ballmodelTypeSurface[a_,b_][u_,v_]:=
	Simplify[lorentzmodelToBallmodel[lorentzianTypeSurface[a,b][u,v]]]

ballmodelTypeSurfaceModified[a_,b_][u_,v_]:=Simplify[lorentzmodelToBallmodel[
	lorentzianTypeSurfaceModified[a,b][u,v]]]

(******************* Examples ******************************************
	sl2frame[z_]=Sl2CFrameModified[#^m &,#^n&][z];
	herm[u_,v_]=sl2frame[u+I*v].Transpose[Conjugate[sl2frame[u+I*v]]]//
		ComplexExpand//Simplify;
	%//hyperbolicComplexExpand//Simplify
	%-hermitianTypeSurfaceModified[#^m&,#^n&][u,v]

	sl2frame[z_]=Sl2CFrame[#^m&,#^n&][z];
	herm[u_,v_]=sl2frame[u+I*v].Transpose[Conjugate[sl2frame[u+I*v]]]//
	ComplexExpand//Simplify
	%//hyperbolicComplexExpand//Simplify
	%-hermitianTypeSurface[#^m&,#^n&][u,v]

***************************************************************************)

hyperbolicOrthogonalProjection[x_List][a_List]:=Module[{
	ll=lorentzMetrik[a,a]//Simplify},If[ll==0,
	Print["The 2-nd vector a that gives the direction of the projection is isotropic."],
	x-lorentzMetrik[x,a]*a/ll//Simplify,
	x-lorentzMetrik[x,a]*a/ll//Simplify]]/;Length[x]==Length[a]==4

hyperbolicL[x_][u_,v_]:=Module[{normal=hyperbolicunitNormal[x][uu,vv],
	xuu=hyperbolicOrthogonalProjection[D[x[uu,vv],uu,uu]][x[uu,vv]]},
	(-lorentzMetrik[xuu,normal]/.{uu->u,vv->v})//Simplify]

hyperbolicM[x_][u_,v_]:=Module[{normal=hyperbolicunitNormal[x][uu,vv],
	xuv=hyperbolicOrthogonalProjection[D[x[uu,vv],uu,vv]][x[uu,vv]]},
	(-lorentzMetrik[xuv,normal]/.{uu->u,vv->v})//Simplify]

hyperbolicN[x_][u_,v_]:=Module[{normal=hyperbolicunitNormal[x][uu,vv],
	xvv=hyperbolicOrthogonalProjection[D[x[uu,vv],vv,vv]][x[uu,vv]]},
	(-lorentzMetrik[xvv,normal]/.{uu->u,vv->v})//Simplify]

hyperbolicsecondFFdirect[x_][u_,v_]:=Module[{
	normal=hyperbolicunitNormal[x][uu,vv],l,m,n,
	xuu=hyperbolicOrthogonalProjection[D[x[uu,vv],uu,uu]][x[uu,vv]],
	xuv=hyperbolicOrthogonalProjection[D[x[uu,vv],uu,vv]][x[uu,vv]],
	xvv=hyperbolicOrthogonalProjection[D[x[uu,vv],vv,vv]][x[uu,vv]]},
	l=lorentzMetrik[xuu,normal];m=lorentzMetrik[xuv,normal];
	n=lorentzMetrik[xvv,normal];({{l,m},{m,n}}/.{uu->u,vv->v})//Simplify]

hyperbolicsecondFF[x_][u_,v_]:=Module[{l=hyperbolicL[x][u,v],
	m=hyperbolicM[x][u,v],n=hyperbolicN[x][u,v]},{{l,m},{m,n}}//Simplify]

hyperbolicWeingartenmap[x_][u_,v_]:=
	-hyperbolicsecondFF[x][u,v].Inverse[hyperbolicfirstFF[x][u,v]]//Simplify

hyperbolicOrthogonalProjection[x0_,x1_,x2_,x3_][a0_,a1_,a2_,a3_]:=
	hyperbolicOrthogonalProjection[{x0,x1,x2,x3}][{a0,a1,a2,a3}]

hyperbolicLeviCivita[surface_,vectorfield_][vec_List][u_,v_]:=Module[{
	vu=D[vectorfield[uu,vv],uu]//Simplify,
	vv=D[vectorfield[uu,vv],vv]//Simplify,a=vec[[1]],b=vec[[2]]},
	(hyperbolicOrthogonalProjection[a*vu+b*vv][x[u,v]]/.{uu->u,vv->v})//Simplify]

hyperbolicMeancurvature[x_][u_,v_]:=spur[hyperbolicWeingartenmap[x][u,v]]/2//Simplify

hyperbolicGaussiancurvature[x_][u_,v_]:=hyperbolicWeingartenmap[x][u,v]//Det//Simplify

hyperbolicTangentVectorofH3[a_,b_,c_][x1_,x2_,x3_]:=
	{x1*Cosh[b]*Cosh[c]*Sinh[a]+x2*Cosh[c]*Sinh[b]+x3*Sinh[c],
	x1*Cosh[a]*Cosh[b]*Cosh[c],x2*Cosh[a]*Cosh[b]*Cosh[c],
	x3*Cosh[a]*Cosh[b]*Cosh[c]}

hyperbolicTangentVectorofH3[a_,b_,c_][vv_List]:=
	hyperbolicTangentVectorofH3[a,b,c][vv[[1]],vv[[2]],vv[[3]]]//Simplify

hyperbolicTangentVectorofH3Inversobs[a_,b_,c_][xx0_,xx1_,xx2_,xx3_]:={x1,x2,x3}/.
	Solve[Thread[Take[hyperbolicTangentVectorofH3[a,b,c][x1,x2,x3],-3]==
	{xx1,xx2,xx3}],{x1,x2,x3}]//Flatten

hyperbolicTangentVectorofH3Invers[a_,b_,c_][xx0_,xx1_,xx2_,xx3_]:=
	{xx1*Sech[a]*Sech[b]*Sech[c],xx2*Sech[a]*Sech[b]*Sech[c],xx3*Sech[a]*Sech[b]*Sech[c]}

hyperbolicTangentVectorofH3Invers[a_,b_,c_][vv_List]:=
	hyperbolicTangentVectorofH3Invers[a,b,c][vv[[1]],vv[[2]],vv[[3]],vv[[4]]]//Simplify

lorentzmetric=DiagonalMatrix[{-1,1,1,1}];

hyperbolicCross[v_List,w_List][point_List]:=
	Simplify[Reverse[Flatten[Minors[{v,w,point}.lorentzmetric,3]]]*{1,-1,1,-1}]

hyperbolicCrossX[v_List,w_List][point_List]:=Cross[v,w,point]*{1,-1,-1,-1}

hyperbolicCrosswithCheck[v_List,w_List][point_List]:=If[
	TrueQ[lorentzMetrik[v,point]==0&&lorentzMetrik[w,point]==0&&
	lorentzMetrik[point,point]==-1],
	hyperbolicCross[v,w][point],
	Print[
	"hyperbolicCross warning: One of the arguments v, w is not tangent
	to H^3 at 'point' or 'point' is not an element of H^3."]]

normalofH3[x0_,x1_,x2_,x3_]:={x0,x1,x2,x3}

normalofH3[vec_]:=normalofH3@@vec

hyperbolicE[x_][u_,v_]:=(lorentzMetrik[D[x[uu,vv],uu],D[x[uu,vv],uu]]/.{uu->u,vv->v})//Simplify;

hyperbolicF[x_][u_,v_]:=(lorentzMetrik[D[x[uu,vv],uu],D[x[uu,vv],vv]]/.{uu->u,vv->v})//Simplify;

hyperbolicG[x_][u_,v_]:=(lorentzMetrik[D[x[uu,vv],vv],D[x[uu,vv],vv]]/.{uu->u,vv->v})//Simplify;

hyperbolicfirstFF[x_][u_,v_]:=Module[{e=hyperbolicE[x][u,v],f=hyperbolicF[x][u,v],
	g=hyperbolicG[x][u,v]},{{e,f},{f,g}}]

hyperbolicL[x_][u_,v_]:=-(lorentzMetrik[D[x[uu,vv],uu,uu],
	hyperbolicunitNormal[x][uu,vv]]/.{uu->u,vv->v})//Simplify;

hyperbolicM[x_][u_,v_]:=-(lorentzMetrik[D[x[uu,vv],uu,vv],
	hyperbolicunitNormal[x][uu,vv]]/.{uu->u,vv->v})//Simplify;

hyperbolicN[x_][u_,v_]:=(-lorentzMetrik[D[x[uu,vv],vv,vv],
	hyperbolicunitNormal[x][uu,vv]]/.{uu->u,vv->v})//Simplify;

hyperbolicsecondFF[x_][u_,v_]:=Module[{nn=hyperbolicunitNormal[x][uu,vv],l,m,n},
	l=lorentzMetrik[D[x[uu,vv],uu,uu],nn];m=lorentzMetrik[D[x[uu,vv],uu,vv],nn];
	n=lorentzMetrik[D[x[uu,vv],vv,vv],nn];(-{{l,m},{m,n}}/.{uu->u,vv->v})//Simplify]

hyperbolicWeingartenmap[x_][u_,v_]:=
	-hyperbolicsecondFF[x][u,v].Inverse[hyperbolicfirstFF[x][u,v]]//Simplify

hyperbolicMeancurvature[x_][u_,v_]:=spur[hyperbolicWeingartenmap[x][u,v]]/2//Simplify

hyperbolicGaussiancurvature[x_][u_,v_]:=hyperbolicWeingartenmap[x][u,v]//Det//Simplify

hyperbolicSurfaceNormalVector[x_][u_,v_]:=Module[{xxu=D[x[u,v],u]//Simplify,
	xxv=D[x[u,v],v]//Simplify},
	Reverse[Flatten[Minors[{xxu,xxv,x[u,v]}.lorentzmetric,3]]]*{1,-1,1,-1}//Simplify]

hyperbolicSurfaceNormalVectorwithCheck[x_][u_,v_]:=(hyperbolicCrosswithCheck[
	D[x[uu,vv],uu],xv=D[x[uu,vv],vv]][x[uu,vv]]//.{uu->u,vv->v})//Simplify;

hyperbolicunitNormal[x_][u_,v_]:=Module[{
	n=hyperbolicSurfaceNormalVector[x][u,v]},n/lorentzLength[n]//Simplify];

lorentzMetrik[v_List,w_List]:=Simplify[w.(lorentzmetric.v)]/;Length[v]==Length[w]==4

lorentzLength[v_List]:=lorentzMetrik[v,v]//Simplify//Sqrt

llEukl[i_Integer?Positive,j_Integer?Positive][z_]:=Module[{y=IdentityMatrix[4]},
	y[[i,i]]=Cos[z];y[[j,j]]=y[[i,i]];y[[i,j]]=-Sin[z];y[[j,i]]=-y[[i,j]];y]/;j>i

llLoren[i_Integer?Positive,j_Integer?Positive][z_]:=Module[{y=IdentityMatrix[4]},
	y[[i,i]]=Cosh[z];y[[j,j]]=y[[i,i]];y[[i,j]]=Sinh[z];y[[j,i]]=y[[i,j]];y]/;j>i

lorentzGroup[a_,b_,c_,d_,e_,f_]:=Module[{
	lorentzpart=llLoren[1,2][a].llLoren[1,3][b].llLoren[1,4][c],
	euclideanpart=llEukl[2,3][d].llEukl[2,4][e].llEukl[3,4][f]},lorentzpart.euclideanpart]

lorentzGroup[vec_]:=lorentzGroup@@vec

logexpand[term_]:=(term/.Log[Exp[u_]]->u)//Simplify

logexpandXX[term_]:=term

lorentzGroupIwasawa0[a_,b_,c_,d_,x_,y_]:=Module[{
	mmx=	{{0,1,0, 0},
		 {1,0,0,-1},
		 {0,0,0, 0},
		 {0,1,0, 0}},
	mmy=	{{0,0,1, 0},
		 {0,0,0, 0},
		 {1,0,0,-1},
		 {0,0,1, 0}}},
	llLoren[1,3][-2a].llEukl[2,4][2b].llLoren[1,4][2c].llEukl[2,3][2d].
		MatrixExp[x*mmx].MatrixExp[y*mmy]]

lorentzGroupIwasawa[a_,b_,c_,d_,x_,y_]:={{(-2*(y*Cos[2*d]+x*Sin[2*d])*Sinh[2*a]+
	Cosh[2*a]*((2+x^2+y^2)*Cosh[2*c]+(x^2+y^2)*Sinh[2*c]))/2,
	E^(2*c)*x*Cosh[2*a]-Sin[2*d]*Sinh[2*a],E^(2*c)*y*Cosh[2*a]-Cos[2*d]*Sinh[2*a],
	(2*(y*Cos[2*d]+x*Sin[2*d])*Sinh[2*a]+Cosh[2*a]*(-(E^(2*c)*(x^2+y^2))+2*Sinh[2*c]))/2},
	{-(E^(2*c)*(x^2+y^2)*Cos[b]*Sin[b])+Cos[2*b]*(x*Cos[2*d]-y*Sin[2*d])-Sin[2*b]*Sinh[2*c],
	Cos[2*b]*Cos[2*d]-2*E^(2*c)*x*Cos[b]*Sin[b],
	-2*E^(2*c)*y*Cos[b]*Sin[b]-Cos[2*b]*Sin[2*d],
	((-2+x^2+y^2)*Cosh[2*c]*Sin[2*b]+2*Cos[2*b]*(-(x*Cos[2*d])+y*Sin[2*d])+
	(x^2+y^2)*Sin[2*b]*Sinh[2*c])/2},
	{(2*Cosh[2*a]*(y*Cos[2*d]+x*Sin[2*d])+(-(E^(2*c)*(x^2+y^2))-2*Cosh[2*c])*Sinh[2*a])/2,
	Cosh[2*a]*Sin[2*d]-2*E^(2*c)*x*Cosh[a]*Sinh[a],Cos[2*d]*Cosh[2*a]-
	2*E^(2*c)*y*Cosh[a]*Sinh[a],
	(-2*Cosh[2*a]*(y*Cos[2*d]+x*Sin[2*d])+Sinh[2*a]*(E^(2*c)*(x^2+y^2)-2*Sinh[2*c]))/2},
	{((x^2+y^2)*Cos[2*b]*Cosh[2*c]+2*Sin[2*b]*(x*Cos[2*d]-y*Sin[2*d])+
	(2+x^2+y^2)*Cos[2*b]*Sinh[2*c])/2,
	E^(2*c)*x*Cos[2*b]+Cos[2*d]*Sin[2*b],E^(2*c)*y*Cos[2*b]-Sin[2*b]*Sin[2*d],
	(2*Sin[2*b]*(-(x*Cos[2*d])+y*Sin[2*d])+Cos[2*b]*(-((-2+x^2+y^2)*Cosh[2*c])-
	(x^2+y^2)*Sinh[2*c]))/2}}

lorentzGroupIwasawaInvers[zz_]:=Module[{qq=Simplify[zz.{1,0,0,1}],zzt=Transpose[zz],
	QQ1,QQ2,QQ3,a,b,c,d,x,y,pp,qqq},
	(************ Berechnen von a,b,c ****************)
	QQ1=qq.{1,0,-1,0}//Simplify;
	QQ2=qq.{0,1,0,I}//Simplify;
	QQ3=qq.{1,I,1,1}//Simplify;
	a=logexpand[(QQ1*(I*QQ1+QQ2))/(QQ2*QQ3)//FullSimplify//Log]/4;
	b=logexpand[-(QQ1*QQ3)/(QQ2*(I*QQ1+QQ2))//FullSimplify//Log]I/4;
	c=logexpand[(QQ1*QQ2*QQ3)/(I*QQ1+QQ2)//Simplify//Log]/4;
	qqq=(llLoren[1,4][-2*c].llEukl[2,4][-2*b].llLoren[1,3][2a]).(zz)//Simplify;
	(****************** Berechnen von x,y,d
	x=qqq[[1,2]];y=qqq[[1,3]];****************)
	x=qqq[[1,2]];y=qqq[[1,3]];
	pp=zzt[[2]]+I*zzt[[3]]//FullSimplify;
	d=logexpand[I/(Sinh[2a]*pp[[1]]+Cosh[2a]*pp[[3]]//FullSimplify)//Log]/2/I;
	(**Variante: d=-logexpand[FullSimplify[Cos[2*b]*pp[[2]]+Sin[2*b]*pp[[4]]]//Log]/2/I; **)
	(**Print["******************************",pp]; **)
	{a,b,c,d,x,y}]

lorentzGroupIwasawa[v_List]:=lorentzGroupIwasawa@@v

hyperbolicPolarCoords[a_,b_,c_]=lorentzGroup[a,b,c,0,0,0].{1,0,0,0}//Simplify

hyperbolicPolarCoords[a,b,c]//lorentzToHermitean2by2//Det//Simplify

surfaceInhyperbolicPolarCoords[a_,b_,c_][u_,v_]:=hyperbolicPolarCoords[a[u,v],b[u,v],c[u,v]]

hyperbolicSurfaceNormalInhyperbolicPolarCoords[a_,b_,c_][u_,v_]:=Module[{
	au=Derivative[1,0][a][u,v],bu=Derivative[1,0][b][u,v],cu=Derivative[1,0][c][u,v],
	av=Derivative[0,1][a][u,v],bv=Derivative[0,1][b][u,v],cv=Derivative[0,1][c][u,v]},

	{(Cosh[c[u,v]]*(cv*(-(Cosh[a[u,v]]*Sinh[2*b[u,v]]*au)+2*Sinh[a[u,v]]*bu)+
	bv*(Cosh[a[u,v]]*Cosh[b[u,v]]^2*Sinh[2*c[u,v]]*au-2*Sinh[a[u,v]]*cu)+
	Cosh[a[u,v]]*av*(-(Cosh[b[u,v]]^2*Sinh[2*c[u,v]]*bu)+Sinh[2*b[u,v]]*cu)))/2,
	(Cosh[c[u,v]]*(cv*(-(Sinh[a[u,v]]*Sinh[2*b[u,v]]*au)+2*Cosh[a[u,v]]*bu)+
	bv*(Cosh[b[u,v]]^2*Sinh[a[u,v]]*Sinh[2*c[u,v]]*au-2*Cosh[a[u,v]]*cu)+
	Sinh[a[u,v]]*av*(-(Cosh[b[u,v]]^2*Sinh[2*c[u,v]]*bu)+Sinh[2*b[u,v]]*cu)))/2,
	Cosh[b[u,v]]*Cosh[c[u,v]]*(Cosh[c[u,v]]*Sinh[b[u,v]]*Sinh[c[u,v]]*bv*
	au-Cosh[b[u,v]]*cv*au+av*(-(Cosh[c[u,v]]*Sinh[b[u,v]]*Sinh[c[u,v]]*bu)+
	Cosh[b[u,v]]*cu)),
	Cosh[b[u,v]]*Cosh[c[u,v]]^3*(bv*au-av*bu)}]

(**************************** Technisches ***************************)

hyperbolicComplexargumentrule:={
	Arg[z_]:>ArcTan[Simplify[ComplexExpand[Im[z]]/ComplexExpand[Re[z]]]],
	Abs[z_]:>Sqrt[Simplify[PowerExpand[ComplexExpand[Im[z]]^2+ComplexExpand[Re[z]]^2]]],
	Log[`x_^n_]:>n*Log[`x],ArcTan[Tan[y_]]:>y,ArcTan[Cot[y_]]:>Pi/2-y}

hyperbolicComplexExpand[term_]:=(term//.hyperbolicComplexargumentrule)//Simplify

hyperbolicadjointMatrix[m_List]:=Simplify[ComplexExpand[Transpose[Conjugate[m]]]]

(**************  Programme: KAN-Parametrisierung, inv. Metrik, kovariante Ableitung ********************)

cmcKappaKANOBS[a_,b_][z_]:=Module[{a1=D[a[zz],zz]//Simplify,b1=D[b[zz],zz]//Simplify,
	a2,a3,b2,b3},a2=D[a1,zz]//Simplify;b2=D[b1,zz]//Simplify;
	a3=D[a2,zz]//Simplify;b3=D[b2,zz]//Simplify;
	((-3*a1^4*b1*b2^2+6*a1^3*b2*(b1^2*a2+a[z]*b2^2-a[z]*b1*b3)+
	a[z]*b1^2*(b1*(6*a2^3+a[z]*a3^2)-2*a[z]*a2^2*b3)-2*a[z]*a1*
	b1*(3*b1^2*a2*a3-2*a[z]*a2*b2*b3+b1*(3*a2^2*b2+a[z]*a3*b3))+
	a1^2*(-3*b1^3*a2^2-2*a[z]^2*b2^2*b3+6*a[z]*b1^2*(b2*a3+a2*b3)+
	a[z]*b1*(-6*a2*b2^2+a[z]*b3^2)))/(a[z]^4*b1^3)/.zz->z)//Simplify]

cmcKappaKANOBS[p_][z_]:=cmcKappaKANOBS[p[#][[1]]&,p[#][[2]]&][z]

cmcKappaKAN[p_][z_]:=cmcKappaKAN[p[#][[1]]&,p[#][[2]]&][z]

cmcKappaKAN[a_,b_][z_]:=Module[{zx,pz,pzz,pzzz,result},
	pz=Sqrt[cmcCPPKAN[a,b][zx]];pzz=D[pz,zx]//Simplify;
	pzzz=D[pzz,zx]//Simplify;
(**result=thirdlength/pz^6+9pzz^2*pz^(-4)-6pzz*pz^(-7)*2pz^3*pzz+
2(pzzz*pz-3pzz^2)*pz^(-8)*pz^4;nichtvereinfachteVariante**)
	result=cmcKappaKANOBS[a,b][zx]/pz^6+2*pzzz/pz^3-9*pzz^2/pz^4;
	(result/.zx->z)//Simplify]


cmcCPPKAN[a_,b_][z_]:=((D[b[zz],zz]*D[a[zz],zz,zz]-
	D[a[zz],zz]*D[b[zz],zz,zz])/(a[z]*D[b[zz],zz])/.zz->z)//Simplify

cmcCPPKAN[p_][z_]:=cmcCPPKAN[p[#][[1]]&,p[#][[2]]&][z]

Sl2CFrameBROBS[g_,om_][z_]:=Module[{xx=nilpotentsl2MatrixBasic[g,om][z],
	a11,a12,a21,a22,ff,gl},
	ff={{a11[z],a12[z]},{a21[z],a22[z]}};
	gl=Thread[Flatten[D[ff,z]-ff.xx]==Table[0,{4}]]//FullSimplify;
	(ff/.Flatten[DSolve[gl,{a11,a12,a21,a22},z]])//Simplify]

yyFunForSl2CFrameBR[g_,om_][z_]:=Module[{y,sol,ff},
	sol=Flatten[DSolve[y[z]^2-2y'[z]==om[z]*4*g'[z]+schwarzderbr[g][z]^2,
		y[z],z]][[1]];
	ff=((y[z]/.sol)/.C[1]->0)//Simplify]

riccatiEquationforSl2CFrameBR[y_][g_,om_][z_]:=y[z]^2-2y'[z]==FullSimplify[om[z]*4*g'[z]+
	schwarzderbr[g][z]^2]

yyFunForSl2CFrameBRaux[g_,om_][z_]:=Module[{y,sol,ff},
	sol=Flatten[DSolve[riccatiEquationforSl2CFrameBR[y][g,om][z],
		y[z],z]][[1]];
	ff=((y[z]/.sol)/.C[1]->0)//Simplify//PowerExpand//Simplify//PowerExpand]

Sl2CFrameBR[g_,om_][z_]:=Module[{f=Integrate[Exp[Integrate[
	yyFunForSl2CFrameBRaux[g,om][#]//Simplify//PowerExpand,#]]//FullSimplify,#]&},
	BianchiCaloSmallDouble[f,g][z]]

riccatiEquationforSl2CFrameBR1[y_][g_,om_][z_]:={Derivative[1][y][z]==-((y[z]+g[z])^2*om[z])}

functionBforSl2CFrameBR1[g_,om_][c1_][z_]:=Module[{gl,b,sol},
	gl=riccatiEquationforSl2CFrameBR1[b][g,om][z];
	sol=Flatten[DSolve[gl,b[z],z]]/.C[1]->c1;
	If[SameQ[Head[sol],DSolve],"RiccatiequationNOTsolvable",b[z]/.sol[[1]]]]

functionAforSl2CFrameBR1[g_,om_][c1_,c2_][z_]:=c2/
	Exp[Integrate[(functionBforSl2CFrameBR1[g,om][c1][zz]+g[zz])*om[zz],zz]]/.zz->z

Sl2CFrameBR1[g_,om_][c1_,c2_][z_]:=Module[{aa,bb,v,ricatti,zz},
	ricatti=riccatiEquationforSl2CFrameBR1[b][g,om][zz];
	bb=functionBforSl2CFrameBR1[g,om][c1][#]&;
	If[SameQ[bb[zz],"RiccatiequationNOTsolvable"],
		Print["Can not solve the Riccati equation ",ricatti/.zz->z,"."],
			(aa=c2/Exp[Integrate[(functionBforSl2CFrameBR1[g,om][c1][#]+g[#])*om[#],#]]&;
				Sl2CFrameModified[aa,bb][zz]/.zz->z)
		]]

Sl2CFrameBR1[f_,g_][z_]:=Sl2CFrameBR1[f,g][1,1][z]

linearDiffEqof2ndOrder[a_][g_,om_][z_]:=-(a[z]*om[z]*Derivative[1][g][z])-
	(Derivative[1][a][z]*Derivative[1][om][z])/om[z]+Derivative[2][a][z]

functionAforSl2CFrameBR2[g_,om_][c1_,c2_][z_]:=Module[{a,lineareDGL,tz,cc},
	lineareDGL=linearDiffEqof2ndOrder[a][g,om][z];
	tz=(a[z]/.DSolve[lineareDGL==0,a[z],z,DSolveConstants -> cc][[1]])//Simplify;
	tz/.{cc[1]->c1,cc[2]->c2}]

functionBforSl2CFrameBR2[g_,om_][c1_,c2_][z_]:=Module[{aa,aap,zz},
	aa=functionAforSl2CFrameBR2[g,om][c1,c2][zz];aap=D[aa,zz]//Simplify;
	(aap/om[zz]-aa*g[zz]/.zz->z)//Simplify]

Sl2CFrameBR2[g_,om_][c1_,c2_][z_]:=Sl2CFrame[functionAforSl2CFrameBR2[g,om][c1,c2],
	functionBforSl2CFrameBR2[g,om][c1,c2]][z]

Sl2CFrameBR2[g_,om_][z_]:=Sl2CFrameBR2[g,om][1,0][z]

cppKAN2[a_,b_][z_]:=(D[b[z],z]*D[a[z],z,z]-D[a[z],z]*D[b[z],z,z])^2/
	(a[z]^2*D[b[z],z]^2)//Simplify

bbcan[c1_,c2_][a_][z_]:=(c1+c2*Integrate[D[a[zz],zz]*
	E^(-Integrate[a[zz]/D[a[zz],zz],zz]),zz]/.zz->z)//Simplify

bbcan[a_][z_]:=bbcan[0,1][a][z]

aFunForEqualG[qq_,b_][z_]:=-Integrate[D[b[z],z]/qq[z],z]

aFunModifiedForEqualG[qq_,b_][z_]:=Exp[Integrate[D[b[z],z]/(qq[z]+b[z]),z]]

partielIntegrationbbcanOBS[a_][z_][term_]:=Module[{partielleIntegration,umkehr,x},
	partielleIntegration={Integrate[a[z]/a'[z],z]->int[z],
		Integrate[Exp[-int[z]]*a'[z],z]->Exp[-int[z]]*a[z]-
			Integrate[D[Exp[-int[z]],z]*a[z],z],
		Integrate[Exp[int[z]]*a'[z],z]->Exp[int[z]]*a[z]-
			Integrate[D[Exp[int[z]],z]*a[z],z]};
	umkehr={int[z]->Integrate[a[z]/a'[z],z],int'[z]->a[z]/a'[z]};
	x=(term//.partielleIntegration)//Simplify;
	(x//.umkehr)//FullSimplify]

partielIntegrationbbcan[a_,z_][term_]:=(term//.
	{Integrate[Exp[-Integrate[a[z]/a'[z],z]]*a'[z],z]s->
		Exp[-Integrate[a[z]/a'[z],z]]*a[z]-
			Integrate[D[Exp[-Integrate[a[z]/a'[z],z]],z]*a[z],z],
	Integrate[Exp[Integrate[a[z]/a'[z],z]]*a'[z],z]->
		Exp[Integrate[a[z]/a'[z],z]]*a[z]-
		Integrate[D[Exp[Integrate[a[z]/a'[z],z]],z]*a[z],z]})//Simplify

covDerVectorKAN1[a_,b_][z_]:=Module[{a1=D[a[z],z],b1=D[b[z],z],x},
	x=Integrate[a1^2/b1,z];
	{-(a1^2/(Sqrt[x-I]*(I+x)^(3/2)*b1)),(a1*(-(a[z]*x*a1)+(1+x^2)*b1))/
	(a[z]^2*Sqrt[x-I]*Sqrt[I+x]*b1),(-2*a[z]*x*a1)/(1+x^2)+
	(a[z]^2*(x^2-1)*a1^2)/((1+x^2)^2*b1)+b1}//Simplify]

covDerVectorKAN2[a_,b_][z_]:=Module[{a1=D[a[z],z],b1=D[b[z],z],x,a2,b2},
	x=Integrate[a1^2/b1,z];a2=D[a1,z]//Simplify;b2=D[b1,z]//Simplify;
	{(a1*(2*b1*(a1^2-a[z]*a2)+a[z]*a1*b2))/(a[z]*Sqrt[x-I]*(I+x)^(3/2)*b1^2),
	(-2*(1+x^2)*a1^2*b1^2+a[z]*b1*(2*x*a1^3+(1+x^2)*b1*a2)+a[z]^2*x*a1*
	(-2*b1*a2+a1*b2))/(a[z]^3*Sqrt[x-I]*Sqrt[I+x]*b1^2),
	(-2*(1+x^2)^2*a1*b1^3-2*a[z]^2*b1*((x^2-1)*a1^3+(x+x^3)*b1*a2)+
	a[z]*(1+x^2)*b1^2*(4*x*a1^2+(1+x^2)*b2)+
	a[z]^3*(x^2-1)*a1*(2*b1*a2-a1*b2))/(a[z]*(1+x^2)^2*b1^2)}//Simplify]

covDerVectorKAN3[a_,b_][z_]:=Module[{a1=D[a[z],z],b1=D[b[z],z],x,a2,b2,a3,b3},
	x=Integrate[a1^2/b1,z];a2=D[a1,z]//Simplify;b2=D[b1,z]//Simplify;
	a3=D[a2,z]//Simplify;b3=D[b2,z]//Simplify;
	{(-6*a1^4*b1^2-2*a[z]^2*b1^2*a2^2-3*a[z]*a1^3*b1*b2-2*a[z]^2*a1*b1*(-2*a2*b2+b1*a3)+
	a[z]*a1^2*(9*b1^2*a2-2*a[z]*b2^2+a[z]*b1*b3))/(a[z]^2*Sqrt[x-I]*(I+x)^(3/2)*b1^3),
	(6*(1+x^2)*a1^3*b1^3+6*a[z]*a1*b1^2*(-(x*a1^3)-(1+x^2)*b1*a2)+
	a[z]^2*b1*(-3*x*a1^2*(-3*b1*a2+a1*b2)+(1+x^2)*b1^2*a3)+a[z]^3*x*(-2*(b1*a2-a1*b2)^2-
	2*a1*b1^2*a3+a1^2*b1*b3))/(a[z]^4*Sqrt[x-I]*Sqrt[I+x]*b1^3),
	(6*(1+x^2)^2*a1^2*b1^4+3*a[z]*(1+x^2)*b1^3*(-4*x*a1^3-b1*a2-a1*b2-
	x^2*(b1*a2+a1*b2))+a[z]^3*b1*(3*(x^2-1)*a1^2*(-3*b1*a2+a1*b2)-
	2*(x+x^3)*b1^2*a3)+a[z]^2*b1^2*(6*(x^2-1)*a1^4+12*(x+x^3)*a1*b1*a2+
	(1+x^2)^2*b1*b3)+a[z]^4*(x^2-1)*(2*a1^2*b2^2+2*b1^2*(a2^2+a1*a3)-a1*b1*
	(4*a2*b2+a1*b3)))/(a[z]^2*(1+x^2)^2*b1^3)}//Simplify]

covDerVectorKAN4[a_,b_][z_]:=Module[{a1=D[a[z],z],b1=D[b[z],z],x,a2,b2,a3,b3},
	x=Integrate[a1^2/b1,z];a2=D[a1,z]//Simplify;b2=D[b1,z]//Simplify;
	a3=D[a2,z]//Simplify;b3=D[b2,z]//Simplify;
	a4=D[a3,z]//Simplify;b4=D[b3,z]//Simplify;
	{(24*a1^5*b1^3+12*a[z]*a1^4*b1^2*b2+6*a[z]^3*b1^2*a2*(a2*b2-b1*a3)-
	4*a[z]*a1^3*b1*(12*b1^2*a2-2*a[z]*b2^2+a[z]*b1*b3)+2*a[z]^2*a1*b1*
	(-6*a[z]*a2*b2^2+3*a[z]*b1*(b2*a3+a2*b3)+b1^2*(10*a2^2-a[z]*a4))+
	a[z]^2*a1^2*(6*a[z]*b2^3+12*b1^3*a3-6*a[z]*b1*b2*b3+
	b1^2*(-22*a2*b2+a[z]*b4)))/(a[z]^3*Sqrt[x-I]*(I+x)^(3/2)*b1^4),
	(-24*(1+x^2)*a1^4*b1^4+12*a[z]*a1^2*b1^3*(2*x*a1^3+3*(1+x^2)*b1*a2)+
	a[z]^2*b1^2*(2*a1*b1*a2*b2-a1^2*b2^2+12*x*a1^3*(-4*b1*a2+a1*b2)-
	b1^2*(7*a2^2+8*a1*a3)-x^2*(-2*a1*b1*a2*b2+a1^2*b2^2+b1^2*(7*a2^2+8*a1*a3)))+
	a[z]^3*b1*(-2*x*a1*(-4*a1^2*b2^2-2*b1^2*(5*a2^2+3*a1*a3)+a1*b1*
	(11*a2*b2+2*a1*b3))+(1+x^2)*b1^3*a4)+a[z]^4*x*(6*a1^2*b2^3-6*a1*b1*b2*(2*a2*b2+
	a1*b3)-2*b1^3*(3*a2*a3+a1*a4)+b1^2*(6*a2^2*b2+6*a1*a2*b3+a1*
	(6*b2*a3+a1*b4))))/(a[z]^5*Sqrt[x-I]*Sqrt[I+x]*b1^4),
	(-24*(1+x^2)^2*a1^3*b1^5+12*a[z]*(1+x^2)*a1*b1^4*(4*x*a1^3+
	2*b1*a2+a1*b2+x^2*(2*b1*a2+a1*b2))-2*a[z]^2*b1^3*(12*(x^2-1)*a1^5+
	36*(x+x^3)*a1^2*b1*a2+(1+x^2)^2*b1*(3*a2*b2+2*b1*a3)+2*(1+x^2)^2*a1*b1*b3)+
	2*a[z]^4*b1*((x^2-1)*a1*(-4*a1^2*b2^2-2*b1^2*(5*a2^2+3*a1*a3)+a1*b1*
	(11*a2*b2+2*a1*b3))-(x+x^3)*b1^3*a4)+a[z]^3*b1^2*(48*(x^2-1)*a1^3*b1*
	a2-12*(x^2-1)*a1^4*b2+2*(x+x^3)*a1^2*b2^2+4*(x+x^3)*a1*b1*(-(a2*b2)+
	4*b1*a3)+b1^2*(14*(x+x^3)*a2^2+(1+x^2)^2*b4))+a[z]^5*(x^2-1)*
	(-6*a1^2*b2^3+6*a1*b1*b2*(2*a2*b2+a1*b3)+2*b1^3*(3*a2*a3+a1*a4)-
	b1^2*(6*a2^2*b2+6*a1*a2*b3+a1*(6*b2*a3+a1*b4))))/(a[z]^3*(1+x^2)^2*b1^4)}//Simplify]

covDerVectorKAN5[a_,b_][z_]:=Module[{a1=D[a[z],z],b1=D[b[z],z],x,a2,b2,a3,b3},
	x=Integrate[a1^2/b1,z];a2=D[a1,z]//Simplify;b2=D[b1,z]//Simplify;
	a3=D[a2,z]//Simplify;b3=D[b2,z]//Simplify;
	a4=D[a3,z]//Simplify;b4=D[b3,z]//Simplify;
	a5=D[a4,z]//Simplify;b5=D[b4,z]//Simplify;
	{(-120*a1^6*b1^4-60*a[z]*a1^5*b1^3*b2+a[z]*a1^4*b1^2*(-41*a[z]*b2^2+
	20*b1*(15*b1*a2+a[z]*b3))+2*a[z]^3*b1^2*(-12*a[z]*a2^2*b2^2+6*a[z]*b1*a2*(2*b2*a3+
	a2*b3)+b1^2*(10*a2^3-3*a[z]*a3^2-4*a[z]*a2*a4))-a[z]^2*a1^3*b1*(30*a[z]*b2^3+
	80*b1^3*a3-30*a[z]*b1*b2*b3+b1^2*(-142*a2*b2+5*a[z]*b4))+2*a[z]^3*a1*b1*
	(24*a[z]*a2*b2^3-12*a[z]*b1*b2*(b2*a3+2*a2*b3)+b1^2*(-35*a2^2*b2+6*a[z]*a3*
	b3+4*a[z]*b2*a4+4*a[z]*a2*b4)+b1^3*(35*a2*a3-a[z]*a5))+
	a[z]^2*a1^2*(-24*a[z]^2*b2^4+36*a[z]^2*b1*b2^2*b3+b1^4*(-191*a2^2+15*a[z]*a4)-
	2*a[z]*b1^2*(-40*a2*b2^2+3*a[z]*b3^2+4*a[z]*b2*b4)+a[z]*b1^3*(-40*(b2*a3+a2*b3)+
	a[z]*b5)))/(a[z]^4*Sqrt[x-I]*(I+x)^(3/2)*b1^5),
	(120*(1+x^2)*a1^5*b1^5+120*a[z]*a1^3*b1^4*(-(x*a1^3)-2*(1+x^2)*b1*a2)+
	6*a[z]^2*a1*b1^3*(-2*a1*b1*a2*b2+a1^2*b2^2-10*x*a1^3*(-5*b1*a2+a1*b2)+
	2*b1^2*(8*a2^2+5*a1*a3)+x^2*(-2*a1*b1*a2*b2+a1^2*b2^2+2*b1^2*(8*a2^2+5*a1*a3)))+
	a[z]^3*b1^2*(x*a1^2*(-41*a1^2*b2^2-b1^2*(191*a2^2+80*a1*a3)+2*a1*b1*
	(71*a2*b2+10*a1*b3))-5*(-(a1^2*b2^3)+a1*b1*b2*(2*a2*b2+a1*b3)-b1^2*(b2*(a2^2+a1*a3)+
	a1*a2*b3)+b1^3*(5*a2*a3+2*a1*a4))-5*x^2*(-(a1^2*b2^3)+a1*b1*b2*(2*a2*b2+
	a1*b3)-b1^2*(b2*(a2^2+a1*a3)+a1*a2*b3)+b1^3*(5*a2*a3+2*a1*a4)))+
	a[z]^4*b1*(5*x*(-6*a1^3*b2^3+2*a1^2*b1*b2*(8*a2*b2+3*a1*b3)+b1^3*(4*a2^3+14*a1*a2*
	a3+3*a1^2*a4)-a1*b1^2*(14*a2^2*b2+8*a1*a2*b3+a1*(8*b2*a3+a1*b4)))+
	(1+x^2)*b1^4*a5)+a[z]^5*x*(-24*a1^2*b2^4+12*a1*b1*b2^2*(4*a2*b2+
	3*a1*b3)-2*b1^2*(3*(4*b2^2*(a2^2+a1*a3)+8*a1*a2*b2*b3+a1^2*b3^2)+4*a1^2*b2*b4)-
	2*b1^4*(3*a3^2+4*a2*a4+a1*a5)+b1^3*(12*a2^2*b3+8*a2*(3*b2*a3+a1*b4)+
	a1*(12*a3*b3+8*b2*a4+a1*b5))))/(a[z]^6*Sqrt[x-I]*Sqrt[I+x]*b1^5),
	(120*(1+x^2)^2*a1^4*b1^6-60*a[z]*(1+x^2)*a1^2*b1^5*(4*x*a1^3+3*b1*a2+
	a1*b2+x^2*(3*b1*a2+a1*b2))+a[z]^2*b1^4*(120*(x^2-1)*a1^6+480*(x+x^3)*a1^3*b1*a2+
	31*(1+x^2)^2*b1^2*a2^2+2*(1+x^2)^2*a1*b1*(29*a2*b2+20*b1*a3)+(1+x^2)^2*a1^2*
	(b2^2+20*b1*b3))-a[z]^3*b1^3*(300*(x^2-1)*a1^4*b1*a2-60*(x^2-1)*a1^5*b2+
	12*(x+x^3)*a1^3*b2^2+24*(x+x^3)*a1^2*b1*(-(a2*b2)+5*b1*a3)+5*(1+x^2)^2*
	b1^2*(2*b2*a3+2*a2*b3+b1*a4)+a1*b1^2*(192*(x+x^3)*a2^2+5*(1+x^2)^2*b4))+
	a[z]^5*b1*(-5*(x^2-1)*(-6*a1^3*b2^3+2*a1^2*b1*b2*(8*a2*b2+3*a1*b3)+
	b1^3*(4*a2^3+14*a1*a2*a3+3*a1^2*a4)-a1*b1^2*(14*a2^2*b2+8*a1*a2*b3+a1*
	(8*b2*a3+a1*b4)))-2*x*(1+x^2)*b1^4*a5)+a[z]^4*b1^2*(2*(x^2-1)*a1^3*b1*(-71*a2*b2+
	40*b1*a3)+(x^2-1)*a1^4*(41*b2^2-20*b1*b3)+a1^2*(191*(x^2-1)*b1^2*a2^2-10*x*(1+x^2)*b2^3+
	10*(x+x^3)*b1*b2*b3)+10*x*(1+x^2)*a1*b1*(a2*(2*b2^2-b1*b3)+b1*(-(b2*a3)+2*b1*a4))+
	(1+x^2)*b1^2*(-10*x*a2*(a2*b2-5*b1*a3)+(1+x^2)*b1*b5))+a[z]^6*(x^2-1)*
	(24*a1^2*b2^4-12*a1*b1*b2^2*(4*a2*b2+3*a1*b3)+b1^2*(6*(4*b2^2*(a2^2+a1*a3)+
	8*a1*a2*b2*b3+a1^2*b3^2)+8*a1^2*b2*b4)+2*b1^4*(3*a3^2+4*a2*a4+a1*a5)-
	b1^3*(12*a2^2*b3+8*a2*(3*b2*a3+a1*b4)+a1*(12*a3*b3+8*b2*a4+a1*b5))))/
	(a[z]^4*(1+x^2)^2*b1^5)}//Simplify]

matrixOfScalarproducts[a_][z_]=Module[{a1=D[a[z],z],a2,a3,a4,a5},
	a2=D[a1,z]//Simplify;a3=D[a2,z]//Simplify;
	a4=D[a3,z]//Simplify;a5=D[a4,z]//Simplify;
	{{0,0,-1,0,(-a[z]^4-8*a1^4+8*a[z]*a1^2*a2+a[z]^2*(a2^2-2*a1*a3))/(a[z]^2*a1^2)},
	{0,1,0,(a[z]^4+8*a1^4-8*a[z]*a1^2*a2-a[z]^2*(a2^2-2*a1*a3))/(a[z]^2*a1^2),
	(-3*(-(a[z]^4*a1^2)+8*a1^6+a[z]^5*a2-12*a[z]*a1^4*a2+4*a[z]^2*a1^3*a3-
	a[z]^3*(a2^3-2*a1*a2*a3+a1^2*a4)))/(a[z]^3*a1^3)},
	{-1,0,(-a[z]^4-8*a1^4+8*a[z]*a1^2*a2+a[z]^2*(a2^2-2*a1*a3))/(a[z]^2*a1^2),
	(-(a[z]^4*a1^2)+8*a1^6+a[z]^5*a2-12*a[z]*a1^4*a2+4*a[z]^2*a1^3*a3-
	a[z]^3*(a2^3-2*a1*a2*a3+a1^2*a4))/(a[z]^3*a1^3),
	-((a[z]^8+88*a1^8-19*a[z]^5*a1^2*a2-176*a[z]*a1^6*a2+a[z]^6*(a2^2+3*a1*a3)+
	12*a[z]^2*a1^4*(5*a2^2+4*a1*a3)-4*a[z]^3*a1^2*(-4*a2^3+8*a1*a2*a3+a1^2*a4)+
	a[z]^4*(17*a1^4-2*a2^4+3*a1*a2^2*a3+a1^2*(2*a3^2-3*a2*a4)+a1^3*a5))/
	(a[z]^4*a1^4))},
	{0,(a[z]^4+8*a1^4-8*a[z]*a1^2*a2-a[z]^2*(a2^2-2*a1*a3))/(a[z]^2*a1^2),
	(-(a[z]^4*a1^2)+8*a1^6+a[z]^5*a2-12*a[z]*a1^4*a2+
	4*a[z]^2*a1^3*a3-a[z]^3*(a2^3-2*a1*a2*a3+a1^2*a4))/(a[z]^3*a1^3),
	(a[z]^4+8*a1^4-8*a[z]*a1^2*a2-a[z]^2*(a2^2-2*a1*a3))^2/(a[z]^4*a1^4),
	(-2*(a[z]^4+8*a1^4-8*a[z]*a1^2*a2-a[z]^2*(a2^2-2*a1*a3))*(-(a[z]^4*a1^2)+8*a1^6+
	a[z]^5*a2-12*a[z]*a1^4*a2+4*a[z]^2*a1^3*a3-a[z]^3*(a2^3-2*a1*a2*a3+a1^2*a4)))/
	(a[z]^5*a1^5)},{(-a[z]^4-8*a1^4+8*a[z]*a1^2*a2+a[z]^2*(a2^2-2*a1*a3))/(a[z]^2*a1^2),
	(-3*(-(a[z]^4*a1^2)+8*a1^6+a[z]^5*a2-12*a[z]*a1^4*a2+4*a[z]^2*a1^3*a3-
	a[z]^3*(a2^3-2*a1*a2*a3+a1^2*a4)))/(a[z]^3*a1^3),
	-((a[z]^8+88*a1^8-19*a[z]^5*a1^2*a2-176*a[z]*a1^6*a2+
	a[z]^6*(a2^2+3*a1*a3)+12*a[z]^2*a1^4*(5*a2^2+4*a1*a3)-4*a[z]^3*a1^2*
	(-4*a2^3+8*a1*a2*a3+a1^2*a4)+a[z]^4*(17*a1^4-2*a2^4+3*a1*a2^2*a3+
	a1^2*(2*a3^2-3*a2*a4)+a1^3*a5))/(a[z]^4*a1^4)),
	(-2*(a[z]^4+8*a1^4-8*a[z]*a1^2*a2-a[z]^2*(a2^2-2*a1*a3))*
	(-(a[z]^4*a1^2)+8*a1^6+a[z]^5*a2-12*a[z]*a1^4*a2+4*a[z]^2*a1^3*a3-
	a[z]^3*(a2^3-2*a1*a2*a3+a1^2*a4)))/(a[z]^5*a1^5),
	(-a[z]^12-320*a1^12+12*a[z]^9*a1^2*a2+960*a[z]*a1^10*a2+a[z]^10*(6*a2^2-4*a1*a3)-
	160*a[z]^2*a1^8*(6*a2^2+a1*a3)-80*a[z]^3*a1^6*(-a2^3-8*a1*a2*a3+
	a1^2*a4)+2*a[z]^7*a1^2*(6*a2^3+64*a1*a2*a3+13*a1^2*a4)-a[z]^8*(17*a1^4+9*a2^4-
	20*a1*a2^2*a3+4*a1^2*(a3^2+3*a2*a4)+2*a1^3*a5)-
	8*a[z]^4*a1^4*(50*a1^4-57*a2^4+106*a1*a2^2*a3-a1^2*(2*a3^2+25*a2*a4)+2*a1^3*a5)+
	8*a[z]^5*a1^2*(113*a1^4*a2-3*a2^5-7*a1*a2^3*a3+a1^2*a2*(26*a3^2-7*a2*a4)+
	a1^3*(-7*a3*a4+2*a2*a5))+a[z]^6*(4*a2^6-188*a1^5*a3-16*a1*a2^4*a3+
	4*a1^2*a2^2*(4*a3^2+3*a2*a4)+2*a1^3*a2*(-12*a3*a4+a2*a5)+
	a1^4*(-478*a2^2+9*a4^2-4*a3*a5)))/(a[z]^6*a1^6)}}]

schwarzderbr[f_][z_]:=Sqrt[3*D[f[z],z,z]^2-2*D[f[z],z]*D[f[z],{z,3}]]/D[f[z],z]

covDerVectorKAN[a_,b_][z_]:={covDerVectorKAN1[a,b][z],covDerVectorKAN2[a,b][z],
	covDerVectorKAN3[a,b][z],covDerVectorKAN4[a,b][z],covDerVectorKAN5[a,b][z]}

nilpotent[a_]:={{1,a},{0,1}}//Simplify

abelian[a_]:=DiagonalMatrix[{a,1/a}]//Simplify

compact[c_]:={{Cos[c],-Sin[c]},{Sin[c],Cos[c]}}//Simplify

Sl2CToSO13[ar_,br_,cr_,dr_,af_,bf_,cf_,df_]:=Module[{
	d=Simplify[Det[{{ar,br},{cr,dr}}+I*{{af,bf},{cf,df}}]],mm},
	mm=Transpose[{{(af^2+ar^2+bf^2+br^2+cf^2+cr^2+df^2+dr^2)/2,
		af*cf+ar*cr+bf*df+br*dr,-(ar*cf)+af*cr-br*df+bf*dr,
		(af^2+ar^2+bf^2+br^2-cf^2-cr^2-df^2-dr^2)/2},
		{af*bf+ar*br+cf*df+cr*dr,bf*cf+br*cr+af*df+ar*dr,
		-(br*cf)+bf*cr-ar*df+af*dr,af*bf+ar*br-cf*df-cr*dr},
		{ar*bf-af*br+cr*df-cf*dr,-(br*cf)+bf*cr+ar*df-af*dr,
		-(bf*cf)-br*cr+af*df+ar*dr,ar*bf-af*br-cr*df+cf*dr},
		{(af^2+ar^2-bf^2-br^2+cf^2+cr^2-df^2-dr^2)/2,
		af*cf+ar*cr-bf*df-br*dr,-(ar*cf)+af*cr+br*df-bf*dr,
		(af^2+ar^2-bf^2-br^2-cf^2-cr^2+df^2+dr^2)/2}}];
	If[d==1,Simplify[mm],Simplify[mm/Abs[d]],Simplify[mm/Abs[d]]]]

Sl2CToSO13Differential[a11_,a12_,a21_,b11_,b12_,b21_]:={{0,a12+a21,b12-b21,2*a11},
	{a12+a21,0,-2*b11,a21-a12},{b12-b21,2*b11,0,-b12-b21},{2*a11,a12-a21,b12+b21,0}}

Sl2CToSO13Differential[ma_]:=Module[{a11=Re[ma[[1,1]]],b11=Im[ma[[1,1]]],
	a12=Re[ma[[1,2]]],b12=Im[ma[[1,2]]],a21=Re[ma[[2,1]]],b21=Im[ma[[2,1]]]},
	If[Simplify[ma[[1,1]]+ma[[2,2]]]==0,
		Sl2CToSO13Differential[a11,a12,a21,b11,b12,b21]//ComplexExpand,
			Print["The input matrix is not in sl(2,C)."]]]

Sl2CToSO13InversDifferentialOBS[s_]:=Module[{a11,a12,a21,b11,b12,b21,t12=s[[1,2]],t13=s[[1,3]],
	t14=s[[1,4]],t23=s[[2,3]],t24=s[[2,4]],t34=s[[3,4]]},
	{{a11,a12},{a21,-a11}}+I*{{b11,b12},{b21,-b11}}/.{a11->t14/2,a12->(t12-t24)/2,
			a21->(t12+t24)/2,b11->-t23/2,b12->(t13-t34)/2,b21->(-t13 - t34)/2}]

Sl2CToSO13InversDifferentialaux[s_]:={{s[[1,4]]-I*s[[2,3]],s[[1,2]]+I*s[[1,3]]-s[[2,4]]-I*s[[3,4]]},
	{s[[1,2]]-I*s[[1,3]]+s[[2,4]]-I*s[[3,4]],I*s[[2,3]]-s[[1,4]]}}/2//Simplify


Sl2CToSO13InversDifferential[s_]:=Module[{kk=Union[Flatten[Simplify[
	Transpose[s].lorentzmetric+lorentzmetric.s]]]},
	If[kk=={0},Sl2CToSO13InversDifferentialaux[s],Print["The input matrix is not in so(1,3)."]]]

Sl2CToSO13[m_]:=Module[{r=ComplexExpand[Re[m]],i=ComplexExpand[Im[m]]},
	Sl2CToSO13[r[[1,1]],r[[1,2]],r[[2,1]],r[[2,2]],i[[1,1]],i[[1,2]],i[[2,1]],i[[2,2]]]]

r6Toc3[v_]:={v[[1]]+v[[2]]*I,v[[3]]+v[[4]]*I,v[[5]]+v[[6]]*I}//Chop
c3Exp[v_]:={Exp[v[[1]]],Exp[v[[2]]],v[[3]]}
r6Toc3Exp[v_]:=v//r6Toc3//c3Exp

Sl2CToSO13Invers[mm_]:=mm//lorentzGroupIwasawaInvers//r6Toc3Exp//Sl2CIwasawaPar

Sl2CIwasawaPar[a_,b_,c_]:=compact[I*Log[a]].abelian[b].nilpotent[c]

Sl2CIwasawaPar[v_List]:=Sl2CIwasawaPar[v[[1]],v[[2]],v[[3]]]

Sl2CIwasawaParInversvereinfachen[term_]:=
	(term/.Sqrt[x_]:>PowerExpand[Sqrt[Factor[x]]])//Simplify

Sl2CIwasawaParInvers[w_]:=Module[{a=Sl2CIwasawaParInvers1[w],b,c},
	b=(w[[1,1]]+I*w[[2,1]])*a//Simplify;
		(**kann man hier einfach b=+-Sqrt[w11^2+w12^2] setzen?**)
	c=(w[[1,2]]-I*w[[2,2]]+I/(w[[1,1]]+I*w[[2,1]]))/(a*b)//Simplify;
	Transpose[{a,b,ExpandDenominator[Together[c]]//Simplify}]]

Sl2CIwasawaParInversX[w_]:=Module[{ww=Transpose[w].w//Simplify,cc,bb,aa,v},
	cc=(abelian[1/ww[[1,1]]].ww)[[1,2]];bb=Sqrt[ww[[1,1]]];
	v=(w.nilpotent[-cc].abelian[1/bb])[[1,1]];aa=v-Sqrt[Simplify[v^2-1]];
	{1/aa,bb,cc}]//PowerExpand//Simplify

Sl2CIwasawaParInvers1[w_]:=Module[{kl=Sqrt[(w[[1,1]]-I*w[[2,1]])/(w[[1,1]]+
	I*w[[2,1]])]},{kl,-kl}//Sl2CIwasawaParInversvereinfachen]

Sl2CIwasawaParInvers2[w_]:=(w[[1,1]]+I*w[[2,1]])*Sl2CIwasawaParInvers1[w]//Simplify

Sl2CIwasawaParInvers3[w_]:=(w[[1,2]]-I*w[[2,2]]+I/(w[[1,1]]+I*w[[2,1]]))/
	(Sl2CIwasawaParInvers1[w]*Sl2CIwasawaParInvers2[w])//Simplify

Sl2CIwasawaParDifferentialoriginal[a_,b_,c_][x_,y_,z_]:=(Inverse[Sl2CIwasawaPar[a,b,c]].
	(D[Sl2CIwasawaPar[a+t*x,b+t*y,c+t*z],t]//.t->0))//Simplify

Sl2CIwasawaParDifferential[a_,b_,c_][x_,y_,z_]:={{((-I)*b^2*c*x)/a+y/b,
	((-I)*(1+b^4*c^2)*x+a*b*(2*c*y+b*z))/(a*b^2)},{(I*b^2*x)/a,(I*b^2*c*x)/a-y/b}}

Sl2CIwasawaParDifferential[p__][v_]:=
	Sl2CIwasawaParDifferential[p[[1]],p[[2]],p[[3]]][v[[1]],v[[2]],v[[3]]]

Sl2CIwasawaParDifferential[p__][x_,y_,z_]:=
	Sl2CIwasawaParDifferential[p[[1]],p[[2]],p[[3]]][x,y,z]

Sl2CIwasawaParDifferential[a_,b_,c_][v_]:=
	Sl2CIwasawaParDifferential[a,b,c][v[[1]],v[[2]],v[[3]]]

Sl2CIwasawaParDifferentialInversoriginal[m_][x_]:=
	(D[Sl2CIwasawaParInvers[m+t*m.x],t][[1]]//.t->0)//Simplify

Sl2CIwasawaParDifferentialInvers[a11_,a12_,a21_,a22_][x11_,x12_,x21_,x22_]:=
	{(I*(a12*a21-a11*a22)*x21)/(Sqrt[a11-I*a21]*(a11+I*a21)^(3/2)),
	(a11^2*x11+a11*a12*x21+a21*(a21*x11+a22*x21))/(Sqrt[a11-I*a21]*Sqrt[a11+I*a21]),
	(-2*(I+(a11+I*a21)*(a12-I*a22))*(a11^2*x11+a11*a12*x21+a21*(a21*x11+a22*x21))+
	(a11^2+a21^2)*(a21*a22*x11+a11^2*x12+a21^2*x12+a12^2*x21+a22^2*x21+a21*a22*x22+
	I*a12*a21*(x11+x22)+a11*(a12-I*a22)*(x11+x22)))/(a11^2+a21^2)^2}

Sl2CIwasawaParDifferentialInvers[m_][x_]:=
	Sl2CIwasawaParDifferentialInvers[m[[1,1]],
	m[[1,2]],m[[2,1]],m[[2,2]]][x[[1,1]],x[[1,2]],x[[2,1]],x[[2,2]]];

Sl2CIwasawaParDifferentialInvers[a11_,a12_,a21_,a22_][x_]:=
	Sl2CIwasawaParDifferentialInvers[a11,a12,a21,a22][
	x[[1,1]],x[[1,2]],x[[2,1]],x[[2,2]]];

Sl2CIwasawaParDifferentialInvers[m_][x11_,x12_,x21_,x22_]:=
	Sl2CIwasawaParDifferentialInvers[m[[1,1]],
	m[[1,2]],m[[2,1]],m[[2,2]]][x11,x12,x21,x22]

Sl2CIwasawaParInversXX[signum_][a_,b_,c_,d_]:=Module[
	{plus=1+b*c+I*c*d,minus=1+b*c-I*c*d,x,y},
	x=signum*Sqrt[minus]/Sqrt[plus];
	y=(a+I*c)*x;
	{x,y,I*((b-I*d)^2/(4*x^2)-x^2*(1*(b+I*d))^2/4)}//Simplify];
	
Sl2CIwasawaParInversXX[sign_][m_]:=Sl2CIwasawaParInversXX[sign][m[[1,1]],m[[1,2]],m[[2,1]],m[[2,2]]]

Sl2CIwasawaParInversXX1[ax_,bx_,cx_,dx_]:=Sl2CIwasawaParInversXX[-1][ax,bx,cx,dx]

Sl2CIwasawaParInversXX1[m_]:=Sl2CIwasawaParInversXX[-1][m]

Sl2CIwasawaParInversXX2[ax_,bx_,cx_,dx_]:=Sl2CIwasawaParInversXX[1][ax,bx,cx,dx]

Sl2CIwasawaParInversXX2[m_]:=Sl2CIwasawaParInversXX[1][m]

Sl2CIwasawaParDifferentialInversXXoriginal[sign_][m_][x_]:=
	(D[Sl2CIwasawaParInversXX[sign][m+t*m.x],t]//.t->0)//Simplify

Sl2CIwasawaParDifferentialInversXX[s_][a_,b_,c_,d_][x_,y_,u_,v_]:=
	{((-I)*s*(d^2*u+c^2*(1+b*c)*y+c*d*(v+x-a*c*y)))/
	(Sqrt[1+b*c-I*c*d]*(1+b*c+I*c*d)^(3/2)),
	(s*(b^3*c^2*u+I*c^2*d^3*u+b^2*c*((2+I*c*d)*u+(a+I*c)*c*x)+
	((-I)*a+c)*d^2*(u+I*c^2*x)+(a+I*c)*(x-I*c^2*y)+
	I*d*(u+(a+I*c)*c*(-v-x+a*c*y))+b*((1+(2*I)*c*d+c^2*d^2)*u+
	c*((-I)*a+c)*((2*I)*x+c^2*y))))/(Sqrt[1+b*c-I*c*d]*(1+b*c+I*c*d)^(3/2)),
	((I/4)*((2*(b-I*d)*(1+b*c+I*c*d)*(b*v+a*y-I*(d*v+c*y)))/(1+b*c-I*c*d)-
	(2*(b+I*d)*(1+b*c-I*c*d)*s^4*(b*v+a*y+I*(d*v+c*y)))/(1+b*c+I*c*d)+
	((b-I*d)^2*(b*(d*u+c*(v+x))+I*(d^2*u+c*d*(v+x)+c*((-I)*a+c)*y)))/
	(1+b*c-I*c*d)+((b+I*d)^2*(1+b*c-I*c*d)*s^4*(b*(d*u+c*(v+x))+
	I*(d^2*u+c*d*(v+x)+c*((-I)*a+c)*y)))/(1+b*c+I*c*d)^2-
	((b-I*d)^2*(1+b*c+I*c*d)*(b*(d*u+c*(v+x))-I*(d^2*u+c*d*(v+x)+c*(I*a+c)*y)))/
	(1+b*c-I*c*d)^2-((b+I*d)^2*s^4*(b*(d*u+c*(v+x))-
	I*(d^2*u+c*d*(v+x)+c*(I*a+c)*y)))/(1+b*c+I*c*d)))/s^2}//Simplify

Sl2CIwasawaParDifferentialInversXX[sign_][m_][x_]:=Sl2CIwasawaParDifferentialInversXX[sign][m[[1,1]],
	m[[1,2]],m[[2,1]],m[[2,2]]][x[[1,1]],x[[1,2]],x[[2,1]],x[[2,2]]];

Sl2CIwasawaParDifferentialInversXX[sign_][a_,b_,c_,d_][x_]:=
	Sl2CIwasawaParDifferentialInversXX[sign][a,b,c,d][x[[1,1]],x[[1,2]],x[[2,1]],x[[2,2]]];

Sl2CIwasawaParDifferentialInversXX[sign_][m_][x_,y_,u_,v_]:=
	Sl2CIwasawaParDifferentialInversXX[sign][m[[1,1]],m[[1,2]],m[[2,1]],m[[2,2]]][x,y,u,v]

Sl2CIwasawaParDifferentialInversXX1[a_,b_,c_,d_][x_,y_,u_,v_]:=
	Sl2CIwasawaParDifferentialInversXX[-1][a,b,c,d][x,y,u,v]
	
Sl2CIwasawaParDifferentialInversXX1[m_][x_]:=Sl2CIwasawaParDifferentialInversXX1[m[[1,1]],
	m[[1,2]],m[[2,1]],m[[2,2]]][x[[1,1]],x[[1,2]],x[[2,1]],x[[2,2]]];

Sl2CIwasawaParDifferentialInversXX1[a_,b_,c_,d_][x_]:=
	Sl2CIwasawaParDifferentialInversXX1[a,b,c,d][x[[1,1]],x[[1,2]],x[[2,1]],x[[2,2]]];

Sl2CIwasawaParDifferentialInversXX1[m_][x_,y_,u_,v_]:=
	Sl2CIwasawaParDifferentialInversXX1[m[[1,1]],m[[1,2]],m[[2,1]],m[[2,2]]][x,y,u,v]

Sl2CIwasawaParDifferentialInversXX2[a_,b_,c_,d_][x_,y_,u_,v_]:=
	Sl2CIwasawaParDifferentialInversXX[1][a,b,c,d][x,y,u,v]
	
Sl2CIwasawaParDifferentialInversXX2[m_][x_]:=Sl2CIwasawaParDifferentialInversXX2[m[[1,1]],
	m[[1,2]],m[[2,1]],m[[2,2]]][x[[1,1]],x[[1,2]],x[[2,1]],x[[2,2]]];

Sl2CIwasawaParDifferentialInversXX2[a_,b_,c_,d_][x_]:=
	Sl2CIwasawaParDifferentialInversXX2[a,b,c,d][x[[1,1]],x[[1,2]],x[[2,1]],x[[2,2]]];

Sl2CIwasawaParDifferentialInversXX2[m_][x_,y_,u_,v_]:=
	Sl2CIwasawaParDifferentialInversXX2[m[[1,1]],m[[1,2]],m[[2,1]],m[[2,2]]][x,y,u,v]

commutatorKAN[a_,b_,c_][x1_,y1_,z1_][x2_,y2_,z2_]:=
	{((-I/2)*((-I)*(1+a^2)*(1+b^2)+(-1+a^2)*b^2*c)*(x2*y1-x1*y2))/(Sqrt[b/a]*(a*b)^(3/2)),
	
	((-((-1+a^2)*(-1+b^2))-I*(1+a^2)*b^2*c)*x2*y1+((-1+a^2)*(-1+b^2)+I*(1+a^2)*b^2*c)*x1*y2-
	b^5*(-I-c+a^2*(-I+c))*x2*z1+b^5*((-I)*(1+a^2)+(-1+a^2)*c)*x1*z2-
	I*(-a+a^3)*b^2*(y2*z1-y1*z2))/(2*a^2*Sqrt[b/a]*Sqrt[a*b]),
	
	(a^2*((-4*I)*x2*y1+(4*I)*x1*y2+b^3*(-1+b^2*(1+I*c))*x2*z1+b^3*(1+b^2*(-1-I*c))*x1*z2)+
	b^2*(-4*(I+c)*x2*y1+4*(I+c)*x1*y2+b*(-1+b^2-I*b^2*c)*x2*z1+b*(1+I*b^2*(I+c))*x1*z2)-
	I*a^3*b^2*(-3*I+b^2*(-I+c))*(y2*z1-y1*z2)+a*b^2*(1+I*b^2*(I+c))*(y2*z1-y1*z2))/(2*a^2*b^4)}

commutatorKAN[p_][x_,y_]:=commutatorKAN[p[[1]],p[[2]],p[[3]]][
	x[[1]],x[[2]],x[[3]]][y[[1]],y[[2]],y[[3]]]

commutatorKAN[a_,b_,c_][x_,y_]:=commutatorKAN[a,b,c][x[[1]],x[[2]],x[[3]]][y[[1]],y[[2]],y[[3]]]
	
commutatorKANoriginal[point_][vector1_,vector2_]:=Module[{inversematrix,comm,
	correspondingsltwoCmatrix1,correspondingsltwoCmatrix2,
	correspondingMatrix=Sl2CIwasawaPar[point]},
	inversematrix=correspondingMatrix//Inverse;
	correspondingsltwoCmatrix1=inversematrix.Sl2CIwasawaParDifferential[point][vector1];
	correspondingsltwoCmatrix2=inversematrix.Sl2CIwasawaParDifferential[point][vector2];
	comm=commutator[correspondingsltwoCmatrix1,correspondingsltwoCmatrix2];
	Sl2CIwasawaParDifferentialInvers[correspondingMatrix][correspondingMatrix.comm]//Simplify]


(********************** Befehle zur Variation ************************)

varexplicitKANcan[u1_,u2_,u3_][a_][z_]:=Module[{a1=D[a[z],z],a2,a3},
	a2=D[a1,z]//Simplify;a3=D[a2,z]//Simplify;
	expInt=Exp[Integrate[a[z]/D[a[z],z],z]];intExpInt=Integrate[a'[z]/expInt,z];
	
	{{(6*a1^4*expInt*intExpInt*u3[z]+a[z]^4*expInt*intExpInt*u3[z]-
	2*a1^2*a[z]*(3*a1^2*u3[z]+expInt*intExpInt*(a1*u2[z]+3*a2*u3[z]))+
	a[z]^3*(expInt*intExpInt*(a1*u2[z]+a2*u3[z])-a1*(a1*u1[z]+a2*u2[z]+a3*u3[z]))+
	a1*a[z]^2*(2*a1*(a1*u2[z]+3*a2*u3[z])+expInt*intExpInt*(a1*u1[z]+a2*u2[z]+
	(a3-2*a1)*u3[z])))/(a1*a[z]^4),
	(a[z]^6*u3[z]+6*a1^4*expInt^2*intExpInt^2*u3[z]-a[z]^5*(a1*u2[z]+a2*u3[z])-
	2*a1^2*a[z]*expInt*intExpInt*(6*a1^2*u3[z]+expInt*intExpInt*(a1*u2[z]+3*a2*u3[z]))+
	a[z]^3*(expInt^2*intExpInt^2*(a1*u2[z]+a2*u3[z])-2*a1^2*(a1*u2[z]+3*a2*u3[z])-
	2*a1*expInt*intExpInt*(a1*u1[z]+a2*u2[z]+a3*u3[z]))+a1*a[z]^2*(6*a1^3*u3[z]+
	4*a1*expInt*intExpInt*(a1*u2[z]+3*a2*u3[z])+expInt^2*intExpInt^2*(a1*u1[z]+a2*u2[z]+
	(a3-2*a1)*u3[z]))+a[z]^4*(expInt^2*intExpInt^2*u3[z]+a1*(a1*u1[z]+a2*u2[z]+
	(2*a1+a3)*u3[z])))/(a1*a[z]^4*expInt)},
	
	{-((expInt*(6*a1^4*u3[z]+a[z]^4*u3[z]+a[z]^3*(a1*u2[z]+a2*u3[z])-
	2*a1^2*a[z]*(a1*u2[z]+3*a2*u3[z])+a1*a[z]^2*(a1*u1[z]+a2*u2[z]+
	(a3-2*a1)*u3[z])))/(a1*a[z]^4)),
	(-6*a1^4*expInt*intExpInt*u3[z]-
	a[z]^4*expInt*intExpInt*u3[z]+2*a1^2*a[z]*(3*a1^2*u3[z]+expInt*intExpInt*
	(a1*u2[z]+3*a2*u3[z]))+a[z]^3*(-(expInt*intExpInt*(a1*u2[z]+a2*u3[z]))+
	a1*(a1*u1[z]+a2*u2[z]+a3*u3[z]))-a1*a[z]^2*(2*a1*(a1*u2[z]+3*a2*u3[z])+
	expInt*intExpInt*(a1*u1[z]+a2*u2[z]+(-2*a1+a3)*u3[z])))/(a1*a[z]^4)}}]


varexplicitNullKANcan[u2_,u3_][a_][z_]:=varexplicitKANcan[
	(u2[#]^2+cmcKappaKANOBS[a,bbcan[a]][#]*u3[#]^2)/(2*u3[#])&,u2,u3][a][z]


canKANFunctionOmega[u2_,u3_][a_][z_]:=Module[{a1=D[a[z],z]//Simplify,a2},a2=D[a1,z]//Simplify;
	-(E^Integrate[a[z]/a1,z]*(a[z]^2*u3[z]-2*u3[z]*a1^2+
	a[z]*(u2[z]*a1+u3[z]*a2))^2)/(2*a[z]^4*u3[z]*a1)//Simplify]

canKANFunctionG[u2_,u3_][a_][z_]:=-Integrate[Derivative[1][a][z]/E^Integrate[a[z]/
	Derivative[1][a][z],z],z]-(a[z]*(a[z]^2*u3[z]+2*u3[z]*Derivative[1][a][z]^2-
	a[z]*(u2[z]*Derivative[1][a][z]+u3[z]*Derivative[2][a][z])))/
	(E^Integrate[a[z]/Derivative[1][a][z],z]*(a[z]^2*u3[z]-2*u3[z]*Derivative[1][a][z]^2+
	a[z]*(u2[z]*Derivative[1][a][z]+u3[z]*Derivative[2][a][z])))//Simplify

(********************** Befehle aus  'tocmcKappa.m' ************************)

toSchwarzian[n_][f_,sf_][z_]:=Module[{f3=D[f[z],{z,3}],sw=schwarzderbr[f][z]^2,sol,fzi,tab},
	sol=f3/.Solve[sw==sf[z]^2,f3][[1]];
	fzi=Table[D[f3,{z,i}]//Simplify,{i,0,n}];
	tab=Table[D[sol,{z,i}]//Simplify,{i,0,n}];
	Thread[fzi->Simplify[tab//.Thread[fzi->tab]]]]

toSchwarzian[f_,sf_][z_]:=toSchwarzian[3][f,sf][z]

cmcKappaRuleOBS[n_][a_,b_,cmcCur_][z_]:=Module[{a1=D[a[z],z],b1=D[b[z],z],a2,b2,b3,Da3temp},
	a2=D[a1,z];b2=D[b1,z];b3=D[b2,z];
	Da3temp=(3*a[z]*a1*b1^3*a2-3*a[z]*a1^2*b1^2*b2+a[z]^2*a1*b1^2*b3+a[z]*b1^(3/2)*
	Sqrt[a[z]^4*cmcCur[z]*b1^3+12*a1^2*b1^3*a2^2-6*a[z]*b1^3*a2^3-24*a1^3*b1^2*a2*b2+
	6*a[z]*a1*b1^2*a2^2*b2+12*a1^4*b1*b2^2+6*a[z]*a1^2*b1*a2*b2^2-6*a[z]*a1^3*b2^3+
	2*a[z]^2*b1^2*a2^2*b3-4*a[z]^2*a1*b1*a2*b2*b3+2*a[z]^2*a1^2*b2^2*b3])/(a[z]^2*b1^3);
	Table[D[a[z],{z,3+i}]->D[Da3temp,{z,i}],{i,0,n}]]

cmcKappaRule[n_][a_,b_,cmcCur_][z_]:=Module[{a1=D[a[z],z],b1=D[b[z],z],a2,b2,b3,Da3temp},
	a2=D[a1,z];b2=D[b1,z];b3=D[b2,z];
	Da3temp=(3*a[z]*a1*b1^3*a2-3*a[z]*a1^2*b1^2*b2+a[z]^2*a1*b1^2*b3+a[z]*b1^(3/2)*
	Sqrt[a[z]^4*cmcCur[z]^2*b1^3+12*a1^2*b1^3*a2^2-6*a[z]*b1^3*a2^3-24*a1^3*b1^2*a2*b2+
	6*a[z]*a1*b1^2*a2^2*b2+12*a1^4*b1*b2^2+6*a[z]*a1^2*b1*a2*b2^2-6*a[z]*a1^3*b2^3+
	2*a[z]^2*b1^2*a2^2*b3-4*a[z]^2*a1*b1*a2*b2*b3+2*a[z]^2*a1^2*b2^2*b3])/(a[z]^2*b1^3);
	Table[D[a[z],{z,3+i}]->D[Da3temp,{z,i}],{i,0,n}]]

cmcKappaRulecanFalsch[n_][a_,cmcCur_][z_]:=Module[{Da3temp=D[a[z],{z,3}]/.Solve[
	Simplify[cmcKappaKANOBS[a,bbcan[a]][z]]==cmcCur[z]^2,D[a[z],{z,3}]][[1]]},
	Table[D[a[z],{z,3+i}]->D[Da3temp,{z,i}]//Simplify,{i,0,n}]]

cmcKappaRulecan[n_][a_,cmcCur_][z_]:=Module[{Da3temp=D[a[z],{z,3}]/.
		Solve[cmcKappaKANOBS[a,bbcan[a]][z]==cmcCur[z]^2,D[a[z],{z,3}]][[1]]},
	Table[D[a[z],{z,3+i}]->D[Da3temp,{z,i}]//Simplify,{i,0,n}]]


cmcCPPRule[a_,b_,CPP_][z_]:=Module[{
	Da2temp=D[a[z],z,z]/.Solve[cmcCPPKAN[a,b][z]==CPP[z],D[a[z],z,z]][[1]],xx,l},
	xx={Da2temp};
	Do[AppendTo[xx,Simplify[D[Last[xx],z]]],{5}];
	l=Length[xx];Table[D[a[z],{z,i+1}]->xx[[i]],{i,l}]];


cmcKappaRule[n_][a_,cmcCur_][z_]:=Module[{Da3temp=D[a[z],{z,3}]/.
		Solve[cmcKappaKANOBS[a,bbcan[a]][z]==cmcCur[z]^2,D[a[z],{z,3}]][[1]]},
	Table[D[a[z],{z,3+i}]->D[Da3temp,{z,i}]//Simplify,{i,0,n}]]


tocmcKappa[a_,b_,curv_][term_][z_]:=Module[{n=determineOrderBasic[term]},
	(term//.cmcKappaRule[n][a,b,curv][z])//Simplify]

tocmcKappa[a_,b_,curv_,CPP_][term_][z_]:=Module[{n=determineOrderBasic[term],ru,ccc,l,rr},
	ccc=cmcKappaRule[n][a,b,curv][z];l=Length[ccc];
	rr=cmcCPPRule[a,b,CPP][z];
	ru=Table[ccc[[i,1]]->(ccc[[i,2]]//.rr),{i,l}];
	(term//.Join[ru,rr])//Simplify]

tocmcKappacan[a_,curv_][term_][z_]:=Module[{n=determineOrderBasic[term]},
	(term//.cmcKappaRulecan[n][a,curv][z])//Simplify]

tocmcKappaShortXcan[term_]:=(term//.cmcKappaRulecan[5][a,cmcStudy][z])//Simplify

tocmcKappaShortX[term_]:=(term//.cmcKappaRule[5][a,b,curv][z])//Simplify


determineOrderBasic[term_]:=Module[{pp=Position[term,Derivative],l},l=Length[pp];
	Table[Extract[term,Drop[pp[[i]],-1]][[1]],{i,l}]//Max]

determineOrder[term_]:=Module[{pp=Position[term,Derivative],l},l=Length[pp];
	Table[Table[Extract[term,Append[Drop[pp[[j]],-1],i]],
		{i,Length[Extract[term,Drop[pp[[j]],-1]]]}],{j,l}]//Max]

sl2basisinCoordsOLD[a_][z_]:=Module[{basis,aa1,aa2,aa3,
	sl2frame=Sl2CFrameModified[a,bbcan[a]][z],curveinC3},
	curveinC3=Sl2CIwasawaParInvers[sl2frame][[1]];
	aa1=Sl2CIwasawaParDifferential[curveinC3][covDerVectorKAN1[a,bbcan[a]][z]]//Simplify;
	aa2=Sl2CIwasawaParDifferential[curveinC3][covDerVectorKAN2[a,bbcan[a]][z]]//Simplify;
	aa3=Sl2CIwasawaParDifferential[curveinC3][covDerVectorKAN3[a,bbcan[a]][z]]//Simplify;
	basis={aa1,aa2,aa3};
	{Table[basis[[i,1,1]],{i,3}],Table[basis[[i,1,2]],{i,3}],Table[basis[[i,2,1]],{i,3}]}];

sl2Coords[sl2CMatrix_][a_][z_]:=Inverse[sl2basisinCoordsOLD[a][z]].{sl2CMatrix[[1,1]],
	sl2CMatrix[[1,2]],sl2CMatrix[[2,1]]}//Together

sl2basisinCoords[a_][z_]:=Module[{expint,ax1,ax2,ax3},
	ax1=D[a[z],z]//Simplify;ax2=D[ax1,z]//Simplify;ax3=D[ax2,z]//Simplify;
	expint=E^Integrate[a[#]/Derivative[1][a][#],#]&;(**Print [expint[z]];**)
	{{(ax1*(-a[z]+ax1*expint[z]*Integrate[expint[z]^(-1),z]))/a[z]^2,
	(-2*ax1^3*expint[z]*Integrate[expint[z]^(-1),z]+a[z]^2*(-ax2+ax1*expint[z]*Integrate[expint[z]^(-1),z])+
	ax1*a[z]*(2*ax1+ax2*expint[z]*Integrate[expint[z]^(-1),z]))/a[z]^3,
	(6*ax1^4*expint[z]*Integrate[expint[z]^(-1),z]+a[z]^4*expint[z]*Integrate[expint[z]^(-1),z]-
	6*ax1^2*a[z]*(ax1+ax2*expint[z]*Integrate[expint[z]^(-1),z])+a[z]^3*
	(-ax3+ax2*expint[z]*Integrate[expint[z]^(-1),z])+ax1*a[z]^2*(6*ax2+(-2*ax1+ax3)*expint[z]*
	Integrate[expint[z]^(-1),z]))/a[z]^4},
	{(ax1*(a[z]-ax1*expint[z]*Integrate[expint[z]^(-1),z])^2)/(a[z]^2*expint[z]),
	-(((a[z]-ax1*expint[z]*Integrate[expint[z]^(-1),z])*(a[z]^3-2*ax1^3*expint[z]*
	Integrate[expint[z]^(-1),z]+a[z]^2*(-ax2+ax1*expint[z]*Integrate[expint[z]^(-1),z])+
	ax1*a[z]*(2*ax1+ax2*expint[z]*Integrate[expint[z]^(-1),z])))/(a[z]^3*expint[z])),
	(-(ax2*a[z]^5)+a[z]^6+6*ax1^6*expint[z]^2*Integrate[expint[z]^(-1),z]^2-
	6*ax1^4*a[z]*expint[z]*Integrate[expint[z]^(-1),z]*(2*ax1+ax2*expint[z]*
	Integrate[expint[z]^(-1),z])+ax1*a[z]^4*(2*ax1+ax3+ax1*expint[z]^2*
	Integrate[expint[z]^(-1),z]^2)+ax1^2*a[z]^3*(-6*ax2-2*ax3*expint[z]*Integrate[expint[z]^(-1),z]+
	ax2*expint[z]^2*Integrate[expint[z]^(-1),z]^2)+ax1^3*a[z]^2*(6*ax1+12*ax2*expint[z]*
	Integrate[expint[z]^(-1),z]+(-2*ax1+ax3)*expint[z]^2*Integrate[expint[z]^(-1),z]^2))/
	(ax1*a[z]^4*expint[z])},{-((ax1*expint[z])/a[z]^2),
	-(((-2*ax1^2+ax2*a[z]+a[z]^2)*expint[z])/a[z]^3),
	-(((6*ax1^4-6*ax1^2*ax2*a[z]+ax1*(-2*ax1+ax3)*a[z]^2+ax2*a[z]^3+a[z]^4)*expint[z])/(ax1*a[z]^4))}}]


wurzelausdruck[a_,b_][z_]:=Module[{a1=D[a[z],z],b1=D[b[z],z],a2,b2,b3},a2=D[a1,z];
	b2=D[b1,z];b3=D[b2,z];
	Sqrt[b1^3(a[z]^4*cmcCur[z]^2*b1^3+12*a1^2*b1^3*a2^2-6*a[z]*b1^3*a2^3-
	24*a1^3*b1^2*a2*b2+6*a[z]*a1*b1^2*a2^2*b2+12*a1^4*b1*b2^2+6*a[z]*a1^2*b1*a2*b2^2-
	6*a[z]*a1^3*b2^3+2*a[z]^2*b1^2*a2^2*b3-4*a[z]^2*a1*b1*a2*b2*b3+
	2*a[z]^2*a1^2*b2^2*b3)]//Simplify]


(********************** Befehle zur Killingform ************************)

onBasisofsl2C={DiagonalMatrix[{1,-1}],{{0,1},{1,0}},{{0,I},{-I,0}}}

(**xx={{x11,x12},{x21,-x11}};
yy={{y11,y12},{y21,-y11}}**)

killingFormSl2C[x_,y_]:=Module[{
	x11=x[[1,1]],x12=x[[1,2]],x21=x[[2,1]],
	y11=y[[1,1]],y12=y[[1,2]],y21=y[[2,1]]},
		4(2*x11*y11+x21*y12+x12*y21)//Simplify]

killingFormofGln[n_][aMatrix_,bMatrix_]:=Module[{null=Table[0,{n},{n}],
	basis,kommutatormitA,kommutatormitB,diagonalelemente,ix,jx},
	basis=Table[null,{n},{n}];
	Do[basis[[i,j,i,j]]=1,{i,n},{j,n}];
	diagonalelemente=Table[
		(kommutatormitB=bMatrix.basis[[ix,jx]]-basis[[ix,jx]].bMatrix;
		kommutatormitA=aMatrix.kommutatormitB-kommutatormitB.aMatrix;
		kommutatormitA[[ix,jx]]//Simplify),{ix,n},{jx,n}];
	Simplify[Plus@@Flatten[diagonalelemente]]]

killingFormofGln[aMatrix_,bMatrix_]:=Module[{
	dim={Dimensions[aMatrix],Dimensions[bMatrix]}//Flatten//Union},
	If[Length[dim]==1,killingFormofGln[dim[[1]]][aMatrix,bMatrix],
		Print["The matrices given are not quadratic or not of the same size."]]]

allgemeinematrix[symbol_,ord_]:=Table[ToExpression[
	StringJoin[ToString[symbol],ToString[i],ToString[j]]],{i,ord},{j,ord}]

matrixofkillingFormofGln[n_]:=Module[{null=Table[0,{n},{n}],basis,ix,jx},
	basis=Table[null,{n},{n}];
	Do[basis[[ix,jx,ix,jx]]=1,{ix,n},{jx,n}];
	gestrecktebasis=Flatten[basis,1];
	Table[killingFormofGln[gestrecktebasis[[ix]],gestrecktebasis[[jx]]],{ix,n*n},{jx,n*n}]];

onBasisofGln[n_]:=Module[{null=Table[0,{n},{n}],basis,ix,jx,vv,mm=matrixofkillingFormofGln[n]},
	basis=Table[null,{n},{n}];
	Do[basis[[ix,jx,ix,jx]]=1,{ix,n},{jx,n}];
	eve=Eigenvectors[mm];
	vv=Table[Table[Take[eve[[j]],{n(i-1)+1,n*i}],{i,n}],{j,n^2}];
	orthonormierungGlnOBS[vv]]

normierungGlnSimple[vv_]:=Module[{nn=killingFormofGln[vv,vv]//Simplify},
	If[nn==0,vv,If[nn>0,vv/Sqrt[nn]//simplGln,vv/Sqrt[-nn]//simplGln]]]

(** Die obige falsche Variante von normierungGln[vv] berücksichtigt nicht komplexe Matrizen,
und nicht Matrizen mit formalen Einträgen. Wir verwenden sie aber wegen ihrer Einfachheit
unten bei onBasisofGln[n]**)


normierungGln[vv_]:=Module[{nn=killingFormofGln[vv,vv]//Simplify,endres},
	endres:=If[nn==0,vv,
		If[TrueQ[Head[nn]==Complex],vv/Sqrt[nn]//simplGln,
		If[nn>0,vv/Sqrt[nn]//simplGln,vv/Sqrt[-nn]//simplGln],vv/Sqrt[nn]//simplGln]];
	If[NumericQ[nn],endres,vv/Sqrt[nn]//simplGln,vv/Sqrt[nn]//simplGln]]
orthonormierungGln[1][v1_List]:={normierungGln[v1[[1]]]}

orthonormierungGln[k_][vv_List]:=Module[{vvkaminus1=Drop[vv,-1],orthokaminus1,
	letztematrix=Last[vv],temp},orthokaminus1=orthonormierungGln[k-1][vvkaminus1];

	temp=letztematrix-Sum[killingFormofGln[letztematrix,orthokaminus1[[i]]]*
		killingFormofGln[orthokaminus1[[i]],orthokaminus1[[i]]]*
		orthokaminus1[[i]],{i,1,k-1}];
	Append[orthokaminus1,normierungGln[temp]]]

orthonormierungGln[vv_List]:=orthonormierungGln[Length[vv]][vv]

ad[m_][n_]:=m.n-n.m//Simplify;


adXadYvonMatrix[bas_][x_,y_,matr_]:=Module[{a,b,c,gl},
	gl=Flatten[Inner[Times,{a,b,c},bas,Plus]-ad[x][ad[y][matr]]];
	Flatten[{a,b,c}/.Solve[Thread[gl==Simplify[gl-gl]],{a,b,c}]]//Expand]


invariantmetricKAN[a_,b_,c_][t1_,t2_,t3_][s1_,s2_,s3_]:=
(8*b^2*s1*t1+8*a^2*s2*t2+(4*I)*a*b^4*(s3*t1+s1*t3))/8/(a^2*b^2)

invariantmetricKAN[a_][t_][s_]:=invariantmetricKAN[a[[1]],a[[2]],a[[3]]][
	t[[1]],t[[2]],t[[3]]][s[[1]],s[[2]],s[[3]]]

invariantmetricTensorKAN[a_,b_,c_]:=Module[{id=IdentityMatrix[3]},
	Table[invariantmetricKAN[{a,b,c}][id[[i]]][id[[j]]],{i,3},{j,3}]]

invariantmetricTensorKAN[p_]:=invariantmetricTensorKAN[p[[1]],p[[2]],p[[3]]]

gammaKAN[i_,j_,k_][point_]:=Module[{gij,gijInvers,aa,bb,cc,generalpoint,gammas},
	generalpoint={aa,bb,cc};
	gij=invariantmetricTensorKAN[generalpoint];
	gijInvers=Inverse[gij];
	gammas=Sum[gijInvers[[i,h]]*
		(D[gij[[h,j]],generalpoint[[k]]]+
		D[gij[[h,k]],generalpoint[[j]]]-
		D[gij[[j,k]],generalpoint[[h]]])/2,{h,3}];
	(gammas/.Thread[generalpoint:>point])//Simplify]

gammaKAN[i_,j_,k_][a_,b_,c_]:=gammaKAN[i,j,k][{a,b,c}]

covDerivativeKAN[xx_,yy_][point_]:=Module[{
	x=xx[point[[1]],point[[2]],point[[3]]],
	y=yy[point[[1]],point[[2]],point[[3]]]},
	(**Richtungsableitung der Koeffizienten von yy nach xx +
	Überschiebung (ohne Ableitung) der gammaKAN[k,i,j][point] mit x[[i]]*y[[j]]**)
	Table[Sum[x[[i]]*D[y[[k]],point[[i]]]//Simplify,{i,3}]+
        	Sum[x[[i]]*y[[j]]*gammaKAN[k,i,j][point]//Simplify,{i,3},{j,3}],
      			{k,3}]//Simplify]

covDerivativeKAN[xx_,yy_][a_,b_,c_]:=covDerivativeKAN[xx,yy][{a,b,c}]

gammaKANcollection[i_][a_,b_,c_]:={
	{gammaKAN[i,1,1][a,b,c],gammaKAN[i,2,1][a,b,c],gammaKAN[i,3,1][a,b,c]},
	{gammaKAN[i,1,2][a,b,c],gammaKAN[i,2,2][a,b,c],gammaKAN[i,3,2][a,b,c]},
	{gammaKAN[i,1,3][a,b,c],gammaKAN[i,2,3][a,b,c],gammaKAN[i,3,3][a,b,c]}}

gammaKANcollection[a_,b_,c_]:={
	gammaKANcollection[1][a,b,c],gammaKANcollection[2][a,b,c],gammaKANcollection[3][a,b,c]}

christoffelSymbols[i_,j_,k_][n_][metrictensor_][point_List]:=Module[{
	gij,gijInvers,p,generalpoint,gammas},
	generalpoint=
		Table[ToExpression[StringJoin[ToString[p],ToString[h]]],{h,n}];
	gij=metrictensor[generalpoint];
	gijInvers=Inverse[gij];
	gammas=Sum[gijInvers[[i,h]]*
		(D[gij[[h,j]],generalpoint[[k]]]+
		D[gij[[h,k]],generalpoint[[j]]]-
		D[gij[[j,k]],generalpoint[[h]]])/2,{h,n}];
	(gammas/.Thread[generalpoint:>point])//Simplify]

christoffelSymbols[i_,j_,k_][metrictensor_][point_List]:=
	christoffelSymbols[i,j,k][Length[point]][metrictensor][point];

highercovDerKANofCurve[1][gamma_][t_]:=D[gamma[t],t]//Simplify

highercovDerKANofCurve[n_Integer][gamma_][t_]:=
	covDerofVectorfieldKANalongCurve[gamma,
		highercovDerKANofCurve[n-1][gamma][#]&][t]//Together

covDerofVectorfieldKANalongCurve[gamma_,vec_][z_]:=Module[{
	tangent=D[gamma[z],z]//Simplify},
	Table[Sum[gammaKAN[i,j,k][gamma[z]]*tangent[[j]]*vec[z][[k]],
	{j,3},{k,3}],{i,3}]+D[vec[z],z]]

covDerofVectorfieldalongCurveInsl2OBS[nn_,xx_][z_]:=D[xx[z],z]-Inner[Times,
	killingFormSl2C[commutator[nn[z],#]/16,xx[z]]&/@onBasisofsl2C,onBasisofsl2C,Plus]//Simplify

covDerofVectorfieldalongCurveInsl2[nn_,xx_][z_]:=D[xx[z],z]+commutator[nn[z],xx[z]]/2//Simplify


covDerofVectorfieldalongCurveInsl2[n11_,n12_,n21_,x11_,x12_,x21_][z_]:=
	covDerofVectorfieldalongCurveInsl2[{{n11[#],n12[#]},{n21[#],-n11[#]}}&,
		{{x11[#],x12[#]},{x21[#],-x11[#]}}&][z]

tangentVectorKAN1[a11_,a12_,a21_,a22_][g_,om_][z_]:=
	{((-I)*om[z])/(Sqrt[a11[z]-I*a21[z]]*(a11[z]+I*a21[z])^(3/2)),
	((a11[z]*(a12[z]+a11[z]*g[z])+(a21[z]*(1+a12[z]*a21[z]+
	a11[z]*a21[z]*g[z]))/
	a11[z])*om[z])/(Sqrt[a11[z]-I*a21[z]]*Sqrt[a11[z]+I*a21[z]]),
	-(((a21[z]^2*(1+a12[z]*a21[z])^2+2*a11[z]^5*a12[z]*g[z]+
	2*a11[z]*a21[z]^3*(1+a12[z]*a21[z])*g[z]+2*a11[z]^3*a21[z]*
	(1+2*a12[z]*a21[z])*g[z]+a11[z]^6*g[z]^2+
	a11[z]^4*(a12[z]^2+2*a21[z]^2*g[z]^2)+a11[z]^2*(-1+2*a12[z]*a21[z]+
	2*a12[z]^2*a21[z]^2+a21[z]^4*g[z]^2))*om[z])/
	(a11[z]^2*(a11[z]^2+a21[z]^2)^2))}

tangentVectorKAN2[a11_,a12_,a21_,a22_][g_,om_][z_]:=Module[{
	g1=D[g[z],z]//Simplify,om1=D[om[z],z]//Simplify,w1,w2},
	w1=Sqrt[a11[z]-I*a21[z]]*(a11[z]+I*a21[z])^(3/2);
	w2=Sqrt[a11[z]-I*a21[z]]*Sqrt[a11[z]+I*a21[z]];
{((-I)*om1)/w1,
(a11[z]^2*a12[z]*om1+a21[z]*(1+a12[z]*a21[z])*om1+a11[z]^3*(om[z]*g1+
	g[z]*om1)+a11[z]*a21[z]^2*(om[z]*g1+g[z]*om1))/(a11[z]*w2),
-((a21[z]^2*(1+a12[z]*a21[z])^2*om1+2*a11[z]^5*a12[z]*(om[z]*g1+g[z]*om1)+2*a11[z]*a21[z]^3*
	(1+a12[z]*a21[z])*(om[z]*g1+g[z]*om1)+2*a11[z]^3*a21[z]*(1+2*a12[z]*a21[z])*
	(om[z]*g1+g[z]*om1)+a11[z]^6*g[z]*(2*om[z]*g1+g[z]*om1)+a11[z]^4*(a12[z]^2*om1+
	2*a21[z]^2*g[z]*(2*om[z]*g1+g[z]*om1))+a11[z]^2*(-om1+2*a12[z]*a21[z]*om1+2*a12[z]^2*a21[z]^2*om1+
	a21[z]^4*g[z]*(2*om[z]*g1+g[z]*om1)))/(a11[z]^2*(a11[z]^2+a21[z]^2)^2))}]

tangentVectorKAN3[a11_,a12_,a21_,a22_][g_,om_][z_]:=Module[{
	g1=D[g[z],z]//Simplify,om1=D[om[z],z]//Simplify,w1,w2},
	g2=D[g1,z]//Simplify;om2=D[om1,z]//Simplify;
	w1=Sqrt[a11[z]-I*a21[z]]*(a11[z]+I*a21[z])^(3/2);
	w2=Sqrt[a11[z]-I*a21[z]]*Sqrt[a11[z]+I*a21[z]];
{((-I)*(om[z]^2*g1+om2))/w1,
(a11[z]^2*a12[z]*(om[z]^2*g1+om2)+a21[z]*(1+a12[z]*a21[z])*(om[z]^2*g1+om2)+
	a11[z]^3*(2*g1*om1+om[z]*g2+g[z]*(om[z]^2*g1+om2))+a11[z]*a21[z]^2*(2*g1*om1+om[z]*g2+
	g[z]*(om[z]^2*g1+om2)))/(a11[z]*w2),
-((a21[z]^2*(1+a12[z]*a21[z])^2*(om[z]^2*g1+om2)+2*a11[z]^5*a12[z]*(2*g1*om1+
	om[z]*g2+g[z]*(om[z]^2*g1+om2))+2*a11[z]*a21[z]^3*(1+a12[z]*a21[z])*(2*g1*om1+
	om[z]*g2+g[z]*(om[z]^2*g1+om2))+2*a11[z]^3*a21[z]*(1+2*a12[z]*a21[z])*(2*g1*om1+
	om[z]*g2+g[z]*(om[z]^2*g1+om2))+a11[z]^6*(2*om[z]*g1^2+2*g[z]*(2*g1*om1+
	om[z]*g2)+g[z]^2*(om[z]^2*g1+om2))+a11[z]^2*((-1+2*a12[z]*a21[z]+2*a12[z]^2*a21[z]^2+
	a21[z]^4*g[z]^2)*om[z]^2*g1+2*a21[z]^4*om[z]*(g1^2+g[z]*g2)-om2+2*a12[z]*a21[z]*om2+
	2*a12[z]^2*a21[z]^2*om2+a21[z]^4*g[z]*(4*g1*om1+g[z]*om2))+a11[z]^4*(a12[z]^2*(om[z]^2*g1+om2)+
	2*a21[z]^2*(2*om[z]*g1^2+2*g[z]*(2*g1*om1+om[z]*g2)+g[z]^2*(om[z]^2*g1+om2))))/
	(a11[z]^2*(a11[z]^2+a21[z]^2)^2))}]

tangentVectorKAN4[a11_,a12_,a21_,a22_][g_,om_][z_]:=Module[{
	g1=D[g[z],z]//Simplify,om1=D[om[z],z]//Simplify,g2,g3,om2,om3,w1,w2},
	g2=D[g1,z]//Simplify;g3=D[g2,z]//Simplify;
	om2=D[om1,z]//Simplify;om3=D[om2,z]//Simplify;
	w1=Sqrt[a11[z]-I*a21[z]]*(a11[z]+I*a21[z])^(3/2);
	w2=Sqrt[a11[z]-I*a21[z]]*Sqrt[a11[z]+I*a21[z]];

{((-I)*(om3+4*g1*om1*om[z]+2*g2*om[z]^2))/w1,
(a11[z]^2*a12[z]*(om3+4*g1*om1*om[z]+2*g2*om[z]^2)+a21[z]*(1+a12[z]*a21[z])*
	(om3+4*g1*om1*om[z]+2*g2*om[z]^2)+a11[z]^3*(3*g2*om1+3*g1*om2+om3*g[z]+
	(g3+4*g1*om1*g[z])*om[z]+2*(g1^2+g2*g[z])*om[z]^2)+a11[z]*a21[z]^2*(3*g2*om1+
	3*g1*om2+om3*g[z]+(g3+4*g1*om1*g[z])*om[z]+2*(g1^2+g2*g[z])*om[z]^2))/(a11[z]*w2),
-((a21[z]^2*(1+a12[z]*a21[z])^2*(om3+4*g1*om1*om[z]+2*g2*om[z]^2)+
	2*a11[z]^5*a12[z]*(3*g2*om1+3*g1*om2+om3*g[z]+(g3+4*g1*om1*g[z])*om[z]+
	2*(g1^2+g2*g[z])*om[z]^2)+2*a11[z]*a21[z]^3*(1+a12[z]*a21[z])*(3*g2*om1+3*g1*om2+
	om3*g[z]+(g3+4*g1*om1*g[z])*om[z]+2*(g1^2+g2*g[z])*om[z]^2)+2*a11[z]^3*a21[z]*
	(1+2*a12[z]*a21[z])*(3*g2*om1+3*g1*om2+om3*g[z]+(g3+4*g1*om1*g[z])*om[z]+
	2*(g1^2+g2*g[z])*om[z]^2)+a11[z]^6*(6*g1*(g1*om1+g2*om[z])+2*g[z]*(3*g2*om1+3*g1*om2+
	g3*om[z]+2*g1^2*om[z]^2)+g[z]^2*(om3+4*g1*om1*om[z]+2*g2*om[z]^2))+
	a11[z]^4*(a12[z]^2*(om3+4*g1*om1*om[z]+2*g2*om[z]^2)+2*a21[z]^2*(6*g1*(g1*om1+g2*om[z])+
	2*g[z]*(3*g2*om1+3*g1*om2+g3*om[z]+2*g1^2*om[z]^2)+
	g[z]^2*(om3+4*g1*om1*om[z]+2*g2*om[z]^2)))+a11[z]^2*(-om3-4*g1*om1*om[z]-2*g2*om[z]^2+
	2*a12[z]*a21[z]*(om3+4*g1*om1*om[z]+2*g2*om[z]^2)+
	2*a12[z]^2*a21[z]^2*(om3+4*g1*om1*om[z]+2*g2*om[z]^2)+
	a21[z]^4*(6*g1*(g1*om1+g2*om[z])+2*g[z]*(3*g2*om1+3*g1*om2+g3*om[z]+2*g1^2*om[z]^2)+
	g[z]^2*(om3+4*g1*om1*om[z]+2*g2*om[z]^2))))/(a11[z]^2*(a11[z]^2+a21[z]^2)^2))}]


tangentVectorKAN5[a11_,a12_,a21_,a22_][g_,om_][z_]:=Module[{
	g1=D[g[z],z]//Simplify,om1=D[om[z],z]//Simplify,g2,g3,g4,om2,om3,om4,w1,w2},
	g2=D[g1,z]//Simplify;g3=D[g2,z]//Simplify;g4=D[g3,z]//Simplify;
	om2=D[om1,z]//Simplify;om3=D[om2,z]//Simplify;om4=D[om3,z]//Simplify;
	w1=Sqrt[a11[z]-I*a21[z]]*(a11[z]+I*a21[z])^(3/2);
	w2=Sqrt[a11[z]-I*a21[z]]*Sqrt[a11[z]+I*a21[z]];

{((-I)*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+3*g3*om[z]^2+2*g1^2*om[z]^3))/w1,
(a11[z]^2*a12[z]*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+
	3*g3*om[z]^2+2*g1^2*om[z]^3)+a21[z]*(1+a12[z]*a21[z])*(4*g1*om1^2+om4+
	(11*g2*om1+7*g1*om2)*om[z]+3*g3*om[z]^2+2*g1^2*om[z]^3)+
	a11[z]^3*(4*g3*om1+6*g2*om2+4*g1*om3+(g4+11*g1^2*om1)*om[z]+9*g1*g2*om[z]^2+
	g[z]*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+3*g3*om[z]^2+2*g1^2*om[z]^3))+
	a11[z]*a21[z]^2*(4*g3*om1+6*g2*om2+4*g1*om3+(g4+11*g1^2*om1)*om[z]+9*g1*g2*om[z]^2+
	g[z]*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+3*g3*om[z]^2+2*g1^2*om[z]^3)))/(a11[z]*w2),
-((a21[z]^2*(1+a12[z]*a21[z])^2*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+
	3*g3*om[z]^2+2*g1^2*om[z]^3)+a11[z]^2*(-om4+2*om4*a12[z]*a21[z]+2*om4*a12[z]^2*a21[z]^2+
	12*g1^2*om2*a21[z]^4+8*g3*om1*a21[z]^4*g[z]+12*g2*om2*a21[z]^4*g[z]+om4*a21[z]^4*g[z]^2+
	4*g1*(6*g2*om1*a21[z]^4+2*om3*a21[z]^4*g[z]+om1^2*(-1+2*a12[z]*a21[z]+2*a12[z]^2*a21[z]^2+
	a21[z]^4*g[z]^2))+(-11*g2*om1-7*g1*om2+2*(11*g2*om1+7*g1*om2)*a12[z]*a21[z]+
	2*(11*g2*om1+7*g1*om2)*a12[z]^2*a21[z]^2+a21[z]^4*(6*g2^2+8*g1*g3+2*(g4+11*g1^2*om1)*g[z]+
	(11*g2*om1+7*g1*om2)*g[z]^2))*om[z]+(-3*g3+6*g3*a12[z]*a21[z]+6*g3*a12[z]^2*a21[z]^2+
	a21[z]^4*(4*g1^3+18*g1*g2*g[z]+3*g3*g[z]^2))*om[z]^2+2*g1^2*(-1+2*a12[z]*a21[z]+
	2*a12[z]^2*a21[z]^2+a21[z]^4*g[z]^2)*om[z]^3)+2*a11[z]^5*a12[z]*(4*g3*om1+6*g2*om2+
	4*g1*om3+(g4+11*g1^2*om1)*om[z]+9*g1*g2*om[z]^2+g[z]*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+
	3*g3*om[z]^2+2*g1^2*om[z]^3))+2*a11[z]*a21[z]^3*(1+a12[z]*a21[z])*(4*g3*om1+6*g2*om2+4*g1*om3+
	(g4+11*g1^2*om1)*om[z]+9*g1*g2*om[z]^2+g[z]*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+
	3*g3*om[z]^2+2*g1^2*om[z]^3))+2*a11[z]^3*a21[z]*(1+2*a12[z]*a21[z])*(4*g3*om1+6*g2*om2+4*g1*om3+
	(g4+11*g1^2*om1)*om[z]+9*g1*g2*om[z]^2+g[z]*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+
	3*g3*om[z]^2+2*g1^2*om[z]^3))+a11[z]^6*(12*g1*(2*g2*om1+g1*om2)+(6*g2^2+8*g1*g3)*om[z]+
	4*g1^3*om[z]^2+2*g[z]*(4*g3*om1+6*g2*om2+4*g1*om3+(g4+11*g1^2*om1)*om[z]+9*g1*g2*om[z]^2)+
	g[z]^2*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+3*g3*om[z]^2+2*g1^2*om[z]^3))+
	a11[z]^4*(a12[z]^2*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+3*g3*om[z]^2+2*g1^2*om[z]^3)+
	2*a21[z]^2*(12*g1*(2*g2*om1+g1*om2)+(6*g2^2+8*g1*g3)*om[z]+4*g1^3*om[z]^2+
	2*g[z]*(4*g3*om1+6*g2*om2+4*g1*om3+(g4+11*g1^2*om1)*om[z]+9*g1*g2*om[z]^2)+
	g[z]^2*(4*g1*om1^2+om4+(11*g2*om1+7*g1*om2)*om[z]+3*g3*om[z]^2+2*g1^2*om[z]^3))))/
	(a11[z]^2*(a11[z]^2+a21[z]^2)^2))}]

(*************** Sl2CMatrixEXPParametrisierung and related stuff ********************)

Sl2CFramerule[order_][a11_,a12_,a21_,a22_][g_,om_][z_]:=Module[{
	k,y,np=nilpotentsl2MatrixBasic[g,om][z],
	sl2={{a11[z],a12[z]},{a21[z],a22[z]}},ableitungen,
	bryantframebedingung},
	ableitungen=Union[Flatten[D[sl2,z]]];
	bryantframebedingung=Thread[Flatten[D[sl2,z]-sl2.np]=={0,0,0,0}];
	k=ableitungen//.Flatten[Solve[bryantframebedingung,ableitungen]];
	y=Table[Thread[D[ableitungen,{z,i}]->Simplify[D[k,{z,i}]]],{i,0,order}];
	Flatten[{y,Solve[Det[sl2]==1,a22[z]],
		Table[D[a22[z],{z,i}]->-D[a11[z],{z,i}],{i,0,order+1}]}]];


brCPP[g_,om_][z_]:=Sqrt[om[z]^2*Derivative[1][g][z]^2]

brKappa[g_,om_][z_]:=Sqrt[4*Derivative[1][g][z]^2*Derivative[1][om][z]^2-
	2*om[z]^3*Derivative[1][g][z]^3+om[z]^2*Derivative[2][g][z]^2-2*om[z]*Derivative[1][g][z]*
	(Derivative[1][g][z]*Derivative[2][om][z]-2*Derivative[1][om][z]*Derivative[2][g][z])]

Sl2CMatrixEXPparam[r_,u_,v_]:=Module[{liealgebra=Inner[Times,
	{r*Cos[u]Cos[v],r*Cos[v]Sin[u],r*Sin[v]},
	onBasisofsl2C,Plus]},MatrixExp[liealgebra]//Simplify]

Sl2CMatrixEXPparam[v_List]:=Sl2CMatrixEXPparam[v[[1]],v[[2]],v[[3]]]

Sl2CMatrixEXPparamInvers1[matrix_]:=Eigenvalues[matrix][[2]]//Log//Simplify

Sl2CMatrixEXPparamInvers2[matrix_]:=(matrix[[1,2]]-matrix[[2,1]])/(2I*
	Sinh[Sl2CMatrixEXPparamInvers1[matrix]])//ArcSin//Simplify

Sl2CMatrixEXPparamInvers3[matrix_]:=Module[{
	fak=2I*Sinh[Sl2CMatrixEXPparamInvers1[matrix]]//FullSimplify,xx,yy},
	xx=(matrix[[1,2]]+matrix[[2,1]])/fak//Simplify;
	yy=(matrix[[1,2]]-matrix[[2,1]])/fak//Simplify;
	I*xx/Sqrt[1-yy^2]//FullSimplify//PowerExpand//ArcSin]

Sl2CMatrixEXPparamInvers[matrix_]:=Module[{
	fak=2I*Sinh[Sl2CMatrixEXPparamInvers1[matrix]]//FullSimplify,xx,yy},
	xx=(matrix[[1,2]]+matrix[[2,1]])/fak//Simplify;
	yy=(matrix[[1,2]]-matrix[[2,1]])/fak//Simplify;
	{Sl2CMatrixEXPparamInvers1[matrix],
		I*xx/Sqrt[1-yy^2]//FullSimplify//PowerExpand//ArcSin,
		yy//ArcSin}]

invariantmetricMatrixEXP[ax_][tx_][sx_]:=
	(sx[[2]]*tx[[2]]+(-1+E^(2*ax[[1]]))^2*Cos[2*ax[[3]]]*sx[[2]]*tx[[2]]+
	2*sx[[3]]*tx[[3]]+E^(2*ax[[1]])*(8*sx[[1]]*tx[[1]]-2*sx[[2]]*tx[[2]]-
	4*sx[[3]]*tx[[3]])+E^(4*ax[[1]])*(sx[[2]]*tx[[2]]+2*sx[[3]]*tx[[3]]))/
	(8*E^(2*ax[[1]]))//Simplify

invariantmetricMatrixEXP[a1_,a2_,a3_][t1_,t2_,t3_][s1_,s2_,s3_]:=
	invariantmetricMatrixEXP[{a1,a2,a3}][{t1,t2,t3}][{s1,s2,s3}]

invariantmetricTensorMatrixEXP[ax_]:={{1,0,0},
	{0,((-1+E^(2*ax[[1]]))^2*Cos[ax[[3]]]^2)/(4*E^(2*ax[[1]])),0},
	{0,0,(-1+E^(2*ax[[1]]))^2/(4*E^(2*ax[[1]]))}}//Simplify

invariantmetricTensorMatrixEXP[r_,u_,v_]:=invariantmetricTensorMatrixEXP[{r,u,v}]

gammaMatrixEXP[i_,j_,k_][point_]:=
	christoffelSymbols[i,j,k][invariantmetricTensorMatrixEXP][point]//Simplify

gammaMatrixEXP[i_,j_,k_][a_,b_,c_]:=gammaMatrixEXP[i,j,k][{a,b,c}]

covDerivativeMatrixEXP[xx_,yy_][point_]:=Module[{
	x=xx[point[[1]],point[[2]],point[[3]]],
	y=yy[point[[1]],point[[2]],point[[3]]]},
(**Richtungsableitung der Koeffizienten von yy nach xx + Überschiebung
(ohne Ableitung) der gammaMatrixEXP[k, i, j][point] mit x[[i]]*y[[j]]**)
	Table[Sum[x[[i]]*D[y[[k]],point[[i]]]//Simplify,
	{i,3}]+Sum[x[[i]]*y[[j]]*gammaMatrixEXP[k,i,j][point]//Simplify,
	{i,3},{j,3}],{k,3}]//Simplify]

covDerofVectorfieldMatrixEXPalongCurve[gamma_,vec_][z_]:=Module[{
	tangent=D[gamma[z],z]//Simplify},
	Table[
		Sum[gammaMatrixEXP[i,j,k][gamma[z]]*tangent[[j]]*vec[z][[k]],{j,3},{k,3}],
		{i,3}]+D[vec[z],z]]

highercovDerMatrixEXPofCurve[1][gamma_][t_]:=D[gamma[t],t]//Simplify

highercovDerMatrixEXPofCurve[n_Integer][gamma_][t_]:=
	covDerofVectorfieldMatrixEXPalongCurve[gamma,
		highercovDerMatrixEXPofCurve[n-1][gamma][#]&][t]//Together


nullcurveToHermiteanmodel[mm_][u_,v_]:=
	hyperbolicComplexExpand[ComplexExpand[mm[u+I*v].Conjugate[Transpose[mm[u+I*v]]]]]

nullcurveToHermiteanmodelPolar[mm_][u_,v_]:=
	hyperbolicComplexExpand[ComplexExpand[mm[u*Exp[I*v]].Conjugate[Transpose[mm[u*Exp[I*v]]]]]]

nullcurveToBallmodel[mm_][u_,v_]:=nullcurveToHermiteanmodel[mm][u,v]//hermitean2by2ToLorentz//
	lorentzmodelToBallmodel//Simplify

nullcurveToBallmodelPolar[mm_][u_,v_]:=nullcurveToHermiteanmodelPolar[mm][u,v]//
	hermitean2by2ToLorentz//lorentzmodelToBallmodel//Simplify

nullcurveToUpperhalfSpace[mm_][u_,v_]:=nullcurveToHermiteanmodel[mm][u,v]//
	hermitean2by2ToLorentz//lorentzmodelToUpperhalfSpace//Simplify

nullcurveToUpperhalfSpacePolar[mm_][u_,v_]:=nullcurveToHermiteanmodelPolar[mm][u,v]//
	hermitean2by2ToLorentz//lorentzmodelToUpperhalfSpace//Simplify

drahtrahmenderspaehreX[m_,n_]:=Module[{p=ParametricPlot3D[{Cos[v]Cos[u],Cos[v]Sin[u],Sin[v]}//Evaluate,
	{u,0,2Pi},{v,-Pi/2,Pi/2},DisplayFunction->Identity,PlotPoints->{2m,2n}],q,x,y={}},
	q=p[[1]];l=Length[q];
	Do[(x=q[[i,1]];y=Join[y,
		{Table[Line[{x[[i]],x[[i+1]]}]//Graphics3D,{i,Length[x]-1}],
			{Line[{Last[x],First[x]}]//Graphics3D}}//Flatten]),{i,l}];
	Show[Union[y],Axes->None,Boxed->False,DisplayFunction->Identity]]

drahtrahmenderspaehreY[n_,m_]:=Module[{s={Cos[#2]Cos[#1],Cos[#2]Sin[#1],Sin[#2]}&,breiten},
	breiten=Table[s[u,i]//Evaluate,{i,-Pi/2,Pi/2,Pi/n}];
	laengen=Table[s[i,u]//Evaluate,{i,0,2Pi,Pi/m}];
	ParametricPlot3D[Join[breiten,laengen]//Evaluate,{u,0,2Pi},
	Axes->None,Boxed->False,DisplayFunction->Identity]]


drahtrahmen:=drahtrahmenderspaehreY[5,5];

           End[]   (** Geometry`CMCSurfaces`Private` **)

commandsavailableCMCsurfs:=Module[{tt=Names["CMCSurfaces`*"],l,l1,teil1,teil2},
l=Length[tt];If[Mod[l,2]==0,l1=Floor[l/2],l1=Floor[l/2]+1];
teil1=Take[tt,l1];teil2=Complement[tt,teil1];
If[Mod[l,2]==1,AppendTo[teil2,""],{}];
Transpose[{teil1,teil2}]//TableForm]

Protect[funHforprescribedCPP,funHforprescribedCPPInvers,
	Sl2CFrameMeromorphicCPPInvers2,Sl2CFrameMeromorphicCPPInvers1,
	Sl2CFrameMeromorphicCPPInvers,Sl2CFrameMeromorphicCPP,
	Sl2CFrameMeromorphicCPPExp,Sl2CFrameModifiedCPP,
	nullcurveCanParameterPrime,nullcurveCurvature,nullcurveCheck,
	directPlotBallmodelPolarDisplay,directPlotBallmodelDisplay,
	directPlotUpperhalfSpace,directPlotBallmodel,directPlotUpperhalfSpacePolar,directPlotBallmodelPolar,
	verzerrung,weiPCcurveBallModelPlot,weiPCcurveBallModelverzerrung,gitter,
	gridToball,polygons,wwTemp,wwTempPrime,weiderivativeRule,
	punktabstand,matrixToballmodel,
ballmodelPlot,ballmodelPlotPolar,upperHalfspacePlot,upperHalfspacePlotPolar,
(** Befehle zur algebraischen Darstellungsformel von Nullkurven **)
Sl2CFrameMeromorphicToSl2CModified,Sl2CFrameMeromorphicToSl2CModified1,
Sl2CFrameMeromorphicToSl2CModified2,
Sl2CFrameMeromorphic,Sl2CFrameMeromorphicInvers,Sl2CFrameMeromorphicInvers1,
Sl2CFrameMeromorphicInvers2,Sl2CFrameMeromorphicInverswithConstants,
Sl2CFrameMeromorphicInverswithConstants1,Sl2CFrameMeromorphicInverswithConstants2,
meromorphicBRIntegral,meromorphicBRIntegralDirect,meromorphicBRToExactForms,
meroBRInversDirect,meroBRInvers,meroBRInversDirectwithConstants,
meroBRInverswithConstants,meroBRInversDirectwithConstants,
(**tominkBR,fromminkBR,RuleforMinkUndNpvpBR,RuleforMinkUndNpvpInversBR,**)

(**technische Befehle für H^3**)
	hyperbolicadjointMatrix,hyperbolicComplexargumentrule,hyperbolicComplexExpand,
	hyperbolicCross,hyperbolicCrosswithCheck,hyperbolicCrossX,
	hyperbolicSurfaceNormalInhyperbolicPolarCoords,hyperbolicSurfaceNormalVector,
	hyperbolicSurfaceNormalVectorwithCheck,hyperbolicOrthogonalProjection,
	hyperbolicTangentVectorofH3,hyperbolicTangentVectorofH3Invers,
	hyperbolicTangentVectorofH3Inversobs,hyperbolicunitNormal,
(**Befehle für Flächen in H^3**)
	hyperbolicE,hyperbolicF,hyperbolicG,hyperbolicfirstFF,hyperbolicL,hyperbolicM,hyperbolicN,
	hyperbolicsecondFF,hyperbolicsecondFFdirect,
	hyperbolicGaussiancurvature,hyperbolicMeancurvature,hyperbolicLeviCivita,
	hyperbolicWeingartenmap,

	lorentzToHermitean2by2,hermitean2by2ToLorentz,
	(**gehören zur Gruppe der Befehle, die zwischenSO(1,3) und Sl(2,C) vermittel**)



(**Befehle für Lorentzparametrisierung und im Kugel (Poincare)-Model, oberer Halbraum**)

	lorentzGroupIwasawa,lorentzGroupIwasawa0,lorentzGroupIwasawaInvers,
	llEukl,llLoren,lorentzGroup,lorentzLength,lorentzMetrik,lorentzmetric,
	lorentzMetrikobsolete,lorentzmodelToBallmodel,ballmodelToLorentzmodel,
	upperhalfSpaceToBallmodel,ballmodelToUpperhalfSpace,
	upperhalfSpaceToLorentzmodel,lorentzmodelToUpperhalfSpace,lorentzianTypeSurface,
	nullcurveToBallmodel,nullcurveToBallmodelPolar,nullcurveToHermiteanmodel,
	nullcurveToHermiteanmodelPolar,
	nullcurveToUpperhalfSpace, nullcurveToUpperhalfSpacePolar,
	drahtrahmenderspaehreX,drahtrahmenderspaehreY,
	drahtrahmen,
	lorentzianTypeSurfaceModified,lorentzpart,normalofH3,

(**
Befehle für KAN-Parametrisierung von Sl(2,C) und die lokalen Ausdrücke für die
	invariante komplex-Riemannsche Metrik, kovariante Ableitung etc. **)

	Sl2CIwasawaPar,Sl2CToSO13,Sl2CToSO13Invers,Sl2CIwasawaParInvers1,Sl2CToSO13Differential,
	Sl2CToSO13InversDifferential,Sl2CIwasawaParInvers2, Sl2CIwasawaParInvers3, Sl2CIwasawaParInvers,
	invariantmetricKAN,gammaKAN,gammaKANcollection,covDerivativeKAN,
	highercovDerKANofCurve,covDerofVectorfieldKANalongCurve,covDerofVectorfieldalongCurveInsl2,

(** weitere Befehle zu Sl2CIwasawaParametrisierung und Sl2CMatrixEXPParametrisierung vom Aug. 2002**)
	basicFunctionG,basicFunctionOmega,basicFunctionGMeromorphic,basicFunctionOmegaMeromorphic,
	basicFunctionGModified,basicFunctionOmegaModified,
	Sl2CFramerule, Sl2CFramerule4,Sl2CAction,toBryantframeData,brCPP,brKappa,
	cmcKappaKANOBS,cmcKappaKAN,cmcCPPKAN,
	tangentVectorKAN1,tangentVectorKAN2,tangentVectorKAN3,tangentVectorKAN4,tangentVectorKAN5,
	Sl2CMatrixEXPparam,Sl2CMatrixEXPparamInvers,Sl2CMatrixEXPparamInvers1,
	Sl2CMatrixEXPparamInvers2,Sl2CMatrixEXPparamInvers3,invariantmetricMatrixEXP,
	invariantmetricTensorMatrixEXP,gammaMatrixEXP,
	covDerivativeMatrixEXP,covDerofVectorfieldMatrixEXPalongCurve,highercovDerMatrixEXPofCurve,
	Sl2CIwasawaParDifferentialInvers,Sl2CIwasawaParDifferential,
	Sl2CIwasawaParInversXX,Sl2CIwasawaParInversXX1,Sl2CIwasawaParInversXX2,
	Sl2CIwasawaParDifferentialInversXX,Sl2CIwasawaParDifferentialInversXX1,
	Sl2CIwasawaParDifferentialInversXX2,
	matrixOfScalarproducts,schwarzderbr,
	bbcan,partielIntegrationbbcan,aFunForEqualG,aFunModifiedForEqualG,

	nullcurveToBryantdata,nullcurveToBryantdata1,nullcurveToBryantdata2,
	nullcurveToModifiedData1,nullcurveToModifiedData2,nullcurveToModifiedData,
	riccatiEquationforSl2CFrameBR,Sl2CFrameBR,Sl2CFrameBR1,
	linearDiffEqof2ndOrder,functionAforSl2CFrameBR2,functionBforSl2CFrameBR2,
	functionAforSl2CFrameBR1,functionBforSl2CFrameBR1,riccatiEquationforSl2CFrameBR1,


	Sl2CFrameBR2,Sl2CFrameBROBS,Sl2CFrame,Sl2CFrameModified,BianchiCaloSmallDouble,
	squaredlengthOfThirdDerOfBianchiCaloSmallDouble,BianchiCaloSmallDoubleCurvature,
	BianchiCaloSmallDoubleCurvatureFORMAL,BianchiCaloSmallDoubleCanParameterPrime,
	BianchiCaloSmallDoubleInvers,BianchiCaloSmallDoubleInvers1,BianchiCaloSmallDoubleInvers2,
	Sl2CFrameBianchiCaloSmall,auxBianchiCaloSmall,BianchiCaloSmallFrame,
	covDerVectorKAN1,covDerVectorKAN2,
	covDerVectorKAN3,covDerVectorKAN4,covDerVectorKAN5,cppKAN2,

(**Befehle zur Variation von Nullkurven - sind jetzt wahrscheinlich überholt**)

	varexplicitKANcan,varexplicitNullKANcan,canKANFunctionOmega,canKANFunctionG,
	commutatorKAN,commutatorKANoriginal,

	spur,commutator,adjointRepresentation,
(**Befehle aus dem Paket tocmcKappa.m - stehen in Zusammenhang mit
	varexplicitKANcan,varexplicitNullKANcan,canKANFunctionOmega,canKANFunctionG**)

	cmcKappaRulecan,cmcKappaRule,cmcCPPRule,toSchwarzian,
	tocmcKappacan,tocmcKappa,tocmcKappaShortXcan,tocmcKappaShortX,
	wurzelausdruck,
	(**wurzelersetzungen3,wurzelableitungen5 (werden nicht exportiert)**)
	determineOrder,determineOrderBasic,sl2basisinCoords,sl2Coords];


EndPackage[] (**CMCSurfaces` **)


Print["For a list of available commands type\n 'commandsavailableCMCsurfs'."]

Print["Type lookupString[s] to find names of commands containing the string s."]

lookupString[string_String] := Module[{pp = StringJoin["*", string, "*"]},
    Select[Flatten[commandsavailableCMCsurfs[[1]]],
      StringMatchQ[#, pp] == True &]]

lookupString[s_Symbol]:=lookupString[ToString[s]]

(** einige Zusatzbefehle, die innerhalb des Paketes nicht funktionieren,
da Sl2CFramerule4 dann aus Bryantsurfaces -Patterns der Gestalt
CMCSurfaces`Private`a11[CMCSurfaces`Private`z]->
	CMCSurfaces`Private`a12[CMCSurfaces`Private`z]+...  besteht

Sl2CFramerule4:=Sl2CFramerule[4][a11,a12,a21,a22][g,om][z];
toBryantframeData[x_]:=(x//.Sl2CFramerule4)//Simplify**)

