1 #include <CGAL/Polynomial.h>
2 #include <CGAL/Polynomial_traits_d.h>
3 #include <CGAL/Polynomial_type_generator.h>
4
main()5 int main(){
6 CGAL::IO::set_pretty_mode(std::cout);
7 typedef CGAL::Polynomial_type_generator<int,2>::Type Poly_2;
8 typedef CGAL::Polynomial_traits_d<Poly_2> PT_2;
9
10 //construction using shift
11 Poly_2 x = PT_2::Shift()(Poly_2(1),1,0); // x_0^1
12 Poly_2 y = PT_2::Shift()(Poly_2(1),1,1); // x_1^1
13
14 Poly_2 F // = (11*x^2 + 5*x)*y^4 + (7*x^2)*y^3
15 = 11 * CGAL::ipower(y,4) * CGAL::ipower(x,2)
16 + 5 * CGAL::ipower(y,4) * CGAL::ipower(x,1)
17 + 7 * CGAL::ipower(y,3) * CGAL::ipower(x,2);
18 std::cout << "The bivariate polynomial F: " << F <<"\n"<< std::endl;
19
20 PT_2::Degree degree;
21 PT_2::Total_degree total_degree;
22 PT_2::Degree_vector degree_vector;
23
24 std::cout << "The degree of F with respect to y: "<< degree(F) // = 4
25 << std::endl;
26 std::cout << "The degree of F with respect to x: "<< degree(F,0) // = 2
27 << std::endl;
28 std::cout << "The total degree of F : "<< total_degree(F) // = 6
29 << std::endl;
30 std::cout << "The degree vector of F : "<< degree_vector(F)// = (2,4)
31 << std::endl;
32
33
34
35 }
36