I get a problem while selecting elements from sets.
I have a list of two sets apparently ordered in the same order.
When I pick this, for instance, first set from each of these two samples I get the first one from the first set, and the second one from the second set.
> |
DF := [ {diff(Theta(x), x), diff(Theta(x), x, x)}, {diff(g(x), x), diff(g(x), x, x)} ]
|
![[{diff(Theta(x), x), diff(diff(Theta(x), x), x)}, {diff(diff(g(x), x), x), diff(g(x), x)}]](/view.aspx?sf=235707_question/a0a872abf63b0d0b5463b080ca761e7c.gif)
|
(1) |
> |
# Why are the elements of DF[2] not returned in their correct order?
i := 1;
DF[i], DF[i][1], DF[i][2];
print():
i := 2;
DF[i], DF[i][1], DF[i][2];
|

|
(2) |
> |
# I suppose we must not trust what is displayed and that lprint is more
# trustworthy?
lprint(DF)
|
[{diff(Theta(x), x), diff(diff(Theta(x), x), x)}, {diff(diff(g(x), x), x), diff(g(x), x)}]
|
|
> |
# I expected that converting each element of DF into a list would fix this
# problem. but anothr does appear:
# "Why does the conversion into list change the order of the elements?"
# I had never seen that before
LDF := convert~(DF, list)
|
![[[diff(Theta(x), x), diff(diff(Theta(x), x), x)], [diff(diff(g(x), x), x), diff(g(x), x)]]](/view.aspx?sf=235707_question/f596b26c152c605a0e0a90852e99c262.gif)
|
(3) |
|
Download Selection_from_a_set.mw
Running this command
map(sort, LDF)
displays LDF, which suggests that LDF is already sorted according to some order.
What is this order which makes diff(Theta(x), x$2) the successor of diff(Theta(x), x) but diff(g(x), x) the successor of diff(g(x), x$2) ?