I recently asked a question about minimizing the standard deviation from a list of equidistant values and I received a great answer here: https://math.stackexchange.com/a/4089367/907708
However, now I am tasked with redefining the first equation in the answer to the above question to allow for an x-axis, (points are no longer equidistant).
At this point, I am now given an x-axis that must remain fixed. (standard deviation must still be optimized but now we are given another constraint that points on the x-axis are no longer equidistant and therefore they must factor into the equation somehow ).
The points along the x-axis must remain fixed but the points on the y-axis are still free to be moved within the bounds defined in the previous question.
I was hoping someone could help me redefine the objective function in the above answer, or at least help point me in the right direction.
Example:
y = [20, 24, 28, 24 ,20 ,18, 20, 32 ,30, 28, 20 ,24] (this is the h from the previous question)
x = [10,20,25,30,35,40,45,50,55,60,70,80]
This is not a homework problem so therefore I have no course material to help guide me to an answer. The only guidance I have is from the comments and answers to this post. Please understand that I am in no way a mathematician so I really need all the help I can get. Thanks!
For the original data, the standard deviation of the Euclidean distances between all $\binom{12}{2}=66$ pairs of points is $15.29$. By perturbing $y$ to
you can reduce the standard deviation to $15.08$.
I obtained this solution by solving a nonlinear optimization problem to minimize the standard deviation of distances $d_{i,j}$ subject to \begin{align} d_{i,j} &= \sqrt{(x_i-x_j)^2+(y_i'-y_j')^2} &&\text{for all $1\le i<j \le n$}\\ y_i' &\in [y_i,y_i+2] &&\text{for all $i\in\{1,\dots,n\}$} \end{align}
If you instead consider only consecutive pairs $(i,i+1)$, the original standard deviation is $3.14$, and by perturbing $y$ to
you can reduce the standard deviation to $2.34$.