I'm trying to follow several tutorials on metric tensors. One of the common exercises is a polar metric. I'm stuck trying to implement this in Mathematica. According to the derivation, the polar metric is this:$$g_{\mu\nu}= \begin{bmatrix}1 & 0 & 0\\0 & r^2 & 0\\0 & 0 & r^2 sin^2\theta\end{bmatrix}$$So if I want to implement this in Mathematica, I have: $$g_{\mu\nu}[r_,\phi,\theta]:=\{\{1.,0.,0.\},\{0.,r^2,0.\},\{0.,0.,r^2 Sin^2[\theta]\}$$Now, my goal is to find $ds^2$, the distance between two points on this manifold using the formula $$ds^2=\sum_{i,j=1}^3 g_{\mu\nu}dx^idx^j$$ So I construct two random points. I know from another exercise that the distance between these two points is $\sqrt {17}$:
p1 = CoordinateTransformData["Cartesian" -> "Spherical",
"Mapping", {4., 2., -1.}];
p2 = CoordinateTransformData["Cartesian" -> "Spherical",
"Mapping", {7., 4., -3.}];
And this is where I'm stuck. How do I use $g_{\mu\nu}$ to calculation the distance between the two points? That is, I have an $r$ parameter in the metric, but I can only extract a $dr, d\theta, d\phi$ from the two points. Where do I find the values that go into the matrix ($r$ and $\theta$)?
NDSolve
and the shooting method. For special metrics, there is also a chance that one can derive a closed symbolic expression for the geodesic distance... $\endgroup$