Page tree

Release 6.8.2


Contents:

   

The PI function generates the value of pi to 15 decimal places: 3.1415926535897932.

This function uses no parameters. Generated values are of Decimal type and have fifteen digits of precision after the decimal point. If you want to see a fewer number of digits in the generated value, you might need to apply a different number format or using the ROUND function.

Basic Usage

pi()


Output:
Returns the value of pi.

Syntax and Arguments

There are no arguments for this function.

Examples


Tip: For additional examples, see Common Tasks.

Example - pi column

In the following example, the source is simply the source column, and the pi column is generated by the PI function:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula pi()
Parameter: New column name 'pi'

sourcepi
A

3.1415926535897932

B

3.1415926535897932

C

3.1415926535897932

D

3.1415926535897932

Example - RANDBETWEEN, PI, and TRUNC functions

This example illustrates how you can apply the following functions to generate new and random data in your dataset:
  • RANDBETWEEN - Generate a random Integer value between two specified Integers. See RANDBETWEEN Function.
  • PI - Generate the value of pi to 15 decimal points. See PI Function.
  • ROUND - Round a decimal value to the nearest Integer or to a specified number of digits. See ROUND Function.
  • TRUNC - Round a value down to the nearest Integer value. See TRUNC Function.

Source:

In the following example, a company produces 10 circular parts, the size of which is measured in each product's radius in inches.

prodIdradius_in
p0011
p0022
p0033
p0044
p0055
p0066
p0077
p0088
p0099
p01010

Based on the above data, the company wants to generate some additional sizing information for these circular parts, including the generation of two points along each part's circumference where quality stress tests can be applied.

Transformation:

To begin, you can use the following steps to generate the area and circumference for each product, rounded to three decimal points:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula ROUND(PI() * (POW(radius_in, 2)), 3)
Parameter: New column name 'area_sqin'

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula ROUND(PI() * (2 * radius_in), 3)
Parameter: New column name 'circumference_in'

For quality purposes, the company needs two tests points along the circumference, which are generated by calculating two separate random locations along the circumference. Since the RANDBETWEEN function only calculates using Integer values, you must first truncate the values from circumference_in:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula TRUNC(circumference_in)
Parameter: New column name 'trunc_circumference_in'

Then, you can calculate the random points using the following:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula RANDBETWEEN(0, trunc_circumference_in)
Parameter: New column name 'testPt01_in'

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula RANDBETWEEN(0, trunc_circumference_in)
Parameter: New column name 'testPt02_in'

Results:

After the trunc_circumference_in column is dropped, the data should look similar to the following:

prodIdradius_inarea_sq_incircumference_intestPt01_intestPt02_in
p00113.1426.28355
p002212.56612.56633
p003328.27418.8501313
p004450.26525.1332424
p005578.54031.41600
p0066113.09737.6991515
p0077153.93843.9821111
p0088201.06250.26511
p0099254.46956.5492929
p01010314.15962.8322121

 

This page has no comments.