public void TestNumeratorDenominatorOfBinaryQuotient()
        {
            Expression <Func <double, double> > lambda = x => Math.Exp(x) / (2 * x);

            Expression nominator = Elementary.Numerator(lambda.Body);

            Assert.AreEqual(ExpressionType.Call, nominator.NodeType);
            Assert.IsInstanceOfType(typeof(MethodCallExpression), nominator);
            Assert.AreEqual("Exp(x)", nominator.ToString());

            Expression denominator = Elementary.Denominator(lambda.Body);

            Assert.AreEqual(ExpressionType.Multiply, denominator.NodeType);
            Assert.IsInstanceOfType(typeof(BinaryExpression), denominator);
            Assert.AreEqual("(2 * x)", denominator.ToString());
        }
        public void TestNumeratorDenominatorOfTernaryQuotient()
        {
            Expression <Func <double, double> > lambda = x => x / 2 / Math.PI;

            Expression nominator = Elementary.Numerator(lambda.Body);

            Assert.AreEqual(ExpressionType.Divide, nominator.NodeType);
            Assert.IsInstanceOfType(typeof(BinaryExpression), nominator);
            Assert.AreEqual("(x / 2)", nominator.ToString());

            Expression denominator = Elementary.Denominator(lambda.Body);

            Assert.AreEqual(ExpressionType.Constant, denominator.NodeType);
            Assert.IsInstanceOfType(typeof(ConstantExpression), denominator);
            Assert.AreEqual(Math.PI.ToString(), denominator.ToString());
        }
        public void TestNumeratorDenominatorOfTernaryProduct()
        {
            Expression <Func <double, double> > lambda = x => 2 * x * Trig.Cosecant(x);

            Expression nominator = Elementary.Numerator(lambda.Body);

            Assert.AreEqual(ExpressionType.Multiply, nominator.NodeType);
            Assert.IsInstanceOfType(typeof(BinaryExpression), nominator);
            Assert.AreEqual("((2 * x) * Cosecant(x))", nominator.ToString());

            Expression denominator = Elementary.Denominator(lambda.Body);

            Assert.AreEqual(ExpressionType.Constant, denominator.NodeType);
            Assert.IsInstanceOfType(typeof(ConstantExpression), denominator);
            Assert.AreEqual("1", denominator.ToString());
        }