Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

picking up the minimum values

Status
Not open for further replies.

metallicmanuel

Structural
Joined
May 28, 2008
Messages
1
Location
NO
Hi
I have recently started to use Mathcad 14.

I would like to pick out the minimum value from a set and that value should not be a negative value, i need the least positive integer.
for example
say a set A= (-10 , 2, 4 ,5)
the answer I want is 2 and not -10 which is actually the minimum value.

I tried using the command min(....) but this picks up the least of all integers mentioned in the set
thanks
 
How about taking the minimum of the absolute values of the elements of your array?
 
UcfSE: in the case of the given example, applying absolute values would work, but if the absolute value of any negative value is lower than a positive value, the answer will be incorrect.

I have also attached an alternate solution that should work for both the given example and any other set of values. Good luck!
 
 http://files.engineering.com/getfile.aspx?folder=f507f04c-4527-45ef-ad3a-ec6d31f9f30a&file=solution.bmp
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top