示例#1
0
 public Polinom PolinomMultTest(double[] coef1, double[] coef2)
 {
     Polinom p1 = new Polinom(coef1);
     Polinom p2 = new Polinom(coef2);
     return Polinom.Mult(p1, p2);
 }
示例#2
0
 public Polinom PolinomSumTest(double[] coef1, double[] coef2)
 {
     Polinom p1 = new Polinom(coef1);
     Polinom p2 = new Polinom(coef2);
     return Polinom.Add(p1, p2);
 }
示例#3
0
        public Polinom PolinomCreateTest(double[] coef)
        {
            Polinom obj = new Polinom(coef);

            return obj;
        }
示例#4
0
 public Polinom PolinomDiffTest(double[] coef1, double[] coef2)
 {
     Polinom p1 = new Polinom(coef1);
     Polinom p2 = new Polinom(coef2);
     return Polinom.Sub(p1, p2);
 }
示例#5
0
        public bool Equals(Polinom p)
        {
            if (ReferenceEquals(p, null))
                return false;
            if (ReferenceEquals(p, this))
                return true;
            if (p.degree != degree)
                return false;
            //!!!!!!!!!!!!
            for (int i = 0; i < degree; i++)
            {
                if (Math.Abs(coef[i] - p[i]) > eps)

                    return false;
            }
            return true;
        }
示例#6
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(obj, null))
                return false;
            if (ReferenceEquals(obj, this))
                return true;
            Polinom p = new Polinom();

            if (p.GetType() != obj.GetType())
                return false;
            p = (Polinom)obj;
            return Equals(p);
        }
示例#7
0
 public static Polinom Sub(Polinom lhs, Polinom rhs)
 {
     return lhs - rhs;
 }
示例#8
0
 public static Polinom Mult(Polinom lhs, Polinom rhs)
 {
     if (ReferenceEquals(lhs, null) || ReferenceEquals(rhs, null))
         throw new ArgumentNullException();
     Polinom p2 = new Polinom(new double[lhs.degree + rhs.degree + 1]);
     for (int i = 0; i < lhs.degree; i++)
     {
         Polinom p1 = rhs * lhs[i];
         for (int k = 0; k < rhs.degree; k++)
         {
             p2[i + k] += p1[i];
         }
     }
     return p2;
 }
示例#9
0
 public static Polinom Add(Polinom lhs, Polinom rhs)
 {
     return lhs + rhs;
 }