I have following code in my Mathematica:

P[k_?NumericQ, L_?NumericQ] := P[k, L] = NIntegrate[Exp[I*k*r]*1/r^(2/3), {r, 0, L}];

i = 1;

rhot = {};

a[k_] := RandomVariate[NormalDistribution[0, Sqrt[Re[P[k, 100]]]]] + 
   I*RandomVariate[NormalDistribution[0, Sqrt[Im[P[k, 100]]]]];

While[i < 3, 
      alist = Table[a[k], {k, 2*Pi/100, 2*Pi, 2*Pi/100}]; 
      rslist = Fourier[alist]; 
      rhotl = Total[rslist];
      Append[rhot, rhot1]; 

Unfortunately, the while loop does not give any output. Any idea why this is so?


closed as off-topic by Feyre, MarcoB, Yves Klett, Wjx, bbgodfrey Aug 25 '16 at 14:01

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." – Feyre, MarcoB, Yves Klett, Wjx, bbgodfrey
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    $\begingroup$ Try with Table or AppendTo. $\endgroup$ – Kuba Aug 25 '16 at 9:01
  • $\begingroup$ You mean change the statement Append[rhot, rhot1]; to AppendTo[rhot, rhot1]; ? $\endgroup$ – titanium Aug 25 '16 at 9:05
  • 5
    $\begingroup$ rhot = Append[rhot, Total[rslist]]; Append[] doesn't actually dynamically change a list, you still need =. With AppendTo you don't need = $\endgroup$ – Feyre Aug 25 '16 at 9:19