def path_length(X):
 X = distances_along_curve(X)
 return np.concatenate((np.zeros(1), np.cumsum(X)))

def path_length ( X ) : X = distances_along_curve ( X ) return np . concatenate ( ( np . zeros ( 1 ) , np . cumsum ( X ) ) )
computes the distance travelled along a polygonal curve in *n* dimensions .