Find Maximum Value in a Set of Numbers

  • Context: High School 
  • Thread starter Thread starter xeon123
  • Start date Start date
  • Tags Tags
    Expression Max
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
xeon123
Messages
90
Reaction score
0
How do I put down an expression that means the maximum value of a set of numbers?
 
Mathematics news on Phys.org
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.