pig tutorial - apache pig tutorial - Apache Pig - TANH() - pig latin - apache pig - pig hadoop
What is TANH() function?
- Tanh is the hyperbolic tangent function, which is the hyperbolic analogue of the Tan circular function used throughout trigonometry.
- Tanh[α] is defined as the ratio of the corresponding hyperbolic sine and hyperbolic cosine functions via .
- Tanh may also be defined as , where is the base of the natural logarithm Log.
Learn Apache Pig - Apache Pig tutorial - tanh - Apache Pig examples - Apache Pig programs
TANH() function in Apache Pig
- The TANH() function is used to calculate the hyperbolic trigonometric tangent of a given expression (angle).
Syntax
Example
- Ensure that we have a file named wikitechy_math.txt in the HDFS directory /pig_data/. This file contains integer and floating point values as given below.
wikitechy_math.txt
- We have loaded this file into Pig with a relation named wikitechy_math_data as given below.
- Now you can generate the hyperbolic tangent values for the contents of the wikitechy_math.txt file using TANH() function as given below.
Verification
- Verify the contents of the relation using the Dump operator as given below.
Output
- The above statement stores the result in the relation named tanh_data.