Open Kwasniok opened 1 year ago
generalized algorithm in Mathematica:
replaceColumn[mat_, col_, n_] := Module[
{matOut},
matOut = mat;
matOut[[All, n]] = col;
matOut
]
n = 2;
bb = Table[Table[b[i] . b[j], {i, n}], {j, n}];
bb // MatrixForm
d = Det[bb]
bx = Table[b[i] . x, {i, n}];
bx // MatrixForm
breplx = Table[replaceColumn[bb, bx, i] // Det, {i, n}];
breplx // MatrixForm
uv = breplx / d;
uv // MatrixForm // Simplify
The general algorithm is getting linear coefficients of a vector is the span of a subspace. Observe the structure of a transformation matrix inside the algorithm.