0
|
5426 Views
|
|
0 Total Likes
View groups...
Share
GROUPS:

# Hold[....] is not a number - what does that mean??

Posted 9 years ago
 Hello, my code is the following. It is an algorithm to calculate some Claim distributions... B := Array[a, {8, 8}] J := Dimensions[B][] 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 = 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
 It runs (Mathematica 10.0.0 Windows 7 64 Bit) as it stands, but results are absurdly tiny  In:= B:=Array[a,{8,8}] J:=Dimensions[B][] For[k=1,k 3.029737703319802*10^-2398 | 1994 8.097275169341772*10^-2398 | 1995 2.163559417657008*10^-2397 | 1996 5.779561424297470*10^-2397 | 1997 1.543537324401404*10^-2396 | 1998 4.121313473809303*10^-2396 | 1999 does it run within a freshly evaluated notebook in a freshly started Mathematica session? Then try to evaluate t[1778,i,j] with typical values for i and j to get an idea what happens ...