Bad interaction between Join and ListPlot (or Plot)

I need help, please. It is a very simple problem, but I cannot figure it out how to solve it.

When you write this code:

tab = {{1, 1}}; tab = Join[tab, {{2,2}}];

, you expect to get the following table:

{{1, 1}, {2, 2}}

…but, if you write the following code instead:

tab = {{1, 1}}; tab = Join[tab, {{2, 2}}]; ListPlot[tab]

, and after that, you check the elements of tab, it will contain these elements:

{{1, 1}, {2, 2}, {2, 2}}

Why does it happen? Is it a kind of bug of Mathematica, or I do not understand how Join function works?

JKrcT Bad interaction between Join and ListPlot (or Plot)

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange