So, along with counting 1 for each element that is greater, we should also add something depending on how many elements are equal, is that it?
Ok, lets think for a bit.
The rank function returns
sum(seq(when(list[i]<list[index],1,0),i,1,n))+1
The when statement will return 1 if the element on position i is greater than the element on position index, then sum the results for all i from 1 to n and adding 1 to that result as a number with zero elements bigger will have rank 1.
If you have n elements that are equal, currently tied on position m they currently have a rank of m, and the next element will have a rank of m+n+1.
That is to say that those elements occupy positions m, m+1, ... , m+n-1.
What you want is to, instead of having rank m, to have rank
(m + m + n - 1 ) /2 = m + (n-1)/2.
So, the rank you're looking for is
Elements_bigger_than + 1 + Elements_equal_to / 2 - 1/2 =
Elements_bigger_than + Elements_equal_to / 2 +1/2
Just replace that last line on the rank() function by
sum(seq(when(list[i]<list[index],1,0),i,1,n)) + sum(seq(when(list[i]=list[index],1,0),i,1,n))/2 + 0.5
and you'll have the results you want.
For list {1,2,2,3} you'll get {1,2.5,2.5,4} as the ranks;
For list {1,2,2,2,3} you'll get {1,3,3,3,5} as the ranks;
For list {1,2,2,2,2,3} you'll get {1,3.5,3.5,3.5, 3.5, 5} as the ranks.
If that what you're looking for?
Nelson
PS: operations on lists aren't THAT complicated. Of course it takes time to analyze the problem, set the goals and come up with the ideas. But there's no rocket science here, only the criterious use of the available list operations on TI-Nspire and some pen and paper to make a draft of the procedures. You should, however, try to get it done by yourself and try to, looking at a working example, improve it to meet your demands. If you just write a message to the user group and wait for someone to write you the answer you're not really learning anything. Take, for example, your first question, regarding the order that was reversed. It would take just a few minutes to analyze the code and realise that the operations were done using the wrong comparison symbol. So the change you needed was replacing < to >. Instead, you came to me again to ask for a ready-to-go solution. I don't really mind building code for others to use, as long as I have the time for it, but if you keep asking people to give you the solution instead of trying to get to it yourself, eventually you'll ask for something that either (a) nobody knows how to do; (b) who knows how to doesn't have the time to do it for you; or (c) although someone knows how to do it and has the time for it, isn't in the mood to do your homework assignments. This usergroup is a way to get help, not to get the work done.