How to compute and interpret Schwartzchild black-hole metric line element $ds$ in Cartesian coordinates? The Schwarzschild metric in Cartesian coordinates is listed on Wikipedia as:




Line element
Notes




$$-{\frac {\left(1-{\frac {r_{\mathrm {s} }}{4R}}\right)^{2}}{\left(1+{\frac {r_{\mathrm {s} }}{4R}}\right)^{2}}}\,{dt}^{2}+\left(1+{\frac {r_{\mathrm {s} }}{4R}}\right)^{4}\,\left(dx^{2}+dy^{2}+dz^{2}\right)$$
$$R = \sqrt{ x^2 + y^2 + z^2 }$$ Valid only outside the event horizon: $R>r_s/4$




I am new to computing metrics, if anyone more experienced can help please. Using this Cartesian formula above to compute the path value $[t, x, y, z]$ while choosing units to be Schwarzschild radius $R_s = 1$ gives the following results:
From $[0, 4, 4, 4]$ to $[1, 5, 5, 5]$, $ds = 1.61$
From $[0, 4, 4, 4]$ to $[2, 5, 5, 5]$, $ds = 0.07$
I am unsure what this means, as both computations start and end at the exact same space coordinates, from $[4,4,4]$ to $[5,5,5]$. The particle is moving radially outward from the Schwarzschild sphere of radius $R_s = 1$, centered at the origin $[0,0,0]$.
The only difference is that the first test particle takes 1 time unit to travel the same distance, while the second particle takes a longer 2 time unit to travel the same distance.
1. Why do the ds values vary so greatly if the space endpoints are the same?
2. What does it mean to have $ds=0$ between two spacetime points?
The code used to compute the results are as follows:
let ds = straight_line_path([0, 4, 4, 4], [1, 5, 5, 5], 1000000);      

function straight_line_path (st1, st2, pixel)
{
    let dt = (st2[0]-st1[0])/pixel;
    let dx = (st2[1]-st1[1])/pixel;
    let dy = (st2[2]-st1[2])/pixel;
    let dz = (st2[3]-st1[3])/pixel;
    
    let total = 0;
    
    for (let i=0; i<pixel; i++)
    {
        total += line_schwartzchild (dt, dx, dy, dz, [st1[1]+i*dx, st1[2]+i*dy, st1[3]+i*dz]);
    }
    
    return total;
}

function line_schwartzchild (dt, dx, dy, dz, [x0,y0,z0])
{
    let r = Math.sqrt (x0*x0 + y0*y0 + z0*z0);

    let km = 1 - 1/(4*r);
    let kp = 1 + 1/(4*r);

    let a = km*km/(kp*kp);
    let b = kp*kp*kp*kp;

    let sum = Math.abs(-a*(dt*dt) + b*(dx*dx + dy*dy + dz*dz));

    return Math.sqrt(sum);
}

Am I using the wrong formula, or computing something wrong along the way?
 A: In addition to @Andrea's answer about interpreting timelike, spacelike, and null paths, there is a computational issue with your method as well.
The metric, $g_{\alpha\beta}$, is not the same everywhere in spacetime.  It is a function of radial distance from the center.  In your calculation you evaluate the metric at the starting point ($\vec{r}_0$), and then use that value for the whole path.
$$s = \sqrt{\pm g_{\alpha\beta}(\vec{r}_0) \Delta r^\alpha\,\Delta r^\beta}$$
$$\Delta\vec{r} = \vec{r}_1 - \vec{r}_0,$$
where $\vec{r}$ is a four-vector with components $r^\alpha = (t,x,y,z)$.  If the displacement is small, then this approximate calculation should be acceptable. The correct calculation would integrate $ds$ over the path.
$$s = \int_{\vec{r}_0}^{\vec{r}_1} ds = \int_{\vec{r}_0}^{\vec{r}_1} ​d\tau \sqrt{\pm g_{\alpha\beta}[\vec{r}(\tau)] \frac{d r^\alpha}{d\tau}\, \frac{d r^\beta}{d\tau}},$$
where $\tau$ is an affine parameterization of the path.  For timelike paths, proper time is a common choice.
The integral accounts for the fact that $g$ takes on a different value at each point along the path.
For a spacelike path, you would use the $+$ under the square root and interpret the $s$ as the proper length separating the points.  For a timelike path,  you would use the $-$ and $s$ is the proper time taken.
A: A thing that seems to confuse you is that the line element $ds$ is not a measure of distance in space. The line element is a measure of distance in spacetime, and it can be positive, negative and also 0. If a curve $\gamma$ (a trajectory in spacetime) is such that $I(\gamma) = \int_\gamma ds < 0$, then $\gamma$ corresponds to a curve that a massive particle can follow, and the value $\sqrt{-I}$ is the amount of time elapsed along that line. This is known as a timelike curve If $I=0$, $\gamma$ is a path that a massless particle can follow aka a null curve. If $I>0$, $\gamma$ cannot be followed by any particle, $\gamma$ is a spacelike curve.
Now, you observe that two curves $\gamma$ and $\gamma'$, that start and end at the same space coordinates, are such that $I(\gamma)\neq I(\gamma')$. This makes total sense. Consider for simplicity flat space in cartesian coordinates, where the line element is:
$$ds^2 = -dt^2 +dx^2+dy^2+dz^2,$$
and two straight lines, both starting at $(0,0,0,0)$, and one ends at $(0,1,0,0)$ and the other ends at $(T,1,0,0)$. Both start and end at the same space coordinates, but they end at different time coordinates. Now compute the $I$ corresponding to each line. You will get $1$ for the first line and $1-T^2$ for the second one. This is totally fine, because they describe different trajectories in spacetime, $I$ can be different. In particular, when $T>1$, $1-T^2<0,$ and thus the second line is a line that a massive particle can follow. While when $T=1$, $1-T^2=0$. This is a line followed by a light beam.
So to answer your questions:

*

*The value of $ds$ is different for your two lines because they are two different paths in spacetime. In particular, the second line takes more coordinate time to get from one space coordinate to the other, and thus the line element is closer to 0 than the other.

*A value of $I=0$ means you are looking at a null line. A path that could only be followed by a massless particle (potentially bouncing off mirrors).

Another thing to look out for is that coordinates in general relativity don't mean anything on their own. They are necessary labels to write down your equations, but any set of coordinates is as good as any other in principle. This is the principle of general covariance. You are confused about the meaning of coordinates in general relativity. If you find it confusing, that's normal: Einstein himself was very confused for a long time and it was an obstacle in building the theory.
