public bool Remove(T item) { int n = 0; T[] temp = new T[Count - 1]; if (!Mas.Contains(item)) { return(false); } for (int i = 0; i < Count - 1; i++) { if (!Mas[n].Equals(item)) { temp[i] = Mas[n]; n++; } else { n++; i--; } } Mas = temp; Count--; return(true); }
//построение многочлена public double polynomial(double g) { mas.Clear(); double c = b - a; kol = c / n; double a0 = a + kol; double b0 = b; Mas temp = new Mas(a, func(a)); mas.Add(temp); for (double i = a0; i < b0 + kol; i += kol) { Mas temp0 = new Mas(i, func(i)); mas.Add(temp0); } double rez = 0; for (int i = 0; i < n + 1; i++) { rez += denominator(i) * numerator(i, g); } return(rez); }
public Node ExpMas(){ var node1 = ExpSimple(); while (Current == TokenCategory.MAS) { Expect(TokenCategory.MAS); var node2 = new Mas() { node1, ExpSimple() }; node1 = node2; } return node1; }
public StageData(string aFilePath) { mData = new Arg(MyJson.deserializeResourse("stage/data/" + aFilePath)); //マスデータ List <Mas> tMasList = new List <Mas>(); List <Arg> tMasData = mData.get <List <Arg> >("mas"); foreach (Arg tData in tMasData) { Mas tMas = Mas.create(tData); tMasList.Add(tMas); } mData.set("mas", tMasList); }
public Node ExpMas() { var exp1 = ExpSimple(); while (CurrentToken == Token.MAS) { Expect(Token.MAS); var exp2 = new Mas() { exp1, ExpSimple() }; exp1 = exp2; } return(exp1); }
public Node MasExp() { var exp1 = SimpleExp(); Console.WriteLine(CurrentToken); while (CurrentToken == Token.MAS) { Expect(Token.MAS); var exp2 = new Mas() { exp1, SimpleExp() }; exp1 = exp2; } return(exp1); }
public void Process(out int[,] res, out int maxi) { int n = Mas.GetLength(0); double[] res1 = new double[n]; //массив для хранения информации о коэфицентах for (int i = 0; i < n; i++) { res1[i] = (double)K_a[i] / K_b[i]; } // Словарь с числами и их количеством Dictionary <double, int> repeats = new Dictionary <double, int>(); foreach (var numb in res1) { if (repeats.ContainsKey(numb)) { repeats[numb] += 1; } else { repeats[numb] = 1; } } int max = repeats.Values.Max();//максимальное количество повторяющихся значений double key = repeats.First(x => x.Value == max).Key; int[,] result = new int[max, 3]; int k = 0; for (int x = 0; x < n; x++) { if (((double)K_a[x] / K_b[x]) == key) { for (int j = 0; j < 3; j++) //заполнение массива { result[k, j] = Mas[x, j]; } k++; } } res = result; maxi = max; }
//построение многочлена по таблице public double graf_table(double g) { mas.Clear(); double c = b - a; kol = c / n; double a0 = a + kol; double b0 = b; Mas temp = new Mas(a, func(a)); mas.Add(temp); for (double i = a0; i < b0 + kol; i += kol) { Mas temp0 = new Mas(i, func(i)); mas.Add(temp0); } tbl_mas(mas.Count()); for (int y = 1; y < n + 1; y++) { create_table(y); } double rez = 0; for (int i = 0; i < n + 1; i++) { rez += denominator_table(i) * numerator(i, g); } return(rez); }
public string Visit(Mas node) { return(Visit((dynamic)node[0]) + Visit((dynamic)node[1]) + "\t\tcall string class ['pptlib']'ppt'.'Runtime'::'mas'(string, string)\n"); }