Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

Let's suppose that I have table t = {1.23, 3.4, 10, 34, 1.78, 0.98, 12.56}. To take the biggest element I can use Max[t] function. But I want to take not only the maximum element, but also the index of the element (so, which element in table it is). Is any function which helps to take the indes of element, when I know the value of this element?

share|improve this question

marked as duplicate by Mr.Wizard Jan 22 at 23:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5  
Position[t,Max[t]] –  rasher Jan 22 at 22:24
1  
    
I am closing this as a duplicate, for now. There are a number of similar questions on this site that can be found by searching for Position, Ordering, etc. Several deal specifically with maximum values. Also, your question is not fully specified; do you want only the position of one or all maximum values for example? Further, this question is arguably "easily found in the documentation" for Position. If you have a more specific question please edit accordingly. –  Mr.Wizard Jan 22 at 23:32
    
@Mr.Wizard Can you explain how I have to look in documentation for method 'Position' or 'Ordering', when I don't know that this method exist? –  Ziva Jan 23 at 1:24
    
@Ziva my closing this question was not meant to chastise you for asking; rather it is to keep the site organized to the extend that I am able. I know that the documentation can be hard to navigate. Searching this site is hopefully a bit easier, and every duplicate question provides another avenue to find what one is looking for, e.g. this one now uses the terminology "index" and in addition to Sjoerd's answer it points to two more questions which are hopefully helpful. (continued) –  Mr.Wizard Jan 23 at 2:57

1 Answer 1

Ordering[t, -1]  

which is orders of magnitude faster than

Position[t,Max[t]]
share|improve this answer
    
Since the op states after initial example " Is any function which helps to take the indes of element, when I know the value of this element?", a much more general statement, not sure ordering will address it. Of course, if one is only after the last instance of a maximum (because if there are multiple, ordering again becomes a bit useless), this is the fastest way. –  rasher Jan 22 at 23:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.