Question: Too many levels of recursion! Why?

<p>Hello</p>
<p>I'm a beginner and I need to implement this recursive function with Maple:</p>
<p>$$\left\{\begin{array}{c}<br />
Z(1)=(1-p_a)(1-p_b)\\<br />
Z(i)=((1-p_a)(1-p_b))^{\left(\frac{p_a}{1-p_a}+\frac{p_b}{1-p_b}\right)^i}\prod_{k=1}^{i-1}(1-Z(k))<br />
\end{array}\right.$$</p>
<p>where 0<p_a<1 and 0<p_b<1</p>
<p>So I write in Maple:</p>
<p>Z:=(i, pa, pb)->if i=1 then (1-pa)*(1-pb) else (((1-pa)*(1-pb))^((pa/(1-pa)+pb/(1-pb))^i))*product(1-Z(k, pa, pb),k=1..i-1) end if;</p>
<p>When i=1 the function works</p>
<p>but when i=2 or more the function give the following error:</p>
<p>Error, (in Z) too many levels of recursion</p>
<p>Why? What I can I do?</p>
<p>Thank You.</p>
<p>Best regards</p>
Please Wait...