示例#1
0
        public void Test_TwoVariables_Linear_4()
        {
            //y=x/3
            var y   = new Var('y');
            var x   = new Var('x');
            var rhs = new Term(Expression.Divide, new List <object>()
            {
                x, 3
            });
            var eq = new Equation(y, rhs);

            object obj;
            bool?  result = eq.EvalEquation(out obj, true, true);

            Assert.Null(result);
            Assert.True(obj.ToString().Equals("-x+3y=0"));
        }
示例#2
0
        public void Test_TwoVariables_Linear_2()
        {
            //25: -2x+3y+9=0
            var x     = new Var('x');
            var term1 = new Term(Expression.Multiply, new List <object>()
            {
                -2, x
            });
            var y     = new Var('y');
            var term2 = new Term(Expression.Multiply, new List <object>()
            {
                3, y
            });
            var lhs = new Term(Expression.Add, new List <object>()
            {
                term1, term2, 9
            });
            var    eq = new Equation(lhs, 0);
            object obj;
            bool?  result = eq.EvalEquation(out obj, true, true);

            Assert.Null(result);
        }
示例#3
0
        public void Test_TwoVariables_Linear_3()
        {
            //25: 3y=2x-9
            var y   = new Var('y');
            var lhs = new Term(Expression.Multiply, new List <object>()
            {
                3, y
            });
            var x     = new Var('x');
            var term1 = new Term(Expression.Multiply, new List <object>()
            {
                2, x
            });
            var rhs = new Term(Expression.Add, new List <object>()
            {
                term1, -9
            });
            var    eq = new Equation(lhs, rhs);
            object obj;
            bool?  result = eq.EvalEquation(out obj, true, true);

            Assert.Null(result);
            Assert.True(obj.ToString().Equals("-2x+3y+9=0"));
        }
        public void Test_TwoVariables_Linear_5()
        {
            //y=(1/3)x
            var y = new Var('y');
            var x = new Var('x');
            var term1 = new Term(Expression.Divide, new List<object>() { 1, 3 });
            var rhs = new Term(Expression.Multiply, new List<object>() {term1, x});
            var eq = new Equation(y, rhs);

            object obj;
            bool? result = eq.EvalEquation(out obj, true, true);
            Assert.Null(result);
            Assert.True(obj.ToString().Equals("-x+3y=0"));
        }
 public void Test_TwoVariables_Linear_3()
 {
     //25: 3y=2x-9
     var y = new Var('y');
     var lhs = new Term(Expression.Multiply, new List<object>() {3, y});
     var x = new Var('x');
     var term1 = new Term(Expression.Multiply, new List<object>() {2, x});
     var rhs = new Term(Expression.Add, new List<object>() {term1, -9});
     var eq = new Equation(lhs, rhs);
     object obj;
     bool? result = eq.EvalEquation(out obj, true, true);
     Assert.Null(result);
     Assert.True(obj.ToString().Equals("-2x+3y+9=0"));
 }
 public void Test_TwoVariables_Linear_2()
 {
     //25: -2x+3y+9=0
     var x = new Var('x');
     var term1 = new Term(Expression.Multiply, new List<object>() { -2, x });
     var y = new Var('y');
     var term2 = new Term(Expression.Multiply, new List<object>() { 3, y });
     var lhs = new Term(Expression.Add, new List<object>() { term1, term2, 9 });
     var eq = new Equation(lhs, 0);
     object obj;
     bool? result = eq.EvalEquation(out obj, true, true);            
     Assert.Null(result);
 }