<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="expr" module="max" category="Math">
	<digest>
		Evaluate a mathematical expression
	</digest>
	<description>
		Evaluate an expression using a C-like language. Variables and operators are used to create output values.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			Math
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				Evaluate Expression, int $i1, float $f1, table $s1
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				int $i2, float $f2, table $s2
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				Expression Result
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="expression" optional="0" type="list">
			<digest>
				Mathematical expression
			</digest>
			<description>
				The argument to the <o>expr</o> object is a mathematical expression composed of numbers, arithmetic operators such as <o>+</o> or <o>*</o>, comparisons such as <m>&lt;</m> or <m>&gt;</m>, C functions such as <m>min ()</m> or <m>pow ()</m>, names of <o>table</o> objects, and changeable arguments (<m>$i</m>, <m>$f</m>, and <m>$s</m>) for ints, floats, and symbols received in the inlets.
			</description>
		</objarg>
		<objarg name="constant" optional="0" type="number">
			<digest>
				A numeric constant
			</digest>
			<description>
				Numbers can be used as constants in the mathematical expression.
			</description>
		</objarg>
		<objarg name="inlet-format" optional="0" type="symbol">
			<digest>
				Inlet format
			</digest>
			<description>
				Changeable arguments that specify data formats associated with an inlet are described using a combination of a data type (<m>$i</m> or <m>$f</m>) and an inlet number (example: <m>$i2</m>). The argument will be replaced by numbers received in the specified inlet.
			</description>
		</objarg>
		<objarg name="table-info" optional="0" type="$s">
			<digest>
				Table to access
			</digest>
			<description>
				Changeable arguments that specify accessing data from a table are described using the argument <m>$s</m> and an inlet number which is replaced by the name of a <o>table</o> to be accessed. The argument should be immediately followed by a number in brackets specifying an address in the <o> <b>table</b> </o>. (Examples: <m>$s2[7]</m> or <m>$s3[$i1]</m>.)
			</description>
		</objarg>
		<objarg name="(other)" optional="0" type="symbol">
			<digest>
				Arithmetic operator
			</digest>
			<description>
				The <o>expr</o> object understands the following arithmetic operators: <m>+</m>, <m>-</m>, <m>*</m>, <m>/</m>, %. Other operators are <m>~</m> (one's complement), <m>^</m> (bitwise exclusive or), <m>&amp;</m>, <m>&amp;&amp;</m>, <m>|</m>, <m>||</m>, and <m>!</m> (not).
			</description>
			<discussion>
				Many C language math functions can be understood by <o>expr</o>. 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 (<m>\</m>) so that Max will not be confused by it. For example: <m>pow ($i1\,2)</m>.				<br />
				<br />
				C language functions understood by <o>expr</o> 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.
			</discussion>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Evaluate with most recent values
			</digest>
			<description>
				In left inlet: Evaluates the expression using the values currently stored.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				The number received in each inlet will be stored in place of the <m>$i</m> or <m>$f</m> argument associated with it. (Example: The number in the second inlet from the left will be stored in place of the <m>$i2</m> and <m>$f2</m> arguments, wherever they appear.)
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				The number in each inlet will be stored in place of the <m>$f</m> or <m>$i</m> argument associated with it. The number will be truncated by a <m>$i</m> argument.
			</description>
		</method>
		<method name="ft1">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>float</m> listing.
			</description>
		</method>
		<method name="ft2">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>float</m> listing.
			</description>
		</method>
		<method name="ft3">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>float</m> listing.
			</description>
		</method>
		<method name="ft4">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>float</m> listing.
			</description>
		</method>
		<method name="ft5">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>float</m> listing.
			</description>
		</method>
		<method name="ft6">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>float</m> listing.
			</description>
		</method>
		<method name="ft7">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>float</m> listing.
			</description>
		</method>
		<method name="ft8">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>float</m> listing.
			</description>
		</method>
		<method name="ft9">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>float</m> listing.
			</description>
		</method>
		<method name="in1">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>int</m> listing.
			</description>
		</method>
		<method name="in2">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>int</m> listing.
			</description>
		</method>
		<method name="in3">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>int</m> listing.
			</description>
		</method>
		<method name="in4">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>int</m> listing.
			</description>
		</method>
		<method name="in5">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>int</m> listing.
			</description>
		</method>
		<method name="in6">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>int</m> listing.
			</description>
		</method>
		<method name="in7">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>int</m> listing.
			</description>
		</method>
		<method name="in8">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>int</m> listing.
			</description>
		</method>
		<method name="in9">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Replace an argument and evaluate
			</digest>
			<description>
				See the <m>int</m> listing.
			</description>
		</method>
		<method name="set">
			<arglist>
				<arg name="input" optional="0" type="list" />
			</arglist>
			<digest>
				&quot;Unpack&quot; a list and distribute it elements without evaluation
			</digest>
			<description>
				If the word <m>set</m> precedes the items of a list received in the left inlet, the list of numbers are treated as if each had come in a different inlet, replacing the stored value with the new value. However, 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.
			</description>
		</method>
		<method name="sm1">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				See the <m>symbol</m> listing
			</digest>
			<description>
				See the <m>symbol</m> listing.
			</description>
		</method>
		<method name="sm2">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				See the <m>symbol</m> listing
			</digest>
			<description>
				See the <m>symbol</m> listing.
			</description>
		</method>
		<method name="sm3">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				See the <m>symbol</m> listing
			</digest>
			<description>
				See the <m>symbol</m> listing.
			</description>
		</method>
		<method name="sm4">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				See the <m>symbol</m> listing
			</digest>
			<description>
				See the <m>symbol</m> listing.
			</description>
		</method>
		<method name="sm5">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				See the <m>symbol</m> listing
			</digest>
			<description>
				See the <m>symbol</m> listing.
			</description>
		</method>
		<method name="sm6">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				See the <m>symbol</m> listing
			</digest>
			<description>
				See the <m>symbol</m> listing.
			</description>
		</method>
		<method name="sm7">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				See the <m>symbol</m> listing
			</digest>
			<description>
				See the <m>symbol</m> listing.
			</description>
		</method>
		<method name="sm8">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				See the <m>symbol</m> listing
			</digest>
			<description>
				See the <m>symbol</m> listing.
			</description>
		</method>
		<method name="sm9">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				See the <m>symbol</m> listing
			</digest>
			<description>
				See the <m>symbol</m> listing.
			</description>
		</method>
		<method name="symbol">
			<arglist>
				<arg name="table" optional="0" type="list" />
			</arglist>
			<digest>
				Access values stored in a table
			</digest>
			<description>
				The word <m>symbol</m>, followed by the name of a <o>table</o>, will be stored in place of the <m>$s</m> argument associated with that inlet, for accessing values stored in the <o>table</o> object.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="input" optional="0" type="list" />
			</arglist>
			<digest>
				&quot;Unpack&quot; a list, distribute elements, and evaluate
			</digest>
			<description>
				The items of a list received in the left inlet 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.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<!--EXAMPLE-->
	<examplelist>
		<example img="expr.png" caption="Combine many calculations into one object, even using functions not available in other objects" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="if" />
		<seealso name="vexpr" />
		<seealso name="round" />
		<seealso name="basicchapter22" module="max" type="tutorial" />
	</seealsolist>
	<discussion>
		Use the <o>expr</o> object to perform mathematical calculations using C language-style mathematical operations. The object evaluates expressions that use the &quot;variables&quot; $i1-$i9 (the first to ninth inlets, taken as integers), $f1-$f9 (the inlets as floats) and $s1-$s9 (the inlets as symbols), and/or constants of the same types. The operators are +, -, *, /, &amp;, |, &amp;&amp;, ||, !, ~, and ^, and you can also use a set of predefined mathematical and statistical functions. The list of functions in expr are as follows: min, max, int (convert to integer), float (convert to float), pow (power), sqrt (square root), exp (power of e to x), log10 (log), ln (natural log), log (nat. log), sin, cos, tan, asin (arcsin), acos, atan, atan2, sinh, cosh, tanh, fact (factorial), random, size (size of a table), sum (sum of table contents), Sum (sum with boundaries), avg (of table contents), Avg (avg with boundaries), store (store into a table).
	</discussion>
	<misc name="Output">
		<entry name="int">
			<description>
				The output is the result of the evaluated expression.
			</description>
		</entry>
		<entry name="float">
			<description>
				The output is the result of the evaluated expression.
			</description>
		</entry>
	</misc>
</c74object>
