2
$\begingroup$

I am confused with a strange phenomenon that I observe and do not understand.

Look, here is a simple code making a random walk:

Clear[list];
list = Accumulate[RandomInteger[{-1, 1}, {10, 2}]]

(* {{0, 1}, {0, 2}, {-1, 1}, {-1, 1}, {0, 1}, {0, 1}, {-1, 1}, {-1, 
  0}, {-1, 0}, {0, 1}} *)

Looks right. But let us now assign the content of the variable "list" to something else:

lst = list

The outcome is astonishing:

enter image description here

It is not only that I expect to have pairs of numbers, rather then triples. But it is astonishingly huge.

Let us now take few items of the list:

Take[list, 4]

(*  {{-1, -1, 0}, {-1, 0, 1}, {-1, 0, 2}, {0, 0, 1}}  *)

Again, not only triples of numbers, but the ones obtained do not coincide with the first numbers obtained in the previous operation

However, if I use some other name instead of "list", say, "ll", everything looks OK:

ll = Accumulate[RandomInteger[{-1, 1}, {10, 2}]]
Take[ll, 4]

(*  {{0, 0}, {1, -1}, {0, -1}, {0, -1}, {-1, -1}, {-1, 0}, {0, 1}, {0, 
  0}, {-1, 0}, {-1, 0}}

{{0, 0}, {1, -1}, {0, -1}, {0, -1}}  *)

I use Mma. 11.1.1 om Win7. I should add that I tried to first quit/start the kernel, and even to close/open Mma. The result is the same.

What's that? Why the variable "list" is that bad?

$\endgroup$
  • 1
    $\begingroup$ Can't reproduce that on V11.1.1 Win10, $\endgroup$ – Kuba May 10 '17 at 7:38
  • $\begingroup$ Can't reproduce the behavior you report. Did you try with a blank notebook in a new session of Mathematica? $\endgroup$ – m_goldberg May 10 '17 at 7:49
  • $\begingroup$ in v.10.3 I get normal results too $\endgroup$ – Tom Zinger May 10 '17 at 15:05
  • $\begingroup$ I should add that it is a part of an interactive demonstration that I regularly show students already during several years. It always worked perfectly. Yesterday I looked at it once more to recall and refresh the mind before the lecture and faced the behavior that I have reported. $\endgroup$ – Alexei Boulbitch May 11 '17 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.