Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.7K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

If I pick out a value from an array, how do I know which element it is?

Posted 10 years ago

Hi!

I simply am applying the Max function to an array of data, but I want to know exactly which element the maximum corresponds to. I only have Mathematica version 9, so keep that in mind (i.e. I would like to explore "MaximalBy", but I can't).

Thank you for your time,

-Phil

POSTED BY: Phillip Rechani
2 Replies
Posted 10 years ago

I like when it's easy. Thank you very much!

POSTED BY: Phillip Rechani

but I want to know exactly which element the maximum corresponds to

Many ways. One way is to use Ordering

  a = {1, 3, 4, 2, 9, 0, 2, 4}
  Ordering[a, -1]
  (*  {5} *)

So max is the 5th element. You also use Position[a, Max[a]]

POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard