Пример #1
0
        public frac value(int x, int y)
        {
            frac a = frac.pow(new frac(x), xp);
            frac b = frac.pow(new frac(y), yp);

            return(new frac(a * b * c));
        }
Пример #2
0
        public void addTerm(term t)
        {
            int  i;
            frac zero = new frac(0);

            if ((i = canJoin(ref t)) >= 0)
            {
                terms[i].c += t.c;
                if (terms[i].c == zero)
                {
                    delTerm(i);
                }
            }
            else if (count < terms.Length)
            {
                terms[count] = new term(t);
                count++;
                if (terms[count - 1].c == zero)
                {
                    delTerm(count - 1);
                }
            }
            else
            {
                throw new Exception("poly is full!");
            }
        }
Пример #3
0
        public frac value(frac x, frac y)
        {
            frac a = frac.pow(x, xp);
            frac b = frac.pow(y, yp);

            return(new frac(a * b * c));
        }
Пример #4
0
        public static frac pow(frac f, int p)
        {
            frac ret = new frac(1);

            for (int i = 0; i < p; i++)
            {
                ret *= f;
            }
            return(ret);
        }
Пример #5
0
        public frac value(int x, int y)
        {
            frac s = new frac(0);

            for (int i = 0; i < count; i++)
            {
                s += terms[i].value(x, y);
            }
            return(s);
        }
Пример #6
0
        static frac doubleItgYX(poly f, poly y_x0, poly y_x1, frac x0, frac x1)
        {
            frac res = new frac(0);

            f.print();
            poly iy_f = f.integralY();

            iy_f.print();
            poly f_x = iy_f.substitudeY(y_x1) - iy_f.substitudeY(y_x0);

            f_x.print();
            poly F = f_x.integralX();

            F.print();
            res = F.value(x1, new frac(0)) - F.value(x0, new frac(0));
            return(res);
        }
Пример #7
0
 static public frac sub(frac frac1, frac frac2)
 {
     frac frac0 = sum(frac1.X, frac1.Y, -1 * frac2.X, frac2.Y); return(frac0);
 }
Пример #8
0
        //减法运算
        static public frac sub(int a, int b, int c, int d)
        {
            frac frac0 = sum(a, b, -1 * c, d);

            return(frac0);
        }
Пример #9
0
 static public frac sum(frac frac1, frac frac2)
 {
     return(sum(frac1.X, frac1.Y, frac2.X, frac2.Y));
 }
Пример #10
0
 public frac(frac s)
 {
     X = s.X;
     Y = s.Y;
 }
Пример #11
0
 static public frac dev(frac frac1, frac frac2)
 {
     return(mul(frac1.X, frac1.Y, frac2.Y, frac2.X));
 }
Пример #12
0
 public term(term t)
 {
     c = t.c; xp = t.xp; yp = t.yp;
 }
Пример #13
0
 public term(frac coe, int x_p = 0, int y_p = 0)
 {
     c = coe; xp = x_p; yp = y_p;
 }
Пример #14
0
 public term(int coe, int x_p = 0, int y_p = 0)
 {
     c = new frac(coe); xp = x_p; yp = y_p;
 }
Пример #15
0
 static term ter(frac coe, int x_p = 0, int y_p = 0)
 {
     return(new term(coe, x_p, y_p));
 }