Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to solve the following recurrence equation

RSolve[{(k + 2) c[k + 2] q^(k + 1) - c[k] == 0}, c[k], k]

During calculation in Mathematica I get this persistent error:

Context::ssle: "Symbol, string, or HoldPattern[symbol] expected at position Context[Zeta$^{(1,0)}$].

I tried to solve this equation with Maple and obtained a result

$\left\{ \begin{array}{cc} c (0)\frac{ 2^{-\frac{k}{2}} q^{-\frac{1}{2} k \left(\frac{k}{2}-1\right)} \left(\frac{1}{q}\right)^{k/2}}{\Gamma \left(\frac{k}{2}+1\right)} & k\text{::}\text{even} \\ c(1)\frac{\sqrt{\pi } 2^{-\frac{k}{2}-\frac{1}{2}} q^{-\left(\frac{k}{2}-\frac{1}{2}\right) \left(\frac{k}{2}-\frac{3}{2}\right)} \left(\frac{1}{q^2}\right)^{\frac{k}{2}-\frac{1}{2}}}{\Gamma \left(\frac{k}{2}+1\right)} & k\text{::}\text{odd} \\ \end{array} \right.$

So is it just a bug in Mathematica 9 or am I missing something?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

This is definitely a bug. It seems that the problem is caused because you increment the argument by two (your recurrence has c[k] and c[k+2]). This results in two cases (even and odd), as can be seen by your Maple output, and Mathematica apparently does not know how to deal with this properly.

One way around this is to substitute the variables so that the two cases are considered separately. For example, for the even case you substitute k = 2 m and run

RSolve[{(2 m + 2) c[2 (m + 1)] q^(2 m + 1) - c[2 m] == 0}, c[m], m]

This gives

$c(m)\to c_1 \frac{2^{1-\frac{m}{2}} \left(\frac{1}{q^2}\right)^{\frac{1}{8} m (m+2)} q^{\frac{m}{2}+1}}{\Gamma \left(\frac{m}{2}+1\right)}$

after simplification. Then you do the reverse substitution to obtain the answer for the original recurrence. You can deal with the odd case similarly. This is annoying, of course, but at least you get your answer in the end.

share|improve this answer
Thanks for your workaround! Yeah, it's annoying, because each case here must be dealt with separately. –  SaF May 9 '13 at 15:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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