Find Maximum Value in a Set of Numbers

  • Level: High School 
  • Thread starter xeon123
  • Start date
  • Tags Tags
    Expression Max
1 reply · 2K views · last reply
xeon123
Messages
90
Reaction score
0
How do I put down an expression that means the maximum value of a set of numbers?
 
xeon123 said:
How do I put down an expression that means the maximum value of a set of numbers?

Hey xeon123.

Typically we write the expression as y = max(x1,x2,x3,...) in notational terms.

One way to write this is to use Heaviside functions where H(x) = 0 for x < 0 and 1 otherwise. If you want to just use a computer though then you can either sort a list and get the last element or implement an optimized routine that does the minimal number of compares to get the answer.