WOLFRAM COMMUNITY
Connect with users of Wolfram technologies to learn, solve problems and share ideas
Join
Sign In
Dashboard
Groups
People
Message Boards
Answer
(
Unmark
)
Mark as an Answer
WOLFRAM COMMUNITY
Dashboard
Groups
People
1
|
9871 Views
|
2 Replies
|
3 Total Likes
View groups...
Follow this post
Share
Share this post:
GROUPS:
Mathematics
Physics
Mathematica
How to extract the position of a minimum value in a vector or a Matrix
Raffaele Santagati
Raffaele Santagati, University of Bristol
Posted
12 years ago
Hello everybody,
I have been tryin to find a solution to this on the support page or on line but I didn't.
I am generating a list of numbers between 0 and 1, using a cicle and a function I wrote . Because I am trying to solve an optimization process I need to extract the smallest of this number (and this is easy using the function Min
) but I don't know how to extract the position of the minimum, in what position of the array the minimum value is stored.
So if list={0.1,0.03,0,4} The result of Min
=0.03 How can I get the fact that the smallest value is in position 2 of the array list[[2]]??
I need this information because will give me what parameters that generated that minimum value.
Hope that it is clear.
Please could somebody help with this?
CHeers
POSTED BY:
Raffaele Santagati
Reply
|
Flag
2 Replies
Sort By:
Replies
Likes
Recent
1
Jeremy Michelson
Jeremy Michelson, Wolfram|Alpha
Posted
12 years ago
You can also use Ordering.
In[205]:= Ordering[{0.1, 0.03, 0, 4}, {1}]
Out[205]= {3}
(because the Min is actually 0, because 0 < 0.03).
POSTED BY:
Jeremy Michelson
Reply
|
Flag
1
Raffaele Santagati
Raffaele Santagati, University of Bristol
Posted
12 years ago
I just find a solution.
The command Position can do that.
For further information
http://reference.wolfram.com/mathematica/ref/Position.html
I
t is so easy! I love mathematica!
POSTED BY:
Raffaele Santagati
Reply
|
Flag
Reply to this discussion
in reply to
Add Notebook
Community posts can be styled and formatted using the
Markdown syntax
.
Tag limit exceeded
Note: Only the first five people you tag will receive an email notification; the other tagged names will appear as links to their profiles.
Publish anyway
Cancel
Reply Preview
Attachments
Remove
Add a file to this post
Follow this discussion
or
Discard
Group Abstract
Be respectful. Review our
Community Guidelines
to understand your role and responsibilities.
Community Terms of Use
Feedback