# Transform - Tiles: Arithmetic

The Arithmetic template appears in the template list when a raster tile field, of type Tile, has been picked in the Transform pane.  The template computes basic arithmetic operations.

 Arithmetic Basic arithmetic operations, allowing choice of Channel in multichannel raster images, automatically providing choice of a second parameter, specified in the Value box and typically allowing a field, a specific value, or an expression, for operations that use an additional parameter.   Save the result into the specified Result destination using the specified numeric type.   absolute value (abs) - Compute the absolute value of pixel values in the source channel.  Absolute value leaves positive numbers unchanged and converts negative numbers into their positive equivalents.    add (+) - Add the Value to pixel values in the source channel. cube - Compute the cube of pixel values in the source channel. cube root (cbrt) - Compute the cube root of pixel values in the source channel. divide (/) - Divide pixel values in the source channel by the Value. divide integral (div) - Divide pixel values in the source channel by the Value and discard any fractional part. divide remainder (mod) - A classic modulo operation (the remainder (of a congruence) function): Divide pixel values in the source channel by the Value and retain only the fractional part as a non-fractional whole number. error (erf) - Compute the error function (also called erf(z) ) of pixel values in the source channel.   error complement (erfc) - Compute the complementary error function (also called erfc(z) ) of pixel values in the source channel. exponent (exp) - The exponential function: Compute e to the power of the source field number.   For anything but relatively small numbers in the source field such exponentiation results in numbers larger than can be represented in most types and thus returns a NULL.    exponent binary (exp2) - Also known as the power of 2: Compute 2 to the power of pixel values in the source channel.  If the source field has values 1, 2, 3,... the result of a binary exponentiation will be 2, 4, 8,....   For anything but relatively small numbers in the source field such exponentiation results in numbers larger than can be represented in most types and thus returns a NULL.    exponent decimal (exp10) - Also known as the power of 10: Compute 10 to the power of pixel values in the source channel.  If the source field has values 1, 2, 3,... the result of a decimal exponentiation will be 10, 100, 1000,....   For anything but relatively small numbers in the source field such exponentiation results in numbers larger than can be represented in most types and thus returns a NULL.    gamma (tgamma) - Compute the gamma function of pixel values in the source channel.   gamma logarithm (lgamma) - Compute the natural logarithm of the gamma function of pixel values in the source channel.  logarithm (log) - Compute the base e logarithm (also called the natural logarithm) of pixel values in the source channel. logarithm binary (log2) - Compute the base 2 logarithm (also called the binary logarithm) of pixel values in the source channel. logarithm decimal (log10) - Compute the base 10 logarithm (also called the common logarithm) of pixel values in the source channel. multiply (*) - Multiply pixel values in the source channel by the Value number. power (pow) - Compute the source field to the power of the specified Value.  A power of 1 is pixel values in the source channel unchanged, a power of 2 is pixel values in the source channel squared, and a power of 3 is pixel values in the source channel cubed. reciprocal - One divided by pixel values in the source channel.  The reciprocal is also pixel values in the source channel to the power of -1, another way of saying the same thing. The reciprocal of zero is undefined, and thus returns a NULL. sign (sign) - Report if pixel values in the source channel are positive (return 1) or negative (return -1).   The sign of zero is 0. sign invert - Multiply pixel values in the source channel by -1, thus inverting the sign of the pixel value   square - Compute the square of pixel values in the source channel (the pixel value multiplied by itself). square root (sqrt) - Compute the square root of pixel values in the source channel. subtract (-) -  Subtract the Value from pixel values in the source channel. subtract from (-) - Subtract pixel values in the source channel from the Value.   Launch the template by choosing a Tile field and then double-clicking the Arithmetic template.  When the template launches we can specify options. Arithmetic : absolute value Take the absolute value of the tile pixel value in the source field and save into the specified Result destination. Absolute value leaves positive numbers unchanged and converts negative numbers into their positive equivalents. Arithmetic : add (+) Add the specified Value to pixel values in the source channel and save the result into the specified Result destination. Useful for increasing the level of terrain elevation data. With the focus on the Elevation Raster image, in the Transform pane we choose the Tile field and then the Arithmetic template. In the Arithmetic template, we choose channel 0 for the Channel and add (+) as the Operation.  We enter 100 as the Value.     For the Result destination, we choose New Field and then enter Tile result as the name of the new tile field to add to the table.  For the new image name we enter Elevation result.   We could use whatever names we want for the names of the new tile and image, but it is wise to use names that remind us of what they are supposed to be.   Press Transform.     A new image called Elevation result appears in the Project pane.   We drag and drop the new Elevation result image into the Elevation Raster window as a layer.  To style the new image the same as the original Elevation Raster image, we copy the StylePixel property from the Elevation Raster image to the Elevation result image.   Comparing the original image to the result:  Compared to the original image, the effect is the equivalent of lifting the terrain 100 units (in this case, feet). Arithmetic : cube Compute the cube of pixel values in the source channel, and save into the specified Result destination. Arithmetic : cube root (cbrt) Compute the cube root of pixel values in the source channel and save into the specified Result destination. Arithmetic : divide (/) Divide the source field by the specified value and save the result into the specified Result destination.  Useful for decreasing vertical scale in terrain elevation data. With the focus on the Elevation Raster image, in the Transform pane we choose the Tile field and then the Arithmetic template. In the Arithmetic template, we choose channel 0 for the Channel and divide (/) as the Operation.  We enter 2 as the Value.     For the Result destination, we choose New Field and then enter Tile result as the name of the new tile field to add to the table.  For the new image name we enter Elevation result.   We could use whatever names we want for the names of the new tile and image, but it is wise to use names that remind us of what they are supposed to be.   Press Transform.     A new image called Elevation result appears in the Project pane.   We drag and drop the new Elevation result image into the Elevation Raster window as a layer.  To style the new image the same as the original Elevation Raster image, we copy the StylePixel property from the Elevation Raster image to the Elevation result image.   Comparing the original image to the result:  The terrain heights become lower and less steep. Arithmetic : divide integral (div) Divide pixel values in the source channel by the Value and discard any fractional part.   Formerly known as Divide and Truncate. Arithmetic : divide remainder (mod) A classic modulo operation (the remainder (of a congruence) function): Divide pixel values in the source channel by the Value and retain only the fractional part as a non-fractional whole number.  Formerly known as Modulo.   To get just the fractional part of a number use divide remainder (mod) with a Value of 1. Arithmetic : error (erf) Compute the error function (also called erf(z) ) of pixel values in the source channel and save into the specified Result destination. Arithmetic : error complement (erfc) Compute the complementary error function (also called erfc(z) ) of pixel values in the source channel and save into the specified Result destination. Arithmetic : exponent (exp) Compute the exponential function: Take e to the power of pixel values in the source channel and save into the specified Result destination. For anything but small numbers in the source field such exponentiation very rapidly results in numbers larger than can be represented in numeric data types and thus stores a NULL in the target. Arithmetic : exponent binary (exp2) Also known as the power of 2: Compute 2 to the power of pixel values in the source channel and save into the specified Result destination.  If the source field has values 1, 2, 3,... the result of a binary exponentiation will be 2, 4, 8,....   For anything but relatively small numbers in the source field such exponentiation results in numbers larger than can be represented in most types and thus returns a NULL. Arithmetic : exponent decimal (exp10) Also known as the power of 10: Compute 10 to the power of pixel values in the source channel and save into the specified Result destination.  If the source field has values 1, 2, 3,... the result of a decimal exponentiation will be 10, 100, 1000,....   For anything but relatively small numbers in the source field such exponentiation results in numbers larger than can be represented in most types and thus returns a NULL. Arithmetic : gamma (tgamma) Compute the gamma function of pixel values in the source channel and save into the specified Result destination. Arithmetic : gamma logarithm (lgamma) Compute the log-gamma function, that is the natural logarithm of the gamma function of pixel values in the source channel and save into the specified Result destination. Arithmetic : logarithm (log) Compute the base e logarithm (also called the natural logarithm) of pixel values in the source channel and save into the specified Result destination. Arithmetic : logarithm binary (log2) Compute the base 2 logarithm (also called the binary logarithm) of pixel values in the source channel and save into the specified Result destination. Arithmetic : logarithm decimal (log10) Compute the base 10 logarithm (also called the common logarithm) of pixel values in the source channel and save into the specified Result destination. Arithmetic : multiply (*) Multiply the source field by the specified value and save the result into the specified Result destination.  Useful for increasing vertical scale in terrain elevation data. With the focus on the Elevation Raster image, in the Transform pane we choose the Tile field and then the Arithmetic template. In the Arithmetic template, we choose channel 0 for the Channel and multiply (*) as the Operation.  We enter 2 as the Value.     For the Result destination, we choose New Field and then enter Tile result as the name of the new tile field to add to the table.  For the new image name we enter Elevation result.   We could use whatever names we want for the names of the new tile and image, but it is wise to use names that remind us of what they are supposed to be.   Press Transform.     A new image called Elevation result appears in the Project pane.   We drag and drop the new Elevation result image into the Elevation Raster window as a layer.  To style the new image the same as the original Elevation Raster image, we copy the StylePixel property from the Elevation Raster image to the Elevation result image.   Comparing the original image to the result:  The terrain heights become higher and more steep. Arithmetic : power (pow) Compute the source field to the power of the specified Value.  A power of 1 is pixel values in the source channel unchanged, a power of 2 is pixel values in the source channel squared, and a power of 3 is pixel values in the source channel cubed. Arithmetic : reciprocal Compute 1 divided by pixel values in the source channel and save into the specified Result destination.  The reciprocal is also pixel values in the source channel to the power of -1, another way of saying the same thing. The reciprocal of zero is undefined, and thus returns a NULL. Arithmetic : sign (sign) Report if pixel values in the source channel are positive (return 1) or negative (return -1).   The sign of zero is 0. Arithmetic : sign invert Multiply pixel values in the source channel by -1, thus inverting the sign of the pixel value, and place the result in the Result destination.   Formerly known as Negate. With the focus on the Elevation Raster image, in the Transform pane we choose the Tile field and then the Arithmetic template. Preview: Apply Negate to Tile.   In the Arithmetic template, we choose sign invert as the Operation.   For the Result destination, we choose New Field and then enter Tile result as the name of the new tile field to add to the table.  For the new image name we enter Elevation result.   We could use whatever names we want for the names of the new tile and image, but it is wise to use names that remind us of what they are supposed to be.   Press Transform.     A new image called Elevation result appears in the Project pane.   We drag and drop the new Elevation result image into the Elevation Raster window as a layer.  To style the new image the same as the original Elevation Raster image, we copy the StylePixel property from the Elevation Raster image to the Elevation result image.   Comparing the original image to the result:  With terrain elevation data, sign invert turns hills into depressions.   This is a great way to create a data set for a mold, using a 3D printer, that will be used to pour terrain elevation models.   When applied to photographic imagery, sign invert creates a negative:  With multichannel images, use sign invert on each channel in place to create a photographic negative. Arithmetic : square Compute the square of pixel values in the source channel (the pixel value multiplied by itself) and save into the Result destination. Arithmetic : square root (sqrt) Compute the square root of pixel values in the source channel and save into the Result destination. Arithmetic : subtract (-) Add the specified Value to pixel values in the source channel and save the result into the specified Result destination. Useful for decreasing the level of terrain elevation data. With the focus on the Elevation Raster image, in the Transform pane we choose the Tile field and then the Arithmetic template. In the Arithmetic template, we choose channel 0 for the Channel and subtract (-) as the Operation.  We enter 100 as the Value.     For the Result destination, we choose New Field and then enter Tile result as the name of the new tile field to add to the table.  For the new image name we enter Elevation result.   We could use whatever names we want for the names of the new tile and image, but it is wise to use names that remind us of what they are supposed to be.   Press Transform.     A new image called Elevation result appears in the Project pane.   We drag and drop the new Elevation result image into the Elevation Raster window as a layer.  To style the new image the same as the original Elevation Raster image, we copy the StylePixel property from the Elevation Raster image to the Elevation result image.   Comparing the original image to the result:  The effect is the equivalent of lowering the terrain 100 units. Arithmetic : subtract from (-) Subtract pixel values in the source channel from the Value.

## Notes

Sample image - Many illustrations for transforms for raster images use an Elevation Raster sample image, a version of the formatted example of importing an SDTS format DEM from the Example: Import DDF SDTS DEM Raster File  topic.   The example project may be downloaded from the Downloads page on the Manifold web site.

Everything Math - For a handy reference to anything in mathematics, see the Wolfram MathWorld site.   Thank you, Wolfram!

Transform Pane

Transform Reference

Transform - Tiles