espp make_espp(const polynom& form, const affine_change& var) {
	espp e;
	multi_affine tmp(form.get_n());
	vector<vector<bool>> poly = form.get_poly(), matrix = var.get_matrix();
	
	//cout<<tmp<<endl;
	
	for (int i = 0; i < poly.size(); ++i) {
		for (int j = 0; j < poly[i].size(); ++j) {
			if (poly[i][j]) {
				tmp *= matrix[j];
			}
		}
		
		e += tmp;
		
		//cout<<"tmp = "<<tmp<<endl;
		
		tmp.set_one();
	}
	
	//cout<<"e = "<<e<<"\n\n";
		
	return e;	
}
ordinal COM_QQ_D(const polynom& left, const polynom& right) {
	if (left.degree() < right.degree())
		return ordinal::LT;
	if (left.degree() > right.degree())
		return ordinal::GT;
	for (int i = left.degree(); i >= 0; i--) {
		auto currComp = COM_QQ_D(left[i], right[i]);
		if (currComp != ordinal::EQ)
			return currComp;
	}
	return ordinal::EQ;
}
Beispiel #3
0
void printpoly(polynom const& p) {
  if(p.empty()) { cout << "  0";  return; }
  int n=p.size();
  bool first=true;
  for(int i=n-1; i>=0; --i) {
    if(p[i]==0 && !first) continue;
    if(first) { first=false; } else { cout <<"+"; }
    cout << setw(3) << right << p[i];
    if(i>1)  cout << " x^" << i << " ";
    if(i==1) cout << " x   ";
  }
}
Beispiel #4
0
polynom DER_P_P(const polynom& polynom_1) {
    // вспомогательные переменные + степень многочлена
    polynom polynom_2 = polynom_1;
    unsigned size_polynom = polynom_1.degree();
    fraction Number_1(0), Number_2(1);
    polynom_2[size_polynom] = Number_1;  // высшей степени мн-на присваиваем 0

    //дифференцирование многочлена
    for (unsigned p = 0 ; p < size_polynom; ++p) {
        Number_1 = ADD_QQ_Q(Number_1, Number_2);
        polynom_2[p] = MUL_QQ_Q(polynom_1[p+1], Number_1);
    }

    polynom_2.reduce();  // уменьшение степени на 1
    return polynom_2;
}
Beispiel #5
0
natural DEG_P_N(const polynom &pn) {
    natural result(pn.degree());
    return result;
}
equal_functions::equal_functions(const polynom& p) : n(p.get_n()) {
	members.insert(pair<int,int>(vec_to_int(p), -1));
}