Mathematical Primitives
Basic Functions¶
| Primitive | Description |
|---|---|
| Plus | Operator +x, identifies a number as positive |
| Minus | Operator -x, identifies a number as negative |
| Add | Operator x+y, numeric or matrix addition |
| Subtract | Operator x-y, numeric or matrix subtraction |
| Increment | Operator x++, ++x, increments a stored value |
| Decrement | Operator x--, --x, decrements a stored value |
| Multiply | Operator x*y, numeric multiplication |
| Divide | Operator x/y, numeric division |
| Power | Operator x^y, x raised to the power y |
| Factorial | Operator x!, factorial of a number |
| Percent | Operator x%, divide by 100 |
| Remainder | Operator x%y, remainder of x/y |
| sqrt | Square root |
| exp | Exponential (E^x) |
| safeexp | Exponential (E^x), with a trap to prevent overflow |
| log | Natural logarithm (base E) |
| log10 | Common logarithm (base 10) |
| E | 2.71828 |
| abs | Absolute value (magnitude for complex numbers) |
| round | Rounds a number to a given number of decimals |
| floor | Integer value of a number rounded down |
| ceil | Integer value of a number rounded up |
| integer | Integer value rounded towards zero |
| infinity | Infinity |
| cnorm | Cumulative normal distribution |
| gamma | Gamma function |
| gammaln | Log of the Gamma function |
Trigonometric¶
| Primitive | Description |
|---|---|
| sin | Sine |
| cos | Cosine |
| tan | Tangent |
| asin | Arc sine |
| acos | Arc cosine |
| atan | 2-quadrant arc tangent |
| atan2 | 4-quadrant arc tangent |
| PI | 3.14159 |
Random Numbers¶
| Primitive | Description |
|---|---|
| rand | Pseudo-random number from a uniform distribution |
| drand | Pseudo-random number from a discrete distribution |
| trand | Pseudo-random number from a triangular distribution |
| nrand | Pseudo-random number from a normal distribution |
| lrand | Pseudo-random number from a lognormal distribution |
| brand | Pseudo-random number from a binomial distribution |
| prand | Pseudo-random number from a Poisson distribution |
| grand | Pseudo-random number from a gamma distribution |
| wrand | Pseudo-random number from a Weibull distribution |
| betarand | Pseudo-random number from a beta distribution |
| crand | Pseudo-random number from a custom distribution |
| setrand | Seeds the random number generators |
| correlate | Causes random inputs to be correlated |
Complex Numbers¶
| Primitive | Description |
|---|---|
| I | Unit imaginary number |
| abs | Absolute value (magnitude for complex numbers) |
| arg | The argument or angle of a complex number |
| real | The real portion of a complex number |
| imag | The imaginary portion of a complex number |
Units of Measure¶
| Primitive | Description |
|---|---|
| hasunits | Returns true if a value has units of measure |
| nounits | Evaluates an expression without unit processing |
| reduceunits | Number without units as it would display in the current unit system |
| stripunits | Number with all units of measure removed |
| unitsof | Units of measure applied to a value |
Iterative¶
| Primitive | Description |
|---|---|
| sigma | Summation of a function between specified limits |
| root | Root, or zero, of a function |
| integral | Definite integral of a function |
| derivative | Partial derivative of a function |
Matrices¶
| Primitive | Description |
|---|---|
| Add | Operator x+y, numeric or matrix addition |
| Subtract | Operator x-y, numeric or matrix subtraction |
| Multiply | Operator x*y, numeric multiplication |
| Power | Operator x^y, x raised to the power y |
| determinant | Determinant of a matrix |
| trans | Transpose of a matrix |
| tableform | Table representation of a matrix |
Regression¶
| Primitive | Description |
|---|---|
| linefit | Coefficients of a general linear regression |
| stderror | Standard error for each coefficient in a regression analysis |
| rsquared | R-squared measure of fit for a regression line |
Simultaneous equations¶
| Primitive | Description |
|---|---|
| solve | Solution to a set of simultaneous linear equations |
Optimization¶
| Primitive | Description |
|---|---|
| minimize | Minimum of a function of one variable |
| simplex | Linear optimization of a function of many variables |
| simplex2 | Linear optimization of a function of many variables |
| mxsimplex | Linear program optimization based on matrix input data |
| readsimplex | Imports comma-delimited data and performs a linear optimization |
Fourier Transforms¶
| Primitive | Description |
|---|---|
| fft | Fast Fourier Transform |
| invfft | Inverse Fast Fourier Transform |
Bitwise¶
| Primitive | Description |
|---|---|
| Left Shift | Operator x<<y, shifts bits in a number left |
| Right Shift | Operator x>>y, shifts bits in a number right |
| Zero-Fill Right Shift | Operator x>>>y, shifts bits in a number right with sign |
| Bitwise And | Operator x&y, AND of all bits in x and y |
| [Bitwise Or](../../../manual/supply-chain-planning/concept/primitives/all.md#bitwise_or "Operator x | y, OR of all bits in x and y") |
| Bitwise Exclusive Or | Operator x~y, Exclusive OR of all bits in x and y |
| Bitwise Not | Operator ~x, inverts all bits in x |