Integrates the geodesic equation
d^2 x^mu / d tau^2 + Gamma^mu_ab (dx^a / d tau)(dx^b / d tau) = 0 with
Gamma^l_mn = 1/2 g^ls (d_m g_sn + d_n g_sm - d_s g_mn), the metric
derivatives taken by central differences of step h, by an
adaptive Dormand-Prince 5(4) scheme at rtol 1e-10, atol 1e-12.
Usage
morie_geods(
metric_func,
x0,
u0,
tau_span = c(0, 10),
n_points = 500L,
h = 1e-05
)
Arguments
- metric_func
Function of a length-4 position returning the 4 x 4
metric.
- x0
Initial position (length 4).
- u0
Initial velocity (length 4).
- tau_span
Proper-time interval.
- n_points
Number of output points.
- h
Finite-difference step for the metric derivatives.
Value
List with tau, position (n x 4), velocity
(n x 4).
Examples
flat <- function(x) diag(c(-1, 1, 1, 1))
r <- morie_geods(flat, c(0, 0, 0, 0), c(1, 0.5, 0, 0), c(0, 2), 5)
r$position[5, ]
#> [1] 2 1 0 0