Using Ordered List Positions

I have a list of items L, in alphabetic order, that I want students to rank on personal preference (i.e. no correct order). Using an ordered list, each student can put the items into their desired order and the final choice can be extracted as a list C. On the next screen I’d then like to display a table showing their preference order P against the original alphabetic list L. So, if this were a list of holiday destinations and the third item was put top, there would be a 1 against the third item in the table. In formulaic terms, this would be P[C[1]] = 1 but with my lack of experience I can’t work out how to do that in Desmos. Apologies if it is trivial!

I can invite the students to put the preference numbers directly into the table but validating what they enter is then tricky.

It doesn’t appear to be documented (as far as I can tell), but the sort function does allow the format sort([list],[key]). So if I’ve understood you correctly, C is a list such as [3,1,2,4,6,5] where 3 is the third item alphabetically but first in the student’s preference list?

If you create the list A=sort([1...6],C) then this would yield the list [2,3,1,4,6,5] (indicating that the first item alphabetically is in position 2, the second item alphabetically is in position 3, etc.). You could then extract the values from that list to place into your table.

2 Likes

Many thanks @pirsquared, I’ve tested that out and it’s exactly what I needed!