I am trying to solve a system of overdetermined linear equations for 2 unknowns with 3 variables.
For a given equation of a line, we can write it as: ax + by = c,
which expressed in vector form is Transpose(a)x=c, where a = (a b) and x = (x y).
So far, I've managed to get my code to a point where I can calculate what x1, x2, and x3 are, but I don't know how to loop it in a way that Mathematica will calculate it until the 3 variables converge.
This is what I have done so far: For a list of 3 equations and 2 unknowns:
Subscript[L, 1]: 4x+y=6, Subscript[L, 2]: 5x-y=1, Subscript[L, 3 ]: 2x-3y=4
x0 = {3, 1};
a1 = {4, 1};
x1 = x0 + ((6 - a1.x0)/a1.a1)*a1
a2 = {5, -1};
x2 = x1 + ((1 - a2.x1)/a2.a2)*a2
a3 = {2, -3};
x3 = x2 + ((4 - a3.x2)/a3.a3)*a3
Doing this gives you the points. And to loop it, I thought of defining the equations and then giving it initial parameters to calculate it, but I don't think it works.
eqns = {x1[x0] == x0 + ((6 - a1.x0)/a1.a1)*a1,
x2[x1] == x1 + ((1 - a2.x1)/a2.a2)*a2,
x3[x2] == x2 + ((4 - a3.x2)/a3.a3)*a3}; inits = {??}
Does anyone have advice? Or whether this kind of question has been asked before?