I would like to compute the coefficient in front of $n^p$ for a polynomial expansion.
I wrote the following code:
f[n_, q1_, q2_] := (n^q1 + (n + 1)^q1)* (n^q2 + (n + 1)^q2)
SeriesCoefficient[f[n, q1, q2], {n, 0, p},
Assumptions -> {Element[q1, Integers] && q1 >= 0,
Element[q2, Integers] && q2 >= 0 }]
However, Mathematica is unable to return a result. Why?
I would expect an expression that consists of binomial coefficients (I can do it by hand, it is not very complicated, thus I wonder why Mathematica cannot).
prelates toq1andq2. There is no problem if they are specific given integers. – Somos Jul 10 '19 at 17:06SeriesCoefficient[(n + 1)^q, {n, 0, p}]returns a conditional result butSeriesCoefficient[n^q + (n + 1)^q, {n, 0, p}]returns unchanged. – Somos Jul 10 '19 at 17:13Inactive[Sum]function (https://mathematica.stackexchange.com/questions/7886/how-to-symbolically-differentiate-an-infinite-series-without-evaluating-the-seri/179782#179782). – JimB Jul 11 '19 at 15:15Piecewisestructure. Is that what you need? It won't be a single binomial coefficient. – JimB Jul 11 '19 at 17:52h[p_, q1_, q2_] := Boole[p == q1 + q2]*1 + Boole[q2 <= p <= q1 + q2]*Binomial[q1, p - q2] + Boole[q1 <= p <= q1 + q2]*Binomial[q2, p - q1] + Boole[0 <= p <= q1 + q2]*Binomial[q1 + q2, p]. Is that the kind of output that you're expecting? (Using 'Piecewise` would also be of similar compactness.) And that doesn't include checks for integer input. – JimB Jul 11 '19 at 18:16