Question: A problem in selecting elements from set

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.

restart:

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)}]

(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];

1

 

{diff(Theta(x), x), diff(diff(Theta(x), x), x)}, diff(Theta(x), x), diff(diff(Theta(x), x), x)

 

 

2

 

{diff(diff(g(x), x), x), diff(g(x), x)}, diff(diff(g(x), x), x), diff(g(x), x)

(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)]]

(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)  ?

Please Wait...