Skip to contents

Provides the Euclidean metric tensor of \(\mathbb{E}^n\). g_eucl_cart() returns a numeric (constant) tensor in Cartesian coordinates, $$ds^2=\sum_{i=1}^n dx_i^2$$ while g_eucl_sph() returns a symbolic tensor field in generalized spherical coordinates \({r, \phi_1, \phi_2, ..., \phi_{n-1}}\). $$ds^2=dr^2 + r^2 d\Omega^2$$

Usage

g_eucl_cart(n, coords = paste0("x", 1:n))

g_eucl_sph(n, coords = c("r", paste0("ph", 1:(n - 1))))

Arguments

n

The dimension of the metric tensor.

coords

A character vector of coordinate names. The length needs to match the tensor dimensions.

Value

The covariant metric tensor as array imputed with coordinate names.

Details

As usual, spherical coordinates are degenerate at \(r = 0\) and \(\phi_l = 0\), so be careful around those points.

See also

Wikipedia: Euclidean metric tensor

Other metric tensors: g_mink_cart(), g_sph(), g_ss(), metric_field()

Examples

g_eucl_cart(3)
#> <Covariant metric tensor field> (x1, x2, x3)
#>      [,1] [,2] [,3]
#> [1,]    1    0    0
#> [2,]    0    1    0
#> [3,]    0    0    1
g_eucl_cart(3) %_% .(+i, +j)
#> <Labeled Array> [3x3] .(+i, +j)
#>      [,1] [,2] [,3]
#> [1,]    1    0    0
#> [2,]    0    1    0
#> [3,]    0    0    1
g_eucl_sph(3)
#> <Covariant metric tensor field> (r, ph1, ph2)
#>      [,1] [,2]    [,3]            
#> [1,] "1"  "0"     "0"             
#> [2,] "0"  "r^2*1" "0"             
#> [3,] "0"  "0"     "r^2*sin(ph1)^2"
g_eucl_sph(3) %_% .(+i, +j)
#> <Labeled Array> [3x3] .(+i, +j)
#>      [,1] [,2]            [,3]                    
#> [1,] "1"  "0"             "0"                     
#> [2,] "0"  "(1) / (r^2*1)" "0"                     
#> [3,] "0"  "0"             "(1) / (r^2*sin(ph1)^2)"