This site is supported by donations to The OEIS Foundation.

Template:Min/doc

From OeisWiki
Jump to: navigation, search

This documentation subpage contains instructions, categories, or other information for Template:Min. [<Edit> Template:Min]

[⧼Purge⧽ Template:Min/doc]

The {{min}} mathematical function template gives the minimum of one to three numbers or mathematical expressions. (For more than three arguments, use {{MIN}} instead.)

Usage

To use it, enter

{{min|input1}} (trivial case)

or

{{min|input1|input2}}

or

{{min|input1|input2|input3}}

Valid input

One to three numbers or mathematical expressions as arguments.

Examples

Examples with valid input

Code Result
{{min|7|2|15}} 2
{{min|2|-7|-15}} -15
{{min|-7|2|-15}} -15
{{min|2|-15|-7}} -15
{{min|-7|-15|2}} -15
{{min|-15|2|-7}} -15
{{min|-15|-7|2}} -15
{{min|34|-3}} -3
{{min|-34|-3}} -34
{{min|-34}} -34
{{min|3^3|31|5^2}} 25
{{min|5^2|3^3}} 25
{{min|3^3}} 27

Examples with invalid input

Code Result
{{min}} Min error: One to three unformatted numbers required as arguments
{{min|one}} Min error: One to three unformatted numbers required as arguments
{{min|34|-3 blobs}} Min error: One to three unformatted numbers required as arguments
{{min|34|blobs}} Min error: One to three unformatted numbers required as arguments
{{min|7|blob|15}} Min error: One to three unformatted numbers required as arguments
{{min|7|15|blob}} Min error: One to three unformatted numbers required as arguments
{{min|34|-3,000}} Min error: One to three unformatted numbers required as arguments
{{min|7|2|15|40}} Min error: Too many arguments, try {{MIN}} instead

Code


<noinclude>{{Documentation}}</noinclude><includeonly><!--
-->{{ifnum| {{{1}}}
| {{#if: {{{2|}}} 
  | {{ifnum| {{{2}}}  
    | {{#if: {{{3|}}} 
      | {{ifnum| {{{3}}}   
        | {{#ifexpr: ( {{{1}}} ) < ( {{{2}}} ) 
          | {{#ifexpr: ( {{{1}}} ) < ( {{{3}}} ) 
            | {{#if: {{{4|}}} | {{error| Min error: Too many arguments, try {{tlxb|MIN}} instead }} | {{#expr: {{{1}}} }} }} 
            | {{#if: {{{4|}}} | {{error| Min error: Too many arguments, try {{tlxb|MIN}} instead }} | {{#expr: {{{3}}} }} }}
            }} 
          | {{#ifexpr: ( {{{2}}} ) < ( {{{3}}} ) 
            | {{#if: {{{4|}}} | {{error| Min error: Too many arguments, try {{tlxb|MIN}} instead }} | {{#expr: {{{2}}} }} }} 
            | {{#if: {{{4|}}} | {{error| Min error: Too many arguments, try {{tlxb|MIN}} instead }} | {{#expr: {{{3}}} }} }}
            }}
          }} 
        | {{error| Min error: One to three [[unformatted numbers]] required as arguments }} 
        }}
      | {{#ifexpr: ( {{{1}}} ) < ( {{{2}}} ) 
        | {{#expr: {{{1}}} }} 
        | {{#expr: {{{2}}} }}
        }}
      }}  
    | {{error| Min error: One to three [[unformatted numbers]] required as arguments }} 
    }}  
  | {{#expr: {{{1}}} }}  
  }} 
| {{error| Min error: One to three [[unformatted numbers]] required as arguments }} 
}}</includeonly>

See also

  • {{min}} minimum of one to three expressions yielding numbers
  • {{max}} maximum of one to three expressions yielding numbers


  • {{MIN}} minimum of one to eighty-one expressions yielding numbers
  • {{MAX}} maximum of one to eighty-one expressions yielding numbers


  • Core function templates (used ONLY by {{MIN}}; do NOT use directly!)
    • {{~Min3}} (should be used for up to three numbers or mathematical expressions)
    • {{~Min9}} (should be used for four to nine numbers or mathematical expressions)
    • {{~Min27}} (should be used for ten to twenty-seven numbers or mathematical expressions)
    • {{~Min81}} (should be used for twenty-eight to eighty-one numbers or mathematical expressions)


  • Core function templates (used ONLY by {{MAX}}; do NOT use directly!)
    • {{~Max3}} (should be used for up to three numbers or mathematical expressions)
    • {{~Max9}} (should be used for four to nine numbers or mathematical expressions)
    • {{~Max27}} (should be used for ten to twenty-seven numbers or mathematical expressions)
    • {{~Max81}} (should be used for twenty-eight to eighty-one numbers or mathematical expressions)