Beispiel #1
0
        /// <inheritdoc/>
        public override ExpNode Execute(PowOperNode node)
        {
            // TODO: Handle variable in exponent
            if (node.IsConstantBy(_variable))
            {
                return(QuickOpers.MakeNumericalNode(0));
            }

            var coefficient = node.RightChild;
            var @base       = node.LeftChild;
            var exponent    = QuickOpers.Add(-1, coefficient);

            return(QuickOpers.Multiply(coefficient, QuickOpers.Pow(@base, exponent)));
        }
Beispiel #2
0
        /// <inheritdoc/>
        public override ExpNode Execute(PowOperNode node)
        {
            // TODO: Handle variable in exponent
            if (node.IsConstantBy(_variable))
            {
                return(ConstantRule(node));
            }

            // Increment exponent, divide by exponent
            AdditionOperNode   exponent    = QuickOpers.Add(1, node.RightChild);
            RecipricalOperNode coefficient = QuickOpers.Reciprical(exponent.Clone());
            PowOperNode        @base       = QuickOpers.Pow(node.LeftChild, exponent);

            return(QuickOpers.Multiply(coefficient, @base));
        }