g_sph: Metric tensor of the sphere

View source: R/tensor_fields.R

g_sphR Documentation

Metric tensor of the sphere

Description

Provides the metric tensor of the sphere S^n with radius 1. g_sph() returns a symbolic tensor field in generalized spherical coordinates {\phi_1, \phi_2, ..., \phi_{n-1}}.

d\Omega^2= d\phi_1^2 + \sum_{i=1}^{n-1} \prod_{m=1}^{i-1} sin(\phi_m)^2 d\phi_i^2

Usage

g_sph(n, coords = paste0("ph", 1:n))

Arguments

n

The dimension of the metric tensor.

coords

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

Details

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

Value

The covariant metric tensor as array imputed with coordinate names.

See Also

Wikipedia: Sphere

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

Examples

g_sph(3)
g_sph(3) %_% .(+i, +j)

ricci documentation built on Sept. 9, 2025, 5:56 p.m.