Dear All, I'm trying to plot points generated by something called the logistic map by using the following code:
> L:=array(1..30,1..1);
x:=0.3;
for i from 1 to 30 do
x:=4*x*(1-x);
L[i,1]:=x
od;
print(L);
>Lpoints:=convert(L,listlist);
>plots[pointplot](Lpoints,symbol=point);
But what I get is an error message saying "Error, (in plots/pointplot) incorrect 1st argument." Any suggestions as to how to overcome this problem?
Also,with regard to the array that is generated: the initial condition, x=0.3, does not appear in the array.The first entry in the array is 0.84,which is the first iterate of the initial condition.Any suggestions as to how I can get the initial condition to be the first entry?
Thanks for any suggestions!
Isabelle
LineChart
A few comments. First, you should use Array rather than array, the latter is older structure. I'd probably use a table rather than an Array, just because ...
To generate a point plot you create a listlist structure of the form [[x1,y1],[x2,y2],...]. In this case, however, because the x are merely indices, it is easier to use Statistics:-LineChart, which only asks for a list (or Vector) or points:
A nice feature of LineChart is that it plots the points and connects them. Using plots[pointplot] gives a bunch of scattered points and it is difficult to see how they are connected.
To get the initial x in the array, swap the two lines in the do loop (the last computed x is not used).