protected override Expression VisitUnknown(Expression E) { Expression LE = Call.L(E, t, s); // Try applying a rule to E. Expression TLE = rules.Transform(LE); if (!ReferenceEquals(TLE, LE)) { return(TLE); } // Try expanding E. Expression Ex = E.Expand(s); if (!Equals(E, Ex)) { return(Visit(Ex)); } // Try -L(-E, s, t) // TODO: It would be nice to handle this case in LinearTransform somehow. Expression NE = Unary.Negate(E); Expression NEx = NE.Evaluate(); if (!Equals(NE, NEx)) { return(Unary.Negate(Visit(NEx))); } // Give up. return(LE); }
public static LazyExpression operator -(Expression L, Expression R) { return(new LazyExpression(Sum.New(L, Unary.Negate(R)))); }
static public Expression Subtract(Expression L, Expression R) { return(ComputerAlgebra.Sum.New(L, Unary.Negate(R))); }
public Expression Solve(Expression x) { return(Unary.Negate(Sum.New(this.Where(i => !i.Key.Equals(x)).Select(i => Product.New(i.Key, i.Value)))) / this[x]); }
public static LazyExpression operator -(LazyExpression L, LazyExpression R) { return(new LazyExpression(Sum.New(L.value, Unary.Negate(R.value)))); }