Next: Exercise 10. Up: Exercises Previous: Exercise 8.

Exercise 9.

The Maple function degree computes the total degree of a polynomial in a given variable(s). For example, the polynomial


> p := x^3*y^3 + x^4 + y^5:
> degree(p,x); # degree in x

                                       4

> degree(p,{x,y}); # total degree in x and y

                                       6

We showed how one could code the degree function in Maple with our DEGREE function. However, the degree function and our DEGREE function only work for integer exponents. Extend the DEGREE so that it computes the degree of a general expression, which may have rational or even symbolic exponents, e.g.


> f := x^(3/2) + x + x^(1/2);
                                    3/2        1/2
                              f := x    + x + x

> DEGREE(f,x);
                                      3/2

> h := (x^n + x^(n-1) + x^2) * y^m;

                                 n    (n - 1)    2   m
                          h := (x  + x        + x ) y

> DEGREE(h,x);
                                   max(n, 2)

> DEGREE(h,{x,y});
                                 max(n, 2) + m


bondaren@thsun1.jinr.ru