public void TestMultiplySameSymbols()
        {
            string lhs      = "6*X + 1";
            string rhs      = "6*X - 1";
            string expected = "36*X^2 - 1";

            MultivariatePolynomial polylhs = MultivariatePolynomial.Parse(lhs);
            MultivariatePolynomial polyrhs = MultivariatePolynomial.Parse(rhs);

            MultivariatePolynomial polyProdcut = MultivariatePolynomial.Multiply(polylhs, polyrhs);

            string actual = polyProdcut.ToString();

            TestContext.WriteLine($"Expected: \"{expected}\"; Actual: \"{actual}\"");
            Assert.AreEqual(expected, actual, $"Test of: MultivariatePolynomial.Multiply({lhs}, {rhs});");
        }
        public void TestFunctionalComposition002()
        {
            MultivariatePolynomial indeterminateX = MultivariatePolynomial.Parse("6*X + 1");
            MultivariatePolynomial indeterminateY = MultivariatePolynomial.Parse("6*Y - 1");
            MultivariatePolynomial polyn          = MultivariatePolynomial.Multiply(indeterminateX, indeterminateY);

            MultivariatePolynomial zero     = MultivariatePolynomial.Parse("0");
            MultivariatePolynomial minusOne = MultivariatePolynomial.Parse("-1");
            MultivariatePolynomial six      = MultivariatePolynomial.Parse("6");

            MultivariatePolynomial even = MultivariatePolynomial.Parse("2*Y");
            MultivariatePolynomial odd  = MultivariatePolynomial.Parse("2*X + 1");

            MultivariatePolynomial inversePolyn = MultivariatePolynomial.Multiply(polyn, minusOne);             // -36*X*Y + 6*X - 6*Y + 1

            List <Tuple <char, MultivariatePolynomial> > indeterminantsOddEven = new List <Tuple <char, MultivariatePolynomial> >()
            {
                new Tuple <char, MultivariatePolynomial>('X', odd),
                new Tuple <char, MultivariatePolynomial>('Y', even),
            };

            List <Tuple <char, MultivariatePolynomial> > indeterminantsConstants = new List <Tuple <char, MultivariatePolynomial> >()
            {
                new Tuple <char, MultivariatePolynomial>('X', zero),
                new Tuple <char, MultivariatePolynomial>('Y', minusOne),
            };

            List <Tuple <char, MultivariatePolynomial> > indeterminantsInverse = new List <Tuple <char, MultivariatePolynomial> >()
            {
                new Tuple <char, MultivariatePolynomial>('X', inversePolyn),
                new Tuple <char, MultivariatePolynomial>('Y', inversePolyn),
            };

            List <Tuple <char, MultivariatePolynomial> > indeterminantSix = new List <Tuple <char, MultivariatePolynomial> >()
            {
                new Tuple <char, MultivariatePolynomial>('X', six)
            };

            MultivariatePolynomial composition1 = polyn.FunctionalComposition(indeterminantsOddEven);             // 36*X*Y + 6*Y - 6*X - 1
            MultivariatePolynomial composition2 = polyn.FunctionalComposition(indeterminantsInverse);
            MultivariatePolynomial composition3 = polyn.FunctionalComposition(indeterminantsConstants);
            MultivariatePolynomial composition4 = minusOne.FunctionalComposition(indeterminantSix);
            MultivariatePolynomial composition5 = indeterminateX.FunctionalComposition(indeterminantsConstants);

            string expecting1 = "144*X*Y - 12*X + 84*Y - 7";
            string expecting2 = "46656*X^2*Y^2 + 1296*X^2 - 15552*X^2*Y + 15552*X*Y^2 + 432*X - 5184*X*Y + 1296*Y^2 - 432*Y + 35";
            string expecting3 = "-7";
            string expecting4 = "-1";
            string expecting5 = "1";

            string actual1 = composition1.ToString();
            string actual2 = composition2.ToString();
            string actual3 = composition3.ToString();
            string actual4 = composition4.ToString();
            string actual5 = composition5.ToString();

            //Assert.AreEqual(expecting1, actual1);
            //Assert.AreEqual(expecting2, actual2);
            Assert.AreEqual(expecting3, actual3);
            Assert.AreEqual(expecting4, actual4);
            Assert.AreEqual(expecting5, actual5);
        }