Hi,
I'll insert a code which produces wrong results. It is a recursion to calculate probabilities p[i] from the data which I put in the Matrix B:
B := Array[a, {8, 8}]
J := Dimensions[B][[1]]
For[k = 1, k < J + 1, k++, For[i = 1, i < J + 1, i++, a[i, k] = 0]]
For[k = 3, k < J + 1, k++, a[1, k] = (k - 2)*0.1; a[2, k] = "--"; a[k, 2] = "|"; a[k, 1] = (k - 2)]
a[1, 2] := "proba"; a[2, 1] := "claim"; a[1, 1] := "--"; a[2, 2] := "amount"; a[4, 4] = 1000; a[6, 4] = 1000; a[8, 4] = 1000;
B // MatrixForm
p[0] = Product[a[1, k]^Sum [a[l, k], {l, 3, J}], {k, 3, J}] t[0, i, j] := 0
t[k, i, j_] := t[k, i, j] = (1 - a[1, j + 2])/ a[1, j + 2]*(If[k - i < 0, 0, p[k - i]] - If[k - i < 0, 0, t[k - i, i, j]])
p[k_] := p[k] = Sum[Sum[1/kia[i + 2, j + 2]*t[k, i, j], {j, 1, J - 2}], {i, 1, Min[J - 2, k]}]
If you calculate the values of p[i] (for i=2 or 4 for example), it yields the value 0 even though it's not 0. In fact, this algorithm adds 0 to a very small number. This yields 0 which can't be correct.... Do you know how to avoid this error?? Maybe with the commands WorkingPrecision or AccuracyGoal? I wasn't successfull in trying out these commands. The NSum command instead of the Sum furnishs better results but with an error message. What shall I do? Thank you!