Python
numpy

The sample of diff, zeros_like, cumsum, linspace and interp in numpy

phi = np.arange(0, 10*np.pi, 0.1)
a = 1
x = a*phi*np.cos(phi)
y = a*phi*np.sin(phi)
print(phi)
print(x)
print(y)
exit()
dr = (np.diff(x)**2 + np.diff(y)**2)**.5 # segment lengths
print(dr)
r = np.zeros_like(x)
print(r)
r[1:] = np.cumsum(dr)                # integrate path
print(r)
r_int = np.linspace(0, r.max(), 200) # regular spaced path
x_int = np.interp(r_int, r, x)       # integrate path
y_int = np.interp(r_int, r, y)
print(r_int, x_int, y_int)

Refs.