EXAMPLE - POW and SQRT Functions
In this example, you learn how to compute exponentials and square roots on your numeric data.
Functions:
Item | Description |
---|---|
POW Function | Computes the value of the first argument raised to the value of the second argument. |
SQRT Function | Computes the square root of the input parameter. Input value can be a Decimal or Integer literal or a reference to a column containing numeric values. All generated values are non-negative. |
Source:
The dataset below contains values for x and y:
X | Y |
---|---|
3 | 4 |
4 | 9 |
8 | 10 |
30 | 40 |
Transformation:
You can use the following transformation to generate values for z2.
注記
Do not add this step to your recipe right now.
Transformation Name | |
---|---|
Parameter: Formula type | Single row formula |
Parameter: Formula | (POW(x,2) + POW(y,2)) |
Parameter: New column name | 'Z' |
You can see how column Z is generated as the sum of squares of the other two columns, which yields z2.
Now, edit the transformation to wrap the value computation in a SQRT
function. This step is done to compute the value for z, which is the distance between the two points based on the Pythagorean theorem.
Transformation Name | |
---|---|
Parameter: Formula type | Single row formula |
Parameter: Formula | SQRT((POW(x,2) + POW(y,2))) |
Parameter: New column name | 'Z' |
Results:
X | Y | Z |
---|---|---|
3 | 4 | 5 |
4 | 9 | 9.848857801796104 |
8 | 10 | 12.806248474865697 |
30 | 40 | 50 |