Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r100
Excerpt

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

Functions:

D generate list excerpts
pagesSIN Function,COS Function,TAN Function

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:

D generate list excerpts
pagesROUND Function,RADIANS Function

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. 

D trans
RawWrangletrue
p03Value'rX'
Typestep
WrangleTextderive type: single value: round(radians(X), 3) as: 'rX'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valueround(radians(X), 3)
p03NameNew column name
SearchTermNew formula

Sine:

D trans
RawWrangletrue
p03Value'SINrX'
Typestep
WrangleTextderive type: single value: round(sin(rX), 3) as: 'SINrX'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valueround(sin(rX), 3)
p03NameNew column name
SearchTermNew formula

Cosine:

D trans
RawWrangletrue
p03Value'COSrX'
Typestep
WrangleTextderive type: single value: round(cos(rX), 3) as: 'COSrX'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valueround(cos(rX), 3)
p03NameNew column name
SearchTermNew formula

Tangent:

D trans
RawWrangletrue
p03Value'TANrX'
Typestep
WrangleTextderive type: single value: round(tan(rX), 3) as: 'TANrX'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valueround(tan(rX), 3)
p03NameNew column name
SearchTermNew formula

Cotangent:

D trans
RawWrangletrue
p03Value'COTrX'
Typestep
WrangleTextderive type: single value: round(1 / tan(rX), 3) as: 'COTrX'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valueround(1 / tan(rX), 3)
p03NameNew column name
SearchTermNew formula

Secant:

D trans
RawWrangletrue
p03Value'SECrX'
Typestep
WrangleTextderive type: single value: round(1 / cos(rX), 3) as: 'SECrX'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valueround(1 / cos(rX), 3)
p03NameNew column name
SearchTermNew formula

Cosecant:

D trans
RawWrangletrue
p03Value'CSCrX'
Typestep
WrangleTextderive type: single value: round(1 / sin(rX), 3) as: 'CSCrX'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valueround(1 / sin(rX), 3)
p03NameNew column name
SearchTermNew formula


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

D s also
labelexample_trigonometry_functions