I have a function that I am defining as (assume m,n,a,b are non-negative integers):
myfcn[x_^m_ p_^n_, x_^a_ p_^b_] := basefcn[m, n, a, b];
and then extending to all polynomials by linearity.
The way I defined the function above works as long as m,n,a,b are all greater than 1, but fails otherwise. For instance, I want
myfcn[x p^2, p] to evaluate to
basefcn[1,2,0,1], but mathematica does not recognize that this is what I want.
How do I extend my function definition to include these cases without explicitly writing out all possible input forms?