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))); }
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());
IExpressionNode IExpressionNode.Derivate() { return(new OperationAdd(LeftOperand.Derivate(), RightOperand.Derivate())); }