### 解三元一次方程组的C#函数

//xishu：3×4数组
//x,y,z方程组的解
private void solutionLinearEqations(double[,] xishu, out double x, out double y, out double z)
{
x = y = z = 0;
double[,] det0 = new double[3, 3];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++) det0[i, j] = xishu[i, j];
double det00 = determinant(det0);
double[,] detx = new double[3, 3];
detx[0, 0] = xishu[0, 3];
detx[1, 0] = xishu[1, 3];
detx[2, 0] = xishu[2, 3];
for (int i = 0; i < 3; i++)
for (int j = 1; j < 3; j++) detx[i, j] = xishu[i, j];
double detx0 = determinant(detx);
double[,] dety = new double[3, 3];
dety[0, 1] = xishu[0, 3];
dety[1, 1] = xishu[1, 3];
dety[2, 1] = xishu[2, 3];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
{
if (j != 1)
dety[i, j] = xishu[i, j];
}
double dety0 = determinant(dety);
double[,] detz = new double[3, 3];
detz[0, 2] = xishu[0, 3];
detz[1, 2] = xishu[1, 3];
detz[2, 2] = xishu[2, 3];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 2; j++) detz[i, j] = xishu[i, j];
double detz0 = determinant(detz);
x = detx0 / det00;
y = dety0 / det00;
z = detz0 / det00;
}