I want to extract some informations, say the coefficients of $x^{500}$ and $x^{1000}$ terms (numerical values are acceptable), of the multiple of

(2/9 x^(-1) + 5/9 + 2/9 x)^700*(1/3 x^(-1) + 1/3 + 1/3 x)^600

However, the brutal computation would not be a practical way. I think the underlying idea is related to the convolution, but I can't see a way to do this. It would be good to have a lazy evaluation mechanism in MMA, but there seems no.

Actually this question comes from a probability task, that I want to compute the p.d.f. of the sum of, say 700 many random variables.

k = 700;
vec = Array[x, k];
dist = EmpiricalDistribution[{2/9, 5/9, 2/9} -> {-1, 0, 1}];
pdf = PDF@
   vec \[Distributed] ProductDistribution[{dist, k}]]
DiscretePlot[pdf[n], {n, -10, 10}, PlotRange -> All]
(*It took endless time... Hence not work.*)

How can I achieve this?

PS. If it is inevitable to neglects some intermediate terms with the norm of coefficients less than, say $2^{-300}$, to achieve the task, then I'm willing to do so. But how to do it?

  • 2
    $\begingroup$ The distribution is closly approximated by a Gaussian normal with mean zero. You just need to find the standard deviation. Read about central limit theorem. $\endgroup$
    – Somos
    Commented Jul 12, 2021 at 16:22
  • $\begingroup$ If you use machine precision for your coefficients, Coefficient returns answers quite quickly $\endgroup$
    – mikado
    Commented Jul 12, 2021 at 16:47

1 Answer 1



expr = (2/9 x^(-1) + 5/9 + 2/9 x)^700*(1/3 x^(-1) + 1/3 + 1/3 x)^600;

The coefficient of $x^{500}$ can be computed as an exact rational in about a minute or so

Coefficient[expr, x, 500]
(* output omitted *)

If you just need a numerical value, the following is faster (and agrees with the rational value)

Coefficient[Map[N[#, 20] &, expr, {3}], x, 500]
(* 3.2222219661144821*10^-81 *)

As @Somos suggests, if your real purpose is understanding the statistical distribution, applying the central limit theorem is probably likely to be helpful. Of course, probabilities of $10^{-81}$ are probably not practically meaningful.

  • 1
    $\begingroup$ Coefficient[N[expr, 20], x, 500] does the same thing and is simpler. For some (good) reason it does not numericalize the exponents. $\endgroup$
    – Roman
    Commented Jul 12, 2021 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.