Question: Obtaining power of polynomial where the power is a variable

The question has been asked at http://www.mapleprimes.com/questions/133139-A-Question-About-Obtaining-Power-Of-A-Variable

 

 

However, still, I would like to have a simple, straightfoward solution. The situation is not about several term case, x^a*y^b + x^(a+2)*y^b, but for a single term. I have a term "3*x^k*y^(k+2) ", and how should I do to obtain the power of x, and the power of y? (k and k+2) 

 

I tried the following input as somehow suggested in the link above

***********

term:=3*x^k*y^(k+2);

x_degree:=map(t -> `if`(match(t = a*x^b*y^c, x, 's1'), subs(s1,b), NULL), convert(term, list));
y_degree:=map(t -> `if`(match(t = a*x^b*y^c, y, 's1'), subs(s1,c), NULL), convert(term, list));
print(x_degree,y_degree);

*****

 

I got 

***

k (k + 2)
3 x y
[0, k, 0]
[0, 0, k + 2]
[0, k, 0], [0, 0, k + 2]

****

I have no idea why k appear at second variable in [0,k,0] while k+2 appear at the third in [0,0,k+2]...

Please Wait...