On Fri, May 4, 2012 at 11:47 AM, Aaron Meurer <[email protected]> wrote: > We do have the multinomial_coefficients() function. Is that the same > thing as what you want?
The mutinomial function will perhaps be the key to solving the "coefficient without expanding' problem, e.g. what is the coefficient of `a**7*b**(6*x+2)` in `(a + b**(2*x) + a**2*b)**4`? Ans: we want the powers i, j and k such that `a**i*b**(2*x*j)*(a**2*b)**k == a**7*b**(6*x+2)`. Expanding the lhs gives `a**(i + 2*k)*b**(2*j*x + k)`. Equating with the desired coefficients gives `i+2*k == 7 and 2*j*x + k == 6*x + 2` Matching coefficient in the 2nd eqn gives `j = 3 and k = 2` hence `i = 3` and the coefficient must be zero since 3 + 3 + 2 > 4 But if we look for the coeff of `a**6*b**(2*x+3)` we find `i,j,k=0,1,3` with `multinomial(0,1,3) == 4` ``` >>> powsimp(((a + b**(2*x) + a**2*b)**4).expand()).coeff(a**6*b**(2*x+3)) 4 ``` Are you, Kjetil, interested in implementing that? /c -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
