Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public Polinom(Monom m)
 {
     this.monoms = new List <Monom>
     {
         m
     };
 }
Exemplo n.º 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();
        }
Exemplo n.º 4
0
 public Matrix GetMean(Monom a, double value)
 {
     return(a.coeff * Math.Pow(value, a.degree));
 }