Given a \(k\)-form, return its Hodge dual

hodge(K, n=dovs(K), g, lose=TRUE)

Arguments

K

Object of class kform

n

Dimensionality of space, defaulting the the largest element of the index

g

Diagonal of the metric tensor, with missing default being the standard metric of the identity matrix. Currently, only entries of \(\pm 1\) are accepted

lose

Boolean, with default TRUE meaning to coerce to a scalar if appropriate

Value

Given a \(k\)-form, in an \(n\)-dimensional space, return a \((n-k)\)-form.

Author

Robin K. S. Hankin

Note

Most authors write the Hodge dual of \(\psi\) as \(*\psi\) or \(\star\psi\), but Weintraub uses \(\psi *\).

See also

Examples



(o <- kform_general(5,2,1:10))
#> An alternating linear map from V^2 to R with V=R^5:
#>          val
#>  2 5  =    8
#>  1 5  =    7
#>  3 4  =    6
#>  2 4  =    5
#>  4 5  =   10
#>  1 4  =    4
#>  2 3  =    3
#>  1 3  =    2
#>  3 5  =    9
#>  1 2  =    1
hodge(o)
#> An alternating linear map from V^3 to R with V=R^5:
#>            val
#>  3 4 5  =    1
#>  1 2 4  =   -9
#>  2 4 5  =   -2
#>  2 3 5  =    4
#>  1 2 3  =   10
#>  1 4 5  =    3
#>  1 3 5  =   -5
#>  1 2 5  =    6
#>  2 3 4  =   -7
#>  1 3 4  =    8
o == hodge(hodge(o))
#> [1] TRUE

Faraday <- kform_general(4,2,runif(6)) # Faraday electromagnetic tensor
mink <- c(-1,1,1,1)  # Minkowski metric
hodge(Faraday,g=mink)
#> An alternating linear map from V^2 to R with V=R^4:
#>                 val
#>  3 4  =  -0.6140056
#>  2 4  =   0.4414992
#>  1 4  =   0.3155947
#>  2 3  =  -0.1013138
#>  1 3  =  -0.2726462
#>  1 2  =   0.6536994

Faraday  == Faraday |>
      hodge(g=mink) |>
      hodge(g=mink) |>
      hodge(g=mink) |>
      hodge(g=mink)
#> [1] TRUE

hodge(dx,3) == dy^dz
#> [1] TRUE


## Some edge-cases:
hodge(scalar(1),2)
#> An alternating linear map from V^2 to R with V=R^2:
#>          val
#>  1 2  =    1
hodge(zeroform(5),9)
#> The zero alternating linear map from V^4 to R with V=R^n:
#> empty sparse array with 4 columns
hodge(volume(5))
#> [1] 1
hodge(volume(5),lose=TRUE)
#> [1] 1
hodge(scalar(7),n=9)
#> An alternating linear map from V^9 to R with V=R^9:
#>                        val
#>  1 2 3 4 5 6 7 8 9  =    7