0
$\begingroup$

I try to use condition statement to compute the following iterations. But it seems there is something wrong.

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)));
h[i_, j_] = i/q - j/p;
if[h = 0, c[i_, j_] = 0, 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);
P[k_] := c[k q - 1, k p] ((k q - 1 + q) p a - (k+1) p q cc) +c[k q, k p-1] ((k+1) p q b - (k p - 1 + p) q d);

Mathematica can compute c[q-1,p-1], but it says c[q,p] is complexinfinity which should be 0 by my condition statement. Besides, it cannot compute c[i,j], where $i>q,j>p$. what's wrong? I hope someone could help me out! Thanks!

$\endgroup$

closed as off-topic by Daniel Lichtblau, Lukas Lang, m_goldberg, b.gates.you.know.what, bbgodfrey Dec 1 '18 at 5:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, Lukas Lang, m_goldberg, b.gates.you.know.what, bbgodfrey
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ change if[h = 0, ...] to If[h ==0, ...]? $\endgroup$ – kglr Nov 27 '18 at 15:39
  • $\begingroup$ Oh! Such a silly mistake! Thanks! $\endgroup$ – Yuyi Zhang Nov 28 '18 at 0:05
0
$\begingroup$

As already said in the comment Mathematica statements including stuff like If or While or For start with Capital letters, so all you need to do is capitalise the if

$\endgroup$

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