Where y is next and so on from x and like x is line start and x1 is line end and x2 is to compare line with: (x-x2)(x-x2)+...=A, 2(x-x2)(x1-x)+...=B, (x1-x)^2+...=F.
With F being not 0: ((B + 2*F*t)*sqrt(A + t*(B + F*t)))/(4*F) - ((B^2 - 4*A*F)*log(B + 2*F*t + 2*sqrt(F)*sqrt(A + t*(B + F*t))))/(8*F^(3/2))
When F is 0 but B is not: (2*(A + B*t)^(3/2))/(3*B)
When both F and B are 0: sqrt(A)*t
These sum per dimension some things then do final calculations. "log" is natural E logarithm. "sqrt" is square root. "^" means to power of. "*" means multiplied by. I tested with samples on lines with multiple trials of increasing numbers of samples and they always went toward this result.