public List <ArgumentValue> GetAllVariables(bool OnlyNonConstants) { var lista = A.GetAllVariables(OnlyNonConstants); lista.AddRange(B.GetAllVariables(OnlyNonConstants)); return(lista); }
public List <ArgumentValue> GetAllVariables(bool OnlyNonConstants) { List <ArgumentValue> listA, listB; listA = A.GetAllVariables(OnlyNonConstants); listB = B.GetAllVariables(OnlyNonConstants); listA.AddRange(listB); return(listA); }
/// <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); }