This link you include in your "EDIT" seems to provide a method to solve your problem, if you note that the constraints $x_{i}-x_{i-1}=d$ is in your data.x <- seq(-pi, pi, 0.1)
plot(x, cos(x))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: