Excerpt |
---|
This example illustrates to convert values from one unit of measure to the other. |
Functions:
D generate list excerpts |
---|
pages | DEGREES Function,RADIANS Function,ROUND Function |
---|
|
Source:
In this example, the source data contains information about a set of isosceles triangles. Each triangle is listed in a separate row, with the listed value as the size of the non-congruent angle in the triangle in degrees.
You must calculate the measurement of all three angles of each isosceles triangle in radians.
triangle | a01 |
---|
t01 | 30 |
t02 | 60 |
t03 | 90 |
t04 | 120 |
t05 | 150 |
Transformation:
You can convert the value for the non-congruent angle to radians using the following:
D trans |
---|
RawWrangle | true |
---|
p03Value | 'r01' |
---|
Type | step |
---|
WrangleText | derive type:single value: ROUND(RADIANS(a01), 4) as: 'r01' |
---|
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | ROUND(RADIANS(a01), 4) |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
Now, calculate the value in degrees of the remaining two angles, which are congruent. Since the sum of all angles in a triangle is 180, the following formula can be applied to compute the size in degrees of each of these angles:
D trans |
---|
RawWrangle | true |
---|
p03Value | 'a02' |
---|
Type | step |
---|
WrangleText | derive type:single value: (180 - a01) / 2 as: 'a02' |
---|
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | (180 - a01) / 2 |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
Convert the above to radians:
D trans |
---|
RawWrangle | true |
---|
p03Value | 'r02' |
---|
Type | step |
---|
WrangleText | derive type:single value: ROUND(RADIANS(a02), 4) as: 'r02' |
---|
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | ROUND(RADIANS(a02), 4) |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
Create a second column for the other congruent angle:
D trans |
---|
RawWrangle | true |
---|
p03Value | 'r03' |
---|
Type | step |
---|
WrangleText | derive type:single value: ROUND(RADIANS(a02), 4) as: 'r03' |
---|
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | ROUND(RADIANS(a02), 4) |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
To check accuracy, you sum all three columns and convert to degrees:
D trans |
---|
RawWrangle | true |
---|
p03Value | 'checksum' |
---|
Type | step |
---|
WrangleText | derive type:single value: ROUND(DEGREES(r01 + r02 + r03), 4) as: 'checksum' |
---|
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | ROUND(RADIANS(a02), 4) |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
Results:
After you delete the intermediate columns, you see the following results and determine the error in the checksum is acceptable:
triangle | a01 | r03 | r02 | r01 | checksum |
---|
t01 | 30 | 1.3095 | 1.3095 | 0.5238 | 179.9967 |
t02 | 60 | 1.0476 | 1.0476 | 1.0476 | 179.9967 |
t03 | 90 | 0.7857 | 0.7857 | 1.5714 | 179.9967 |
t04 | 120 | 0.5238 | 0.5238 | 2.0952 | 179.9967 |
t05 | 150 | 0.2619 | 0.2619 | 2.6190 | 179.9967 |
D s also |
---|
label | example_degrees_and_radians_functions |
---|
|