示例#1
0
        public poly substitudeX(poly x_y)
        {
            for (int i = 0; i < x_y.count; i++)
            {
                if (x_y.terms[i].xp > 0)
                {
                    throw new Exception("x_y is not a function of x!");
                }
            }
            poly temp = new poly();

            temp.addTerm(this);
            for (int i = 0; i < xp; i++)
            {
                for (int j = 0; j < temp.count; j++)
                {
                    temp.terms[j].xp--;
                }
                temp *= x_y;
            }
            for (int i = 0; i < temp.count; i++)
            {
                if (temp.terms[i].xp > 0)
                {
                    throw new Exception("xp > 0 after substitude!");
                }
            }
            return(temp);
        }
示例#2
0
        public poly substitudeY(poly y_x)
        {
            for (int i = 0; i < y_x.count; i++)
            {
                if (y_x.terms[i].yp > 0)
                {
                    throw new Exception("y_x is not a function of x!");
                }
            }
            poly temp = new poly();

            temp.addTerm(this);
            for (int i = 0; i < yp; i++)
            {
                for (int j = 0; j < temp.count; j++)
                {
                    temp.terms[j].yp--;
                }
                temp *= y_x;
            }
            for (int i = 0; i < temp.count; i++)
            {
                if (temp.terms[i].yp > 0)
                {
                    throw new Exception("yp > 0 after substitude!");
                }
            }
            return(temp);
        }
示例#3
0
        public poly integralY()
        {
            poly temp = new poly();

            for (int i = 0; i < count; i++)
            {
                temp.addTerm(terms[i].integralY());
            }
            return(temp);
        }
示例#4
0
        static poly pol(int[,] termData)
        {
            poly p = new poly();

            for (int i = 0; i < termData.GetLength(0); i++)
            {
                p.addTerm(ter(termData[i, 0], termData[i, 1], termData[i, 2]));
            }
            return(p);
        }