# How could I iterate the following equations?

It's my first time to use mathematica, and I hope to iterate the following equations. Ci0=-Ci-1,0 ((i-1+q)p a-p q c)/((i+q) p-p q)
 C0j=-C0,j-1 ((q p b-(j-1+p) q d)/((q p-(j+p) q)
 Cij=-(Ci-1,j ((i-1+q)p a-(j+p) q c)+Ci,j-1 (((i+q) p b-(j-1+p) q d))/(((i+q) p-(j+p) q)
 C10=q (c-a)
 C01=p (d-b)

where a,b,c,d are variables, p,q are given numbers and $$C^{i}_{j}$$ can be seen as polynomials in variables a,b,c,d with index $$i$$ and $$j$$. It seems the instruction in mathematica is not specific enough, so I turn to here for help.

• Please post code for those equations, rather than an image of code. – Daniel Lichtblau Nov 23 '18 at 14:15

## 1 Answer

Change c to cc to avoid naming conflict and change C to c because C has meaning to Mathematica and guess where to add missing ). Then

c[i_,0]:=-c[i-1,0] ((i-1+q)p a-p q cc)/((i+q) p-p q);
c[0,j_]:=-c[0,j-1] ((q p b-(j-1+p) q d)/((q p-(j+p) q)));
c[i_,j_]:=-(c[i-1,j] ((i-1+q)p a-(j+p) q cc)+c[i,j-1]*
(((i+q) p b-(j-1+p) q d))/(((i+q) p-(j+p) q)));
c[1,0]:=q (cc-a);
c[0,1]:=p (d-b);


Then c[3,2] gives

-(((-(d*(1 + p)*q) + b*p*(3 + q))*(-(((-a + cc)*q*(-(cc*p*q) + a*p*(1 + q))*
(-(cc*p*q) + a*p*(2 + q))*(-(d*p*q) + b*p*(3 + q)))/((-(p*q) + p*(2 + q))*
(-(p*q) + p*(3 + q))*(-((1 + p)*q) + p*(3 + q)))) - (-(cc*(1 + p)*q) + a*p*
(2 + q))*(((-a + cc)*q*(-(cc*p*q) + a*p*(1 + q))*(-(d*p*q) + b*p*(2 + q)))/
((-(p*q) + p*(2 + q))*(-((1 + p)*q) + p*(2 + q))) - (-(cc*(1 + p)*q) + a*p*
(1 + q))*(-((-b + d)*p*(a*p*q - cc*(1 + p)*q)) - ((-a + cc)*q*(-(d*p*q) +
b*p*(1 + q)))/(-((1 + p)*q) + p*(1 + q))))))/(-((2 + p)*q) + p*(3 + q))) -
(-(cc*(2 + p)*q) + a*p*(2 + q))*(-(((-(d*(1 + p)*q) + b*p*(2 + q))*(((-a +
cc)*q*(-(cc*p*q) + a*p*(1 + q))*(-(d*p*q) + b*p*(2 + q)))/((-(p*q) + p*(2 +
q))*(-((1 + p)*q) + p*(2 + q))) - (-(cc*(1 + p)*q) + a*p*(1 + q))*
(-((-b + d)*p*(a*p*q - cc*(1 + p)*q)) - ((-a + cc)*q*(-(d*p*q) + b*p*(1 +
q)))/(-((1 + p)*q) + p*(1 + q)))))/(-((2 + p)*q) + p*(2 + q))) - (-(cc*(2 +
p)*q) + a*p*(1 + q))*(((-b + d)*p*(b*p*q - d*(1 + p)*q)*(a*p*q - cc*(2 +
p)*q))/(p*q - (2 + p)*q) - ((-(d*(1 + p)*q) + b*p*(1 + q))*(-((-b + d)*p*
(a*p*q - cc*(1 + p)*q)) - ((-a + cc)*q*(-(d*p*q) + b*p*(1 + q)))/(-((1 +
p)*q) + p*(1 + q))))/(-((2 + p)*q) + p*(1 + q))))