Math¶
Math task is used to perform arithmetic operations on the data. This task supports standard BODMAS expression with support for some inbuilt functions.
Table of Contents
Quick Start¶
Let us start with the following score card data
of a group of students:
Student 
Science 
French 
English 

Alice 
78 
65 
81 
Bob 
45 
80 
68 
Jerry 
91 
80 
90 
Rachel 
35 
32 
85 
Complete the following steps to calculate the total number of marks each student received:
Go to Transform > Numeric Functions
Select Perform Math Function
In the expression box, build the expression:
Science + French + English
Enter “Total” into the new column box
Click APPLY
The result will appear as shown below:
Student 
Science 
French 
English 
Total 

Alice 
78 
65 
81 
224 
Bob 
45 
80 
68 
193 
Jerry 
91 
80 
90 
261 
Rachel 
35 
32 
85 
152 
Supported Options¶
Math task takes the following inputs:
Expression: You can create an arithmetic expression.
Condition: Apply conditional filters to your operation. The result is applied only to rows satisfying the condition. Condition: See Condition for more information.
Apply result into: You can apply the result into a new or an existing column. See result documentation
Arithmetic Expression¶
Arithmetic expression in the math rule supports the following arithmetic operators  +, , *, /
. These operators work on the following types of operands:
Numbers
Columns
Functions such as Count, Sum, Avg. See Functions
Nested expression
Examples:
Let us assume that your original data is as shown below:
Student 
Science 
French 
English 

Alice 
78 
65 
81 
Bob 
45 
80 
68 
Jerry 
91 
80 
90 
Rachel 
35 
32 
85 
The valid expressions are:
2
3+4
“Science” + “French”
(“Science” + “French” + `”English”)/300
AVG(“Science”)  “Science”
INT((“Science” + “French” + `”English”)/3)
Note that the column names are put within a quoted string. The application shows hints to guide you to the right expression. If the expression is invalid, a warning is displayed at the bottom right of the expression box.
The expressions can be copied and pasted. You can paste an expression into a normal text editor like notepad, edit it and paste it back. The expression will work if it is valid.
The criteria for valid expression are:
Using the correct column names
Ensuring that all the braces are correctly opened and closed, and
Ensuring that functions such as SUM, COUNT, etc., are applied to valid columns.
Expressions can be nested inside one another using parentheses. Examples of valid expressions are:
(10 + 20)/(20 + 40)
(10  (20 + 40 * (100 55)) + 20)
(10 * (20 + 40) + 20)/(“Science” + 10)
You can nest up to as many levels. However, it is simpler to add more than one math rule at times to keep it simple and readable.
The results of the arithmetic expression is saved into a new column.
Numeric functions¶
Here is a list of numeric functions supported by Mammoth:
Function 
Description 

COUNT 
This function returns the total row count of the dataset. 
SUM 
This function returns the sum of a given numeric column. 
AVG 
This function returns the average of a given numeric column. 
MIN 
This function returns the minimum value of a given numeric column. 
MAX 
This function returns the maximum value of a given numeric column. 
STTDDEV 
This function returns the standard deviation of the values of a given numeric column. 
VARIANCE 
This function returns the variance of the values of a given numeric column. 
INT 
This function returns the integer part of the input given to it. For example

ABS 
This function returns the absolute (positive) value of a given numeric column. ABS = mod(value) = value, that is, ABS(1) = 1 
Handling empty values¶
When performing +  * /
operations empty values
are treated as if they are zeroes.