通过消元法得到新的低阶方程组,递归求解新方程组,最后求解所消去变元。
class Program
{
static void Main(string[] args)
{
List<decimal[]> list = new List<decimal[]>();
decimal[] equation = new decimal[] { 0, 1, 1, 0 };
list.Add(equation);
decimal[] equation1 = new decimal[] { 1, 2, 1, 3 };
list.Add(equation1);
decimal[] equation2 = new decimal[] { 1, 1, 2, 1 };
list.Add(equation2);
decimal[] resultList = FunctionCalc.CalcTest(list);
}
}
class FunctionCalc
{
/// <summary>
/// 输入为数学方程组,每个List[i]相当于一个数学方程,对于 aX + bY + cZ = K1; List[i] = {a, b, c, K1}
/// 返回为结果数组,对上面的方程组返回 {X, Y, Z} 数组。
/// </summary>
/// <param name="list"></param>
/// <returns