Пример #1
0
        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);
        }
Пример #2
0
 public static LazyExpression operator -(Expression L, Expression R)
 {
     return(new LazyExpression(Sum.New(L, Unary.Negate(R))));
 }
Пример #3
0
 static public Expression Subtract(Expression L, Expression R)
 {
     return(ComputerAlgebra.Sum.New(L, Unary.Negate(R)));
 }
Пример #4
0
 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]);
 }
Пример #5
0
 public static LazyExpression operator -(LazyExpression L, LazyExpression R)
 {
     return(new LazyExpression(Sum.New(L.value, Unary.Negate(R.value))));
 }