Skip to main content

Math

Math task is used to perform arithmetic operations on the data. This task supports standard BODMAS expression with support for some inbuilt functions.

Quickstart

Let us start with the following data which is a score card of a group of students for three subjects:

StudentScienceFrenchEnglish
Alice786581
Bob458068
Jerry918090
Rachel353285

Complete the following steps to calculate the total number of Marks that the the students have received:

  1. Go to Transform > Numeric Functions.
  2. Select the Perform Math Functions function.
  1. In the expression box, build the expression: "Science" + "French" + "English".
  2. Enter "Total" into the new column box.
  3. Click APPLY.

The result will appear as shown below:

StudentScienceFrenchEnglishTotal
Alice786581224
Bob458068193
Jerry918090261
Rachel353285152

Supported Options

Math task takes the following inputs:

  • Apply result into: Using this you can apply the result into a new column. See result documentation.

Arithmetic Expression

Arithmetic expression accepted by the math tasks supports the following arithmetic operators. TODO+, -, *, /. These operands work on the following types of operands.

  1. Numbers
  2. Columns
  3. Functions such as count, sum, avg. See Functions
  4. Nested expression

Examples:

Let us assume that your original data is as shown below:

StudentScienceFrenchEnglish
Alice786581
Bob458068
Jerry918090
Rachel353285

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 if back. The expression will work if it is valid.

The criterion for valid expression are:

  1. Referring to the correct column names.
  2. The braces are correctly opened, and
  3. The functions used (such as SUM, COUNT) and so on, should have the correct parameters. See documentation for the functions and their parameters.

Expressions can be nested inside one another using parentheses. The following expressions are valid.

  • (10 + 20)/(20 + 40)
  • (10 - (20 + 40 * (100 -55)) + 20)
  • (10 * (20 + 40) + 20)/("Science" + 10)

You can nest to as many levels. However, it is simpler to add more than one math rule at time 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:

FunctionDescription
COUNTThis function returns the total row count of the dataset.
SUMThis function returns the sum of a given numeric column.
AVGThis function returns the average of a given numeric column.
MINThis function returns the minimum value of a given numeric column.
MAXThis function returns the maximum value of a given numeric column.
STTDDEVThis function returns the standard deviation of the values of a given numeric column.
VARIANCEThis function returns the variance of the values of a given numeric column.
INTThis function returns the integer part of the input given to it. For example INT(3.1) = 3, INT(3.9) = 3 This function is supported only in the Math Task. It can be applied on any Arithmetric Expression.
ABSThis function returns the absolute (positive) value of a given numeric column. ABS = mod(value) = , that is, ABS(-1) = 1

Handling empty values

When performing TODO+ - * / operations empty values are treated as if they are zeroes.

Division by zero

Division by zero leads to empty values.