Evaluate a mathematical expression
Name | Type | Opt | Description |
---|---|---|---|
mathematical-expression | list | Obligatory. The argument is a mathematical expression, in a format resembling the C programming language. The expression is made up of numbers, arithmetic operators such as + or *, comparisons such as or , C functions such as or , names of table objects, and changeable arguments ( , , and ) for ints, floats, and symbols received in the inlets. | |
constant | int or float | Numbers can be used as constants in the mathematical expression. | |
inlet-format | $i or $f | A changeable int argument is specified by | or and an inlet number (example: ). The argument will be replaced by numbers received in the specified inlet.|
table-address-info (name and index) | $s | The argument table to be accessed. The argument should be immediately followed by a number in brackets specifying an address in the table. (Examples: or .) | and an inlet number is replaced by the name of a|
(other) | symbol | Arithmetic operators understood by expr are: , , , , %. Other operators are (one's complement), (bitwise exclusive or), , , , , and (not). Many C language math functions can be understood by expr. A function must be followed immediately by parentheses containing any arguments necessary to the function. If the function requires a comma between arguments, the comma must be preceded by a backslash ( ) so that Max will not be confused by it. For example: . C language functions understood by expr are: abs, min, max, sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, int (convert to integer), float (convert to float), pow, sqrt, fact (factorial), exp (power of e to x), log10 (log), ln or log (natural log), and random. Additional functions can be added by means of external code resources placed in Max's startup folder. |
bang | In left inlet: Evaluates the expression using the values currently stored. | |
int | input [int] |
The number received in each inlet will be stored in place of the | or argument associated with it. (Example: The number in the second inlet from the left will be stored in place of the and arguments, wherever they appear.)
(inlet1) | input [int] |
Performs the same function as the | message. See above.
(inlet2) | input [int] |
Performs the same function as the | message. See above.
(inlet3) | input [int] |
Performs the same function as the | message. See above.
(inlet4) | input [int] |
Performs the same function as the | message. See above.
(inlet5) | input [int] |
Performs the same function as the | message. See above.
(inlet6) | input [int] |
Performs the same function as the | message. See above.
(inlet7) | input [int] |
Performs the same function as the | message. See above.
(inlet8) | input [int] |
Performs the same function as the | message. See above.
(inlet9) | input [int] |
Performs the same function as the | message. See above.
float | input [float] |
The number in each inlet will be stored in place of the | or argument associated with it. The number will be truncated by a argument.
(inlet1) | input [float] |
Performs the same function as the | message. See above.
(inlet2) | input [float] |
Performs the same function as the | message. See above.
(inlet3) | input [float] |
Performs the same function as the | message. See above.
(inlet4) | input [float] |
Performs the same function as the | message. See above.
(inlet5) | input [float] |
Performs the same function as the | message. See above.
(inlet6) | input [float] |
Performs the same function as the | message. See above.
(inlet7) | input [float] |
Performs the same function as the | message. See above.
(inlet8) | input [float] |
Performs the same function as the | message. See above.
(inlet9) | input [float] |
Performs the same function as the | message. See above.
set | input [list] |
In left inlet: The word | , followed by one or more numbers, treats those numbers as if each had come in a different inlet, replacing the stored value with the new value, but the expression is not evaluated and nothing is sent out the outlet. If there are fewer numbers in the message than there are inlets, the stored value in each remaining inlet stays unchanged.
sm1 | table-name [list] |
Performs the same function as the | message. See above.
sm2 | table-name [list] |
Performs the same function as the | message. See above.
sm3 | table-name [list] |
Performs the same function as the | message. See above.
sm4 | table-name [list] |
Performs the same function as the | message. See above.
sm5 | table-name [list] |
Performs the same function as the | message. See above.
sm6 | table-name [list] |
Performs the same function as the | message. See above.
sm7 | table-name [list] |
Performs the same function as the | message. See above.
sm8 | table-name [list] |
Performs the same function as the | message. See above.
sm9 | table-name [list] |
Performs the same function as the | message. See above.
symbol | table-name [list] |
The word table, will be stored in place of the argument associated with that inlet, for accessing values stored in the table. | , followed by the name of a
list | input [list] |
In left inlet: The items of the list are treated as if each had come in a different inlet, and the expression is evaluated. If the list contains fewer items than there are inlets, the most recently received value in each remaining inlet is used. Any of the above messages in the left inlet will evaluate the expression and send out the result. If a value has never been received for each changeable argument, that value is considered 0 when the expression is evaluated. The number of inlets is determined by how many changeable arguments are typed in. The maximum number of inlets is 9. |
Name | Description |
---|---|
if | Conditional statement in if/then/else form |
vexpr | Evaluate a math expression for a list of different inputs |
round | Round to an input value |
Max Basic Tutorial 22: Designing Equations | Max Basic Tutorial 22: Designing Equations |