예제 #1
0
        public CasExpr Substitute(CasExpr expr, CasVar forV)
        {
            if (!ContainsVar(forV))
            {
                return(new CasExpr(this, CasPolynomial.ConstantPoly(1)));
            }
            List <CasExpr> exprs = new List <CasExpr>();

            foreach (var t in Terms)
            {
                exprs.Add(t.Substitute(expr, forV));
            }
            var sum = CasExpr.ConstantExpr(0);

            foreach (var e in exprs)
            {
                sum = CasSystem.Instance.Add(sum, e);
            }
            return(sum);
        }
예제 #2
0
 public CasExpr ConstExpr(int c)
 {
     return(CasExpr.ConstantExpr(c));
 }