예제 #1
0
 public static Expression operator -(Expression lhs, Expression rhs)
 {
     return(new Expression(SortedOperations.Merge(lhs.Terms, rhs.Terms.Select(term => - term), MergeTerm).Where(term => term.Coefficient != 0).ToArray()));
 }
예제 #2
0
 public static Expression Sum(IEnumerable <Expression> expressions)
 {
     return(new Expression(SortedOperations.MergeMany(expressions.Select(expr => expr.Terms), MergeTerm).Where(term => term.Coefficient != 0).ToArray()));
 }
예제 #3
0
 public static Term operator /(Term lhs, Term rhs)
 {
     return(new Term(lhs.Coefficient / rhs.Coefficient, SortedOperations.Merge(lhs.Variables, rhs.Variables.Select(var => ~var), MergeVariable, _baseComparer).Where(var => var.Exponent != 0).ToArray()));
 }