I'm following a paper trying to find a way to repeat the done computations using Mathematica. I'm beginner using Mathematica and I already read that:

  • I could define functions by recursion;
  • I could ask the software to find a generating function for a given family;
  • The Wolfram application can be used to change the initial conditions in a given family and ask again for the generating function;

Let the following $P_k(c)$ be a polynomial in $c$ satisfying the following recursion relation $$(6+2k)P_k(c)=4kcP_{k-2}(c)-2(k-3)P_{k-4}(c).$$

If we take initial conditions $P_{-3}(c)=P_{-2}(c)=P_{-1}(c)=0$ and $P_{-4}(c)=1$ then we arrive at a generating function $$P_{-4}(c,z):=\sum_{k\geq-4} P_{-4,k}(c)z^{k+4}=\sum_{k\geq0}P_{-4,k-4}(c)z^k.$$

How could I repeat this using Mathematica? Is there any easy way to change this initial conditions using the software (and then find the generating function)?

Thank you so much!

  • $\begingroup$ Show us the code you’ve tried so far $\endgroup$
    – MarcoB
    Oct 12, 2020 at 3:25

1 Answer 1


First a correction. The coefficient of z^n in the generating function should be p[n,c] and not p[n-4,c]. With this in mind, we may define (for simplicity I only sum up to 6. This is good enough here to make the point. In a real application you would sum up to Infinity and search for a closed form):

p[-3, c] = p[-2, c] = p[-1, c] = 0;
p[-4, c] = 1;
p[n_, c_] := 1/(6 + 2 n) (4 n c p[n - 2, c] - 2 (n - 3) p[n - 4, c])
genf[c_, z_] := Sum[p[i, c] z^i, {i, 0, 6}]

When we now take the m'th derivative of genf and set z->0, we should get p[m,c].

Table[Print@ StringForm["p[,c] == , D[genf[c,z],{z,1}]/.z->0 == ``", i, p[i, c], D[genf[c, z], {z, i}] /. z -> 0], {i, 0, 4}]

p[0,c] == 1 , D[genf[c,z],{z,0}]/.z->0 == 1

p[1,c] == 0 , D[genf[c,z],{z,1}]/.z->0 == 0

p[2,c] == (4 c)/5 , D[genf[c,z],{z,2}]/.z->0 == (4 c)/5

p[3,c] == 0 , D[genf[c,z],{z,3}]/.z->0 == 0

p[4,c] == 1/14 (-2+(64 c^2)/5) , D[genf[c,z],{z,4}]/.z->0 == 1/14 (-2+(64 c^2)/5)

  • $\begingroup$ I am not sure why you say that the coefficient of $z^n$ should be $P_{-4,k}$. Could you explain? Second, I understand that using this algorithm you describe here, we'll find each $P_{k}(c)$, but, for me, it is note clear how I could use it to find the generating function. For this example, I know that the generating function, in terms of an elliptic integral is $$ z\sqrt{1-2cz^2+z^4}\int \frac{4cz^2-1}{z^2(z^4-2cz^2+1)^{3/2}}dz. $$ Is there any way to make Mathematica help me on this computation? Last observation is that, maybe you need to edit part of given answer to the code format. $\endgroup$
    – Felipe
    Oct 12, 2020 at 14:56
  • $\begingroup$ Well, to get the full blown generating function, you would have to evaluate: genf[c_, z_] = Sum[p[i, c] z^i, {i, 0, Infinity}]. But this makes only sense if there exists a closed form for the sum. $\endgroup$ Oct 12, 2020 at 15:14

Your Answer

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

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