I have a linear system of 22 equations and variables. When I create the matrix form it sorts the coefficients on the first row (X1, X10, X11, ...) This ordering repeats for all columns and all the results have the same order.
How do I sort the matrix to be in each row this way: (X1, X2, X3, ..., X22)?
X1,X2 and those are suppsoed to be the constant accompanying my coefficients which are x1,x2 ,x3 ...x22.
I have tried using sort, but I dont find a simple way at least to sort the results or sort the coefficients of the matrix. I am using the following function to create the matrix:
M = Normal[CoefficientArrays[system]][]; MatrixForm[M]
system contains all my 22 equations.
The methods I used to solve the system give me the same result, which is correct. Both
LinearSolve[M , B] give me the correct results but sorted like X1, X12, and so on.