예제 #1
0
        public void Sum_CollectCoefficients_WithConstant()
        {
            var x          = Symbol("x");
            var expression = Sum(5 * x, 8 * x, 3);
            var simplifier = new CollectCoefficientsInSumSimplifier();
            var result     = simplifier.Simplify(expression, CancellationToken.None);

            Assert.AreEqual("13 * x + 3", result.ToString());
        }
예제 #2
0
        public void Sum_CollectCoefficients_Multiple()
        {
            var x          = Symbol("x");
            var y          = Symbol("y");
            var expression = Sum(5 * x, 8 * x, 4 * y, 3 * x * y);
            var simplifier = new CollectCoefficientsInSumSimplifier();
            var result     = simplifier.Simplify(expression, CancellationToken.None);

            Assert.AreEqual("13 * x + 4 * y + 3 * x * y", result.ToString());
        }