Hello,
my code is the following. It is an algorithm to calculate some Claim distributions...
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] = 100]]
For[k = 3, k < J + 1, k++, a[1, k] = (k - 2)/10; 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/k*i*a[i + 2, j + 2]*t[k, i, j], {j, 1, J - 2}], {i, 1,
Min[J - 2, k]}]
For[i = 0, i < 2000, i++, Print[N[p[i]], i]]
The last command yields:
NSum::nsnum: "Summand (or its derivative) (i\a[i+2,j+2]\t[1778,i,j])/1778 is not numerical at point j = 1. "
What happened here? If I insert smaller numbers in the array B, it works perfectly. It seems to have problems with larger numbers?
Thank you for your help.
Jotwie