Differential Forms with Mathematica

Use of the intrinsic function TensorWedge

We can compute wedge products of differential forms using TensorWedge:

ω \[TensorWedge] λ = TensorWedge[ω,λ]     

The wedge like symbols is special, not the ordinary wedge ⋀ ([Esc]^[Esc]).
You can type it with [Esc]t^[Esc] or \ [TensorWedge]

First define some differential forms:

d = 4; (* dimension of space *)

(*Two forms:*)
A= Array[Subscript[a,#1,#2]&,{d,d}];
B= Array[Subscript[b,#1,#2]&,{d,d}];

(*One Forms *)
Ω= Array[Subscript[ω,#1]&,{d}]; 
Λ= Array[Subscript[λ,#1]&,{d}];

$Assumptions = {(A|B)∈ Arrays[{d,d},Reals,Antisymmetric[All]], (Ω|Λ) ∈ Arrays[{d},Reals]}; 

Print["A=",A//MatrixForm, "  B=",B//MatrixForm, "   Ω=",Ω//MatrixForm, "  Λ=",Λ//MatrixForm]

Whenever you want the two forms A,B to keep only the independent components, apply the following rule:

rule = {
Table[(Subscript[a, i,j]) -> -(Subscript[a, j,i]),{i,2,d},{j,i-1}],   Table[(Subscript[a, i,i])-> 0,{i,d}],
Table[(Subscript[b, i,j]) -> -(Subscript[b, j,i]),{i,2,d},{j,i-1}],   Table[(Subscript[b, i,i])-> 0,{i,d}]
}//Flatten;

Print["A=",A/.rule//MatrixForm, "  B=",B/.rule//MatrixForm, "\nrule= ",rule]

TensorWedge[Ω \[TensorWedge] Λ] // Normal //MatrixForm

Same, use the \[TensorWedge] symbol:

Ω \[TensorWedge] Λ //Normal//MatrixForm

Wedge product of 1 form and 2 form:

Ω \[TensorWedge] A //Normal //MatrixForm

Get rid of redundant components of A: apply the rule:

(Ω\[TensorWedge]A //Normal)/.rule//MatrixForm

Nonzero elements:  ( x === y is SameQ[x,y])

Select[Flatten[(Ω\[TensorWedge]A//Normal)/.rule],(!# === 0)&]//Column

Nonzero elements:  ( x === y is SameQ[x,y]) with components:

list = (Ω\[TensorWedge]A//Normal)/.rule;

Select[
Flatten[                     
Table[ {Subscript["(Ω\[TensorWedge]A)",i,j,k],list[[i,j,k]]},{i,d},{j,d},{k,d}] (*make pairs of name+values*)
,2]                            (*Flatten to level 2 only*)
,(!#[[2]] === 0)& (*select nonzero elements*)
]//Column

Check graded anticommutativity of wedge product:

((A \[TensorWedge] Ω  -Ω\[TensorWedge]A)//Normal)== ConstantArray[0,{d,d,d}]

Dimensions[list]

Wedge product of two 2-forms: the nonzero elements

Select[Flatten[(A\[TensorWedge]B//Normal)/.rule],(!# ===0)&]//Column

Use of the function HodgeDual to compute duals of forms

Compare a two form and its Hodge Dual:

A1 = (                       A   // Normal )/.rule ;
A2 = (HodgeDual[A] // Normal )/.rule ;
Print["A= ",A1//MatrixForm, "    *A= ",A2//MatrixForm]

The Hodge dual of a 4-form is a scalar:

HodgeDual[A\[TensorWedge]B] /.rule

The Hodge dual of a 3-form is a vector:

(HodgeDual[A\[TensorWedge]Ω] //Normal)/.rule //MatrixForm

Work with abstract forms without explicit components

Define 10 dimensional forms

Dim=10;
$Assumptions={
(ξ|ξ1 | ξ2|ξ3)∈Arrays[{Dim,Dim,Dim},Reals,Antisymmetric[{1,2,3}]],
σ∈Arrays[{Dim},Reals,Antisymmetric[{1}]]
}

This is left unevaluated:

ξ \[TensorWedge] σ + σ\[TensorWedge]ξ

TensorReduce puts tensors in canonical form. Here it applies the anticommutative property of the wedge product:

ξ \[TensorWedge] σ + σ\[TensorWedge]ξ //TensorReduce

Linear combinations and wedge product of those: Here they are left unevaluated:

(a1 ξ1 + a2 ξ2) \[TensorWedge] (b1 ξ1+b2 ξ2)

The products are expanded:

(a1 ξ1 + a2 ξ2) \[TensorWedge] (b1 ξ1+b2 ξ2) //TensorExpand

A differential form of order higher than Dim is zero:

ξ \[TensorWedge] ξ1 \[TensorWedge] ξ2 \[TensorWedge] ξ3