Tensor[DGGramSchmidt] - calculate an orthonormal basis with respect to a metric
Calling Sequences
DGGramSchmidt(S, g, method, signature)
Parameters
S - a list of differential forms, vectors or tensors
g - a metric tensor
method - (optional) keyword argument method = "normalized" or method = "un-normalized"
signature - (optional) keyword argument signature = pm, where pm is a list of +1 or -1
Description
Examples
See Also
The command DGGramSchmidt applies the usual Gram-Schmidt procedure to a list S=X1,X2,...,Xm, of m independent vectors, forms or tensors (the forms or tensors must all be of the same type). The procedure returns a list orthogonal vectors, forms or tensors Y1,Y2,...,Ym such that
spanY1,Y2,...,Yk = spanX1,X2,...,Xk for k=1,2,...,m.
The inner products of differential forms and tensors are calculated using TensorInnerProduct.
The default assumption is that the metric g is positive-definite, that is, the signature is 1,1,...,1. In this case the length of each Yk is normalized to 1. With method = "un-normalized" the Yk are left un-normalized.
If, for example, the signature of g is 1,−1,−1,−1, use the keyword signature = [+1, -1, -1, -1]. The length of Y1 is normalized to 1 and the lengths of Y2,Y3,Y4 are normalized to −1.
If, for example, the signature of g is 1,−1,−1,−1 and the vectors X1,X2 are both null, then the usual Gram-Schmidt procedure will fail. In this case set signature = [[1,-1], 1, 1] and DGGramSchmidt will take Y1 to be a vector of non-zero length in the span of X1,X2.
This command is part of the DifferentialGeometry:-Tensor package, and so can be used in the form DGGramSchmidt(...) only after executing the command with(DifferentialGeometry); with(Tensor); in that order. It can always be used in the long form DifferentialGeometry:-Tensor:-DGGramSchmidt.
with⁡DifferentialGeometry:with⁡Tensor:
Example 1.
First define a 4 dimensional manifold M with coordinates x,y,u,v.
DGsetup⁡x,y,u,v,M
frame name: M
Define a metric g on M.
g ≔ evalDG⁡dx &t dx+dy &t dy+du &t du+dv &t dv
g:=_DG⁡tensor,M,cov_bas,cov_bas,,1,1,1,2,2,1,3,3,1,4,4,1,_DG⁡tensor,M,cov_bas,cov_bas,,1,1,1,2,2,1,3,3,1,4,4,1
Define a list of vectors S1.
S1 ≔ D_x+D_y,D_y+2⁢D_u,D_u−D_v,D_v
S1:=_DG⁡vector,M,,1,1,_DG⁡vector,M,,1,1+_DG⁡vector,M,,2,1,_DG⁡vector,M,,2,1,_DG⁡vector,M,,2,1,_DG⁡vector,M,,2,1+2⁢_DG⁡vector,M,,3,1,_DG⁡vector,M,,3,1,_DG⁡vector,M,,3,1,_DG⁡vector,M,,3,1−_DG⁡vector,M,,4,1,_DG⁡vector,M,,4,1,_DG⁡vector,M,,4,1,_DG⁡vector,M,,4,1
T1 ≔ DGGramSchmidt⁡S1,g
T1:=_DG⁡vector,M,,1,22,2,22,_DG⁡vector,M,,1,22,2,22,_DG⁡vector,M,,1,−26,2,26,3,2⁢23,_DG⁡vector,M,,1,−26,2,26,3,2⁢23,_DG⁡vector,M,,1,1015,2,−1015,3,1030,4,−3⁢1010,_DG⁡vector,M,,1,1015,2,−1015,3,1030,4,−3⁢1010,_DG⁡vector,M,,1,105,2,−105,3,1010,4,1010,_DG⁡vector,M,,1,105,2,−105,3,1010,4,1010
We use the command TensorInnerProduct. to check this result.
TensorInnerProduct⁡g,T1,T1
We repeat the same computation with method = "un-normalized". The result is free of square roots but now the vectors are not unit vectors.
T1u ≔ DGGramSchmidt⁡S1,g,method=unnormalized
T1u:=_DG⁡vector,M,,1,1,2,1,_DG⁡vector,M,,1,1,2,1,_DG⁡vector,M,,1,−12,2,12,3,2,_DG⁡vector,M,,1,−12,2,12,3,2,_DG⁡vector,M,,1,29,2,−29,3,19,4,−1,_DG⁡vector,M,,1,29,2,−29,3,19,4,−1,_DG⁡vector,M,,1,15,2,−15,3,110,4,110,_DG⁡vector,M,,1,15,2,−15,3,110,4,110
TensorInnerProduct⁡g,T1u,T1u
Example 2.
We continue with the metric from Example 1 but now apply the Gram-Schmidt procedure to a list of 2-forms.
S2 ≔ evalDG⁡dx &w dy−du &w dv,dx &w dy,dx &w dv−dy &w dv,dx &w dv,dx &w du+dy &w dv
S2:=_DG⁡form,M,2,1,2,1,3,4,−1,_DG⁡form,M,2,1,2,1,3,4,−1,_DG⁡form,M,2,1,2,1,_DG⁡form,M,2,1,2,1,_DG⁡form,M,2,1,4,1,2,4,−1,_DG⁡form,M,2,1,4,1,2,4,−1,_DG⁡form,M,2,1,4,1,_DG⁡form,M,2,1,4,1,_DG⁡form,M,2,1,3,1,2,4,1,_DG⁡form,M,2,1,3,1,2,4,1
T2 ≔ DGGramSchmidt⁡S2,g
T2:=_DG⁡form,M,2,1,2,12,3,4,−12,_DG⁡form,M,2,1,2,12,3,4,−12,_DG⁡form,M,2,1,2,12,3,4,12,_DG⁡form,M,2,1,2,12,3,4,12,_DG⁡form,M,2,1,4,12,2,4,−12,_DG⁡form,M,2,1,4,12,2,4,−12,_DG⁡form,M,2,1,4,12,2,4,12,_DG⁡form,M,2,1,4,12,2,4,12,_DG⁡form,M,2,1,3,22,_DG⁡form,M,2,1,3,22
TensorInnerProduct⁡g,T2,T2
Example 3.
Consider now an indefinite metric.
g3 ≔ evalDG⁡dx &t dx+dy &t dy−du &t du−dv &t dv
g3:=_DG⁡tensor,M,cov_bas,cov_bas,,1,1,1,2,2,1,3,3,−1,4,4,−1,_DG⁡tensor,M,cov_bas,cov_bas,,1,1,1,2,2,1,3,3,−1,4,4,−1
S3 ≔ dx,dy,du,dv
S3:=_DG⁡form,M,1,1,1,_DG⁡form,M,1,1,1,_DG⁡form,M,1,2,1,_DG⁡form,M,1,2,1,_DG⁡form,M,1,3,1,_DG⁡form,M,1,3,1,_DG⁡form,M,1,4,1,_DG⁡form,M,1,4,1
A direct application of the GramSchmidt process yields complex-valued forms.
DGGramSchmidt⁡S3,g3
_DG⁡form,M,1,1,1,_DG⁡form,M,1,1,1,_DG⁡form,M,1,2,1,_DG⁡form,M,1,2,1,_DG⁡form,M,1,3,−I,_DG⁡form,M,1,3,−I,_DG⁡form,M,1,4,−I,_DG⁡form,M,1,4,−I
We can adjust the normalization of the last two 1-forms to have length -1 to obtain a real basis:
DGGramSchmidt⁡S3,g3,signature=1,1,−1,−1
_DG⁡form,M,1,1,1,_DG⁡form,M,1,1,1,_DG⁡form,M,1,2,1,_DG⁡form,M,1,2,1,_DG⁡form,M,1,3,1,_DG⁡form,M,1,3,1,_DG⁡form,M,1,4,1,_DG⁡form,M,1,4,1
Example 4.
Consider another indefinite metric.
g4 ≔ evalDG⁡dx &s dy+du &t du+dv &t dv
g4:=_DG⁡tensor,M,cov_bas,cov_bas,,1,2,12,2,1,12,3,3,1,4,4,1,_DG⁡tensor,M,cov_bas,cov_bas,,1,2,12,2,1,12,3,3,1,4,4,1
S4 ≔ D_x,D_y,D_u,D_v
S4:=_DG⁡vector,M,,1,1,_DG⁡vector,M,,1,1,_DG⁡vector,M,,2,1,_DG⁡vector,M,,2,1,_DG⁡vector,M,,3,1,_DG⁡vector,M,,3,1,_DG⁡vector,M,,4,1,_DG⁡vector,M,,4,1
A direct application of the GramSchmidt process fails since the first two vectors are null vectors. We can work around this problem by changing the initial basis.
S4a ≔ evalDG⁡D_x+D_u,D_y,D_u,D_v
S4a:=_DG⁡vector,M,,1,1,3,1,_DG⁡vector,M,,1,1,3,1,_DG⁡vector,M,,2,1,_DG⁡vector,M,,2,1,_DG⁡vector,M,,3,1,_DG⁡vector,M,,3,1,_DG⁡vector,M,,4,1,_DG⁡vector,M,,4,1
DGGramSchmidt⁡S4a,g4,signature=1,−1,1,1
_DG⁡vector,M,,1,1,3,1,_DG⁡vector,M,,1,1,3,1,_DG⁡vector,M,,1,−1,2,2,3,−1,_DG⁡vector,M,,1,−1,2,2,3,−1,_DG⁡vector,M,,2,−2,3,1,_DG⁡vector,M,,2,−2,3,1,_DG⁡vector,M,,4,1,_DG⁡vector,M,,4,1
Alternatively, we can adjust the signature option.
DGGramSchmidt⁡S4,g4,signature=1,−1,1,1
_DG⁡vector,M,,1,1,2,1,_DG⁡vector,M,,1,1,2,1,_DG⁡vector,M,,1,1,2,−1,_DG⁡vector,M,,1,1,2,−1,_DG⁡vector,M,,3,1,_DG⁡vector,M,,3,1,_DG⁡vector,M,,4,1,_DG⁡vector,M,,4,1
DifferentialGeometry, Tensor, TensorInnerProduct
Download Help Document
What kind of issue would you like to report? (Optional)