Commands Reference
This is a complete overview of the math commands available for scripting in Algebrakit. Click a command for more information.
Constructs
| Command | Description |
|---|---|
For |
For executes a script block once for each element of a list. |
If |
If checks a condition and executes a script block based on the result. |
While |
While executes a script block repeatedly, as long as a condition holds. |
List Commands
| Command | Description |
|---|---|
CartesianProduct |
CartesianProduct returns all pairs of an element of the first list and an element of the second list. |
Concat |
Concat joins lists and expressions into a single list. |
ConstantArray |
ConstantArray creates a list containing n copies of a given value. |
Difference |
Difference returns a copy of the first list, with the elements of the other lists removed. |
DifferenceI |
DifferenceI returns the indices of the elements of the first list that remain when the elements of the second list are removed. |
Elm ([[ ]]) |
Elm returns the element at a given position of a list or expression, as in L[[2]]. |
FindI |
FindI returns the position of the first occurrence of an expression in a list. |
Flatten |
Flatten removes nested lists, putting all elements in one list. |
ImplicitList |
ImplicitList displays expressions as a comma-separated list, without curly braces. |
Intersect |
Intersect returns the elements of the first list that also occur in all other lists. |
IntersectI |
IntersectI returns the indices of the elements of the first list that also occur in all other lists. |
Length |
Length returns the number of elements in a list. |
Map |
Map applies a given function or mapping to each element of a given list. |
Max |
Max returns the largest value in a list. |
MaxI |
MaxI returns the index of the largest value in a list. |
Min |
Min returns the smallest value in a list. |
MinI |
MinI returns the index of the smallest value in a list. |
Range |
Range creates a list of evenly spaced numbers. |
RemoveAllFromList |
RemoveAllFromList returns a copy of a list with all occurrences of the given elements removed. |
RemoveI |
RemoveI returns a copy of a list with the elements at the given positions removed. |
Replace |
Replace replaces the elements at the given positions of a list. |
Select |
Select returns all parts of an expression that satisfy a condition. |
SelectI |
SelectI returns the positions of the elements of a list that satisfy a condition. |
SelectStrictI |
SelectStrictI returns the positions of the elements of a list that certainly satisfy a condition. |
Shuffle |
Shuffle returns a copy of a list in a random order. |
Sort |
Sort returns a copy of a list sorted in ascending numerical order. |
SortAlphabetical |
SortAlphabetical returns a copy of a list sorted in alphabetical order of the variable names. |
SortAlphabeticalI |
SortAlphabeticalI returns the positions of the elements of a list, in alphabetical order of the variable names. |
SortI |
SortI returns the indices of the elements of a list, in the order that sorts the list ascending. |
Tally |
Tally counts how often each element occurs in a list. |
Unique |
Unique returns a copy of a list without duplicates. |
Math Commands
| Command | Description |
|---|---|
Approximate |
Approximate rounds a numerical value to n decimals, and keeps track of the rounding. |
CalcAbs |
CalcAbs returns the absolute value of a number. |
CalcArcCos |
CalcArcCos calculates the inverse cosine of a number as an angle, in radians or degrees. |
CalcArcSin |
CalcArcSin calculates the inverse sine of a number as an angle, in radians or degrees. |
CalcArcTan |
CalcArcTan calculates the inverse tangent of a number as an angle, in radians or degrees. |
CalcCombination |
CalcCombination returns the number of ways to choose k items from a set of n items. |
CalcCos |
CalcCos calculates the cosine of a number as a decimal number. |
CalcDivision |
CalcDivision returns the result of dividing two numbers, if it can be calculated exactly. |
CalcDivisors |
CalcDivisors returns all positive divisors of an integer, in ascending order. |
CalcFactorial |
CalcFactorial returns the factorial n! of a non-negative integer. |
CalcGcd |
CalcGcd returns the greatest common divisor of integers. |
CalcLcm |
CalcLcm returns the least common multiple of integers. |
CalcLog |
CalcLog calculates the logarithm of a number with a given base, if the result is exact. |
CalcPlus |
CalcPlus returns the sum of numbers. |
CalcPower |
CalcPower returns a number raised to a power, if it can be calculated exactly. |
CalcSin |
CalcSin calculates the sine of a number as a decimal number. |
CalcTimes |
CalcTimes returns the product of numbers. |
Calculate |
Calculate calculates the numbers in an expression with the Calc commands. |
Ceil |
Ceil rounds a value up to the nearest integer, or to a given number of decimals. |
DecimalToFraction |
DecimalToFraction returns the simplest fraction with the same value as a decimal number. |
Denominator |
Denominator returns the denominator of a fraction. |
EqualsEval |
EqualsEval (==) checks if two expressions are equal, and returns True or False. |
Factorial |
Factorial represents the factorial n!. |
FactorInt |
FactorInt returns the prime factorisation of a positive integer. |
Floor |
Floor rounds a value down to the nearest integer, or to a given number of decimals. |
Greater |
Greater (>) represents the 'greater than' relation; >> checks it. |
GreaterEqual |
GreaterEqual (>=) represents the 'greater than or equal to' relation; >== checks it. |
IsMatch |
IsMatch checks if two expressions are equal, using a given comparison method. |
Mod |
Mod returns the remainder when dividing two integers. |
Negative |
Negative applies the minus sign to an expression. |
Numerator |
Numerator returns the numerator of a fraction. |
Numerical |
Numerical returns the approximate numerical value of an expression, optionally rounded to a number of decimals. |
Precision |
Precision returns the number of significant digits of a number with a precision. |
PrecisionConstant |
PrecisionConstant represents a number rounded to n decimals, which also stands for all values that round to it. |
Round |
Round rounds a value to the nearest integer. |
Smaller |
Smaller (<) represents the 'smaller than' relation; << checks it. |
SmallerEqual |
SmallerEqual (<=) represents the 'smaller than or equal to' relation; <== checks it. |
UnequalsEval |
UnequalsEval (<<>>) checks if two expressions are different, and returns True or False. |
Randomisation Commands
| Command | Description |
|---|---|
RandomInt |
RandomInt randomly selects one or more integers from a range. |
RandomSample |
RandomSample randomly selects n different elements from a list. |
RandomSelect |
RandomSelect randomly selects one or more elements from a list. |
RandVars |
RandVars randomly selects n different variable names. |
Shuffle |
Shuffle returns a copy of a list in a random order. |
Vectors
| Command | Description |
|---|---|
BaseVector |
BaseVector represents a vector in basis form, ai + bj. |
PolarVector |
PolarVector represents a vector in polar form, given by its magnitude and direction. |
Vector |
Vector represents a coordinate or vector with the given components. |
VectorHarpoon |
VectorHarpoon displays an expression as a vector, with an arrow above it. |
Miscellaneous
| Command | Description |
|---|---|
Apply |
Apply replaces the outer operation of an expression with another function. |
CreateMapping |
CreateMapping creates a mapping, also when the variable or the expression comes from a script variable. |
FuncApplication |
FuncApplication evaluates a function or mapping for an input value. |
FuncIf |
FuncIf returns one of two expressions, depending on a condition. |
Hold |
Hold keeps an expression unexecuted, so that the commands in it are executed later. |
OrderAs |
OrderAs puts the terms of an expression in the same order as in a template expression. |
Quantity |
Quantity represents a value with a unit (e.g. meters, euros, minutes). |
RemoveFunction |
RemoveFunction removes all occurrences of a given function from an expression. |
Simplify |
Simplify fully simplifies an expression, executing any task commands in it. |
Strict |
Strict returns True only if a condition is certainly true, and False otherwise. |
Substitute |
Substitute replaces all occurrences of an expression with another expression. |
Type |
Type returns the type of an expression, typically to check it in a condition. |