Skip to content
Property Value
Hex Value $19
Categories
Localizations
  • FR: max(

max(

Overview

Returns the larger of valueA and valueB.

Availability: Token available everywhere.

Syntax

max(valueA,valueB)

Arguments

NameTypeOptional
valueA
valueB

Location

math, NUM, 7:max(


Overview

Returns the larger of valueA and valueB.

Availability: Token available everywhere.

Syntax

max(list)

Arguments

NameTypeOptional
listlist

Location

math, NUM, 7:max(


Overview

Returns largest real or complex element in list.

Availability: Token available everywhere.

Syntax

max(list)

Arguments

NameTypeOptional
listlist

Location

2nd, list, MATH, 2:max(


Overview

Returns a real or complex list of the larger of each pair of elements in listA and listB.

Availability: Token available everywhere.

Syntax

max(listA,listB)

Arguments

NameTypeOptional
listAlist
listBlist

Location

2nd, list, MATH, 2:max(


Overview

Returns a real or complex list of the larger of value or each list element.

Availability: Token available everywhere.

Syntax

max(value,list)

Arguments

NameTypeOptional
value
listlist

Location

2nd, list, MATH, 2:max(


Description

max(X,Y) returns the largest of the two numbers X and Y. max(list) returns the largest element of list. max(list1,list2) returns the pairwise maxima of the two lists. max(list1,X) (equivalently, max(X,list1)) returns a list whose elements are the larger of X or the corresponding element of the original list.

max(2,3)
     3
max({2,3,4})
     4
max({1,3},{4,2})
     {4 3}
max({1,3},2)
     {2 3}

Unlike comparison operators such as < and >, max( can also compare complex numbers. To do this, both arguments must be complex — either complex numbers or complex lists: max(2,𝑖) will throw an error even though max(2+0𝑖,𝑖) won't. In the case of complex numbers, the number with the largest absolute value will be returned. When the two numbers have the same absolute value, the first one will be returned: max(𝑖,-𝑖) returns 𝑖 and max(-𝑖,𝑖) returns -𝑖.

Advanced Uses

max( can be used in Boolean comparisons to see if at least one of a list is 1 (true) — useful because commands like If or While only deal with numbers, and not lists, but comparisons like L₁=L₂ return a list of values. In general, the behavior you want varies, and you will use the min( function or the max( function accordingly.

Using max( will give you a lenient test — if any one element of the list is 1 (true), then the max( of the list is true — this is equivalent to putting an or in between every element. For example, this tests if K is equal to any of 24, 25, 26, or 34 (the getKey arrow key values):

:If max(K={24,25,26,34
:Disp "ARROW KEY

To get the element of a real list in Ans with the greatest absolute value, use imag(max(𝑖Ans)) or max(abs(Ans)).

max( can be also used along with min( to constrain a value between a lower and upper number:

:max(-1,min(1,100)) // returns 1 because 1 is between -1 & 100
:max(-1,min(1,0)) // returns 0 because 1 is not between -1 & 0

where the bounds for which the number 1 must fall between are first argument of max( and the second argument of min( in the above code.

Error Conditions

  • ERR:DATA TYPE is thrown when comparing a real and a complex number. This can be avoided by adding +0𝑖 to the real number (or i^4 right after it, for those who are familiar with complex numbers)
  • ERR:DIM MISMATCH is thrown, when using max( with two lists, if they have different dimensions.

Source: parts of this page were written by the following TI|BD contributors: burr, coltonj96, DarkerLine, GoVegan, kg583, lirtosiast, Mapar007, simplethinker.

History

Calculator OS Version Description
TI-82 1.0 Added

Last update: September 30, 2023 15:38:51
Created: February 23, 2023 23:15:01
Authors: Adrien Bertrand