예제 #1
0
 public SyntaxBlock Derivative(ArgumentValue ArgumentToDerive)
 {
     return(new Sum(new Product(A.Derivative(ArgumentToDerive), B), new Product(A, B.Derivative(ArgumentToDerive))));
 }
 public SyntaxBlock Derivative(VariableArgumentValue ArgumentToDerive)
 {
     return(DerivativeFormulate(A.Derivative(ArgumentToDerive), B.Derivative(ArgumentToDerive)));
 }
예제 #3
0
 public SyntaxBlock Derivative(ArgumentValue ArgumentToDerive)
 {
     //(A'*B + -1(B'*A))/(B*B) == (A'*B - B'*A)/B^2
     return(new Quotient(new Sum(new Product(A.Derivative(ArgumentToDerive), B),
                                 new Product(new NumericConstant(-1), new Product(B.Derivative(ArgumentToDerive), A))), new Product(B, B)));
 }
예제 #4
0
        /// <summary>
        /// Calculates all the partial derivatives of a given formula.
        /// </summary>
        /// <param name="Formula">The formula for which to calculate all partial derivatives.</param>
        /// <returns>A list of tuples, containing the ArgumentValue for which it was calculated (item1) and the formula itself(item2).</returns>
        public static List <Tuple <ArgumentValue, SyntaxBlock> > CalculatePartialDerivatives(SyntaxBlock Formula)
        {
            var AllVariableVariables = Formula.GetAllVariables(true);
            var distinctVariables    = AllVariableVariables.Distinct();
            List <Tuple <ArgumentValue, SyntaxBlock> > PartialDerivatives = new List <Tuple <ArgumentValue, SyntaxBlock> >();

            foreach (ArgumentValue i in distinctVariables)
            {
                PartialDerivatives.Add(new Tuple <ArgumentValue, SyntaxBlock>((ArgumentValue)i, Formula.Derivative((ArgumentValue)i).Simplify()));
            }
            return(PartialDerivatives);
        }
예제 #5
0
 public SyntaxBlock Derivative(VariableArgumentValue ArgumentToDerive)
 {
     return(new Sum(A.Derivative(ArgumentToDerive), B.Derivative(ArgumentToDerive)));
 }