Hi,
I think that nobody has answered your last message, so I will try to.
On 05/15/2012 02:02 PM, Evgeniy Maevskiy wrote:
> Thank you, Rupert, for your answer. About my expectations.
>
> First example
> -------------
>
> 1) x is an array, because we call x[-4/5], x[-1], x[0], x[1], x[4/5], x[6/10] in
> makelist;
Wrong, the makelist command you used:
makelist(x[2*k/(k^2+1)],k,-2,3)
is equivalent to having written down:
[x[-4/5], x[-1], x[0], x[1], x[4/5], x[3/5]]
which does not create any array and does not give any values to x; x
remains an unknown variable.
> 2) after x:makelist(...) x is a list;
Correct.
> 3) x is a list therefore x[0] not exists.
Correct.
> Second example
> --------------
>
> 1) x is an array and x[1]=a;
Correct. If there was already a list named x, the command x[1]:... would
have replaced its first element.
Since you do not have any list named x, the command x[1]:... created an
array x, with one element x[1].
> 2) after x:makelist(...) x is a list (listp=true);
Correct. The array x that you have created in 1) continues to exist, and
you have also created
a list which is also named x, as the array.
> 3) ... but x[0], x[-4/5], etc. are safe and sound
Wrong. The only one that is safe and sound is x[1], because you have
only created one element (x[1]:a)
for the array x. x[0] and x[-4/5] remain undefined.
Notice that you now have a confusing situation, because x[1] might refer
to the element "1" of array x
or to the first element of the list x. Different functions in Maxima
will look first in the array or in the
list, so in some cases you get the element x[1] of the array and in some
other cases the element x[1]
of the list:
x[1] ---> element 1 of the array
first(x) ---> element 1 of the list
part(x,1) ---> element 1 of the list
I hope this helps.
Regards,
Jaime