I tried to write a function which is basically given by a for loop and some predefined functions. I checked already that all of the predefined functions are working, but somehow my for loop does not stop. I was trying to add up these elements ProbNeu1*ProbNeu1
where in every step there is some new element from this function RuTable
. Here is my code:
AvProb6[rho_, Nu_, Nstat_, list1_, list2_] :=
Module[{val, valn, RU1, value},
val = 0;
For[n = 1, n <= Nstat, n++,
RU1 = RUTable[Nu];
valn = ProbNeu1[rho, RU1, list1]*ProbNeu1[rho, RU1, list2];
val = val + valn;
];
value = (val/Nstat);
Return[value]
];
Is there someone who finds a problem with what I did here?
For
loop won't stop if you pass in a non-numerical value forNstat
. $\endgroup$