예제 #1
0
        /*public static Polinom operator *(Polinom a, Matrix b)
         * {
         *  Polinom res = new Polinom();
         *  foreach (Monom i in a)
         *  {
         *      foreach (Monom j in b)
         *      {
         *          res.monoms.Add(* j);
         *      }
         *  }
         *  return res;
         * }*/

        public static Polinom operator/(Polinom a, Polinom b)
        {
            Polinom res = new Polinom();

            if (a.monoms[0].degree < b.monoms[0].degree)
            {
                return(null);
            }
            Monom tmp = a.monoms[0] / b.monoms[0];

            res.monoms.Add(tmp);
            Polinom pol = a - (new Polinom(tmp) * b).ReducedPolinom();

            foreach (Monom i in pol)
            {
                foreach (double elem in i.coeff)
                {
                    if (elem != 0)
                    {
                        res.monoms.AddRange((pol / b).monoms);
                    }
                }
            }
            return(res);
        }
예제 #2
0
 public Polinom(Monom m)
 {
     this.monoms = new List <Monom>
     {
         m
     };
 }
예제 #3
0
        public int Compare(object obj1, object obj2)
        {
            if (obj1.GetType() != typeof(Monom) || obj2.GetType() != typeof(Monom))
            {
                throw new MatrixException("Невозможно сравнить");
            }
            Monom a = (Monom)obj1;
            Monom b = (Monom)obj2;

            if (a.degree == b.degree)
            {
                return(Compare(a.coeff, b.coeff));
            }
            throw new NotImplementedException();
        }
예제 #4
0
 public Matrix GetMean(Monom a, double value)
 {
     return(a.coeff * Math.Pow(value, a.degree));
 }