The following example demonstrates how the
SQRT functions work together to compute the hypotenuse of a right triangle using the Pythagorean theorem.
POW- X Y . In this case, 10 to the power of the previous one. See POW Function .
SQRT- computes the square root of the input value. See SQRT Function.
The Pythagorean theorem states that in a right triangle the length of each side (x,y) and of the hypotenuse (z) can be represented as the following:
z2 = x 2 + y 2
Therefore, the length of z can be expressed as the following:
z = sqrt(x 2 + y 2 )
For more information on the Pythagorean theorem, see https://en.wikipedia.org/wiki/Pythagorean_theorem.Source:
The dataset below contains values for x and y:
You can use the following transform to generate values for z2.
NOTE: Do not add this step to your recipe right now.
derive type:single value:(POW(x,2) + POW(y,2)) as:'Z'
derive type:single value:SQRT((POW(x,2) + POW(y,2))) as: 'Z'