public IExpressionNode Derivate()
        {
            var leftDerivative  = LeftOperand.Derivate();
            var rightDerivative = RightOperand.Derivate();

            return(new OperationDivision(
                       new OperationSubtraction(
                           new OperationMultiplication(LeftOperand.DeepCopy(), rightDerivative),
                           new OperationMultiplication(leftDerivative, RightOperand.DeepCopy())
                           ),
                       new OperationPower(RightOperand.DeepCopy(), new Constant(2))));
        }
        public IExpressionNode Derivate()
        {
            var leftDerivative  = LeftOperand.Derivate();
            var rightDerivative = RightOperand.Derivate();

            return(new OperationAdd(
                       new OperationMultiplication(
                           leftDerivative,
                           RightOperand.DeepCopy()),
                       new OperationMultiplication(
                           LeftOperand.DeepCopy(),
                           rightDerivative)));
        }
Exemple #3
0
 public IExpressionNode Derivate()
 {
     if (LeftOperand.ContainsVariable() && RightOperand.ContainsVariable())
     {
         return(new OperationMultiplication(
                    this.DeepCopy(),
                    new OperationMultiplication(
                        new FunctionLn(LeftOperand.DeepCopy()),
                        RightOperand.DeepCopy()).Derivate()));
     }
     else if (LeftOperand.ContainsVariable())
     {
         return(new OperationMultiplication(
                    new OperationMultiplication(
                        RightOperand.DeepCopy(),
                        new OperationPower(
                            LeftOperand.DeepCopy(),
                            new OperationSubtraction(RightOperand.DeepCopy(), new Constant(1))
                            )
                        ),
                    LeftOperand.Derivate()
                    ));
     }
     else if (RightOperand.ContainsVariable())
     {
         return(new OperationMultiplication(
                    new OperationMultiplication(
                        this.DeepCopy(),
                        new FunctionLn(LeftOperand.DeepCopy())
                        ),
                    RightOperand.Derivate()
                    ));
     }
     else
     {
         return(new Constant(0));
     }
 }
 IExpressionNode IExpressionNode.Derivate() => new OperationSubtraction(LeftOperand.Derivate(), RightOperand.Derivate());
Exemple #5
0
 IExpressionNode IExpressionNode.Derivate()
 {
     return(new OperationAdd(LeftOperand.Derivate(), RightOperand.Derivate()));
 }