Exemplo n.º 1
0
        public void InfSolutions()
        {
            int n = 3;
            SystemOfLinearEquation s = new SystemOfLinearEquation(n);

            s.Add(new LinearEquation("2.0,6.0,-5.0,10.0"));
            s.Add(new LinearEquation("4.0,12.0,-10.0,20.0"));
            s.Add(new LinearEquation("4.0,12.0,-10.0,20.0"));
            s.Shiftg();
            Assert.Equals(typeof(ArgumentException), s.System());
        }
Exemplo n.º 2
0
        public void Answer()
        {
            int n = 3;
            SystemOfLinearEquation s = new SystemOfLinearEquation(n);

            s.Add(new LinearEquation("3.0, 2.0,-4.0, 3.0"));
            s.Add(new LinearEquation("2.0, 3.0, 3.0, 15.0"));
            s.Add(new LinearEquation("5.0, -3, 1.0, 14.0"));
            s.Shiftg();
            double[] res1  = new double[] { 3, 1, 2 };
            double[] res2  = s.System();
            bool     check = true;

            for (int i = 0; i < n; i++)
            {
                if (Math.Abs(res1[i] - res2[i]) > 1e-9)
                {
                    check = false;
                }
            }
            Assert.AreEqual(true, check);
        }