Page tree


Contents:

   

Computes the tangent of an input value for an angle measured in radians. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.

In the above, the tangent of angle A is computed as the following:

tan(A) = x/y

The cotangent of angle A is 1/tan(A), or:

cot(A) = 1/tan(A) = y/x

You can convert from degrees to radians. For more information, see RADIANS Function.

Wrangle vs. SQL: This function is part of Wrangle, a proprietary data transformation language. Wrangle is not SQL. For more information, see Wrangle Language.


Basic Usage

Numeric literal example:

round(tan(radians(30)),3)

Output: Returns the computation of the tangent of a 30-degree angle, which is converted to radians before being passed to the tan function. The output value is rounded to three decimals: 0.577.

Column reference example:

tan(X)

Output: Returns the tangent of the radians values in X column.

Syntax and Arguments

tan(numeric_value)


ArgumentRequired?Data TypeDescription
numeric_valueYstring, decimal, or integerName of column, Decimal or Integer literal, or function returning those types to apply to the function

For more information on syntax standards, see Language Documentation Syntax Notes.

numeric_value

Name of the column, Integer or Decimal literal, or function returning that data type to apply to the function.

  • Missing input values generate missing results.
  • Literal numeric values should not be quoted. Quoted values are treated as strings.
  • Multiple columns and wildcards are not supported.

Usage Notes:

Required?Data TypeExample Value
YesString (column reference) or Integer or Decimal literal0.5

Examples


Tip: For additional examples, see Common Tasks.

Example - Trigonometry functions

This example illustrates how to apply basic trigonometric functions to your transformations.

Functions:

ItemDescription
SIN Function Computes the sine of an input value for an angle measured in radians. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.
COS Function Computes the cosine of an input value for an angle measured in radians. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.
TAN Function Computes the tangent of an input value for an angle measured in radians. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.

The following functions are computed using the above functions:

  • Cotangent. Computed as 1/TAN.
  • Secant. Computed as 1/COS.
  • Cosecant. Computed as 1/SIN. 

Also:

ItemDescription
ROUND Function Rounds input value to the nearest integer. Input can be an Integer, a Decimal, a column reference, or an expression. Optional second argument can be used to specify the number of digits to which to round.
RADIANS Function Computes the radians of an input value measuring degrees of an angle. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.

Source:

In the following sample, input values are in degrees:

X
-30
0
30
45
60
90
120
135
180


Transformation:

In this example, all values are rounded to three decimals for clarity.

First, the above values in degrees must be converted to radians. 

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula round(radians(X), 3)
Parameter: New column name 'rX'

Sine:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula round(sin(rX), 3)
Parameter: New column name 'SINrX'

Cosine:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula round(cos(rX), 3)
Parameter: New column name 'COSrX'

Tangent:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula round(tan(rX), 3)
Parameter: New column name 'TANrX'

Cotangent:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula round(1 / tan(rX), 3)
Parameter: New column name 'COTrX'

Secant:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula round(1 / cos(rX), 3)
Parameter: New column name 'SECrX'

Cosecant:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula round(1 / sin(rX), 3)
Parameter: New column name 'CSCrX'


Results:

XrXCOTrXSECrXCSCrXTANrXCOSrXSINrX
-30-0.524-1.731.155-1.999-0.5780.866-0.5
00null1null010
300.5241.731.1551.9990.5780.8660.5
450.7851.0011.4141.4150.9990.7070.707
601.0470.5781.9991.1551.7310.50.866
901.5710-4909.8261-4909.82601
1202.094-0.577-2.0011.154-1.734-0.50.866
1352.356-1-1.4141.414-1-0.7070.707
1803.1422454.913-1-2454.9130-10

See Also for EXAMPLE - Trigonometry Functions:

See Also for TAN Function:

This page has no comments.