Purpose |
Return the arctangent of an argument. |
Syntax |
y = ATN(numeric_expression) |
Remarks |
ATN returns the arctangent (Inverse Tangent) of numeric_expression; that is, the angle whose tangent is numeric_expression. The result, as with all operations involving angles in PowerBASIC, is in radians rather than degrees. Although it is common to specify angles in degrees, the radian is a more convenient measurement for mathematical operations. One radian is defined as the angle at the center of a circle that subtends an arc equal in length to one radius. Since for all circles, using the constant p: Circumference / radius = 2 * p the length of the circumference of a circle is equal to 2 * p * radius, and the angle of a full circle (360 degrees) is equal to 2 * p radians. To convert radians to degrees, just multiply the radian value by 180/p, or 57.29577951308232##. For example, the arctangent of 0.23456 can be converted this way: t = ATN(.23456!) 't = 0.230395 (radians) t = 57.29577951308232## * ATN(.23456!) 't= 13.200 (degrees) To convert degrees to radians, multiply by 0.0174532925199433##. For example: 14 degrees = (0.0174532925199433## * 14) = 0.2443460952792062 radians Rather than memorizing the radians/degrees conversion factors, calculate them for yourself by remembering this relationship: 2 p radians equals a full circle (360 degrees), so 1 p radian is 180 / p degrees. Conversely, 1 degree equals p / 180 radians. p is a transcendental constant, meaning that it has an infinite number of decimal places. To 15-place accuracy, adequate for most applications, p = 3.141592653589793##. This value can be closely approximated with the expression: pi## = 4 * ATN(1) Degrees-to-radians and radians-to-degrees conversions are good applications for user-defined functions. The ATN function always returns an Extended-precision result. The Tangent (TAN) of a value can be easily calculated with the TAN function. The Hyperbolic Tangent (TANH) can be calculated: TanH = (EXP(2 * Value) - 1) / (EXP(2 * Value) + 1) The Inverse Hyperbolic Tangent (ARCTANH) of a value can be calculated: ArcTanH = LOG((1 + Value) / (1 - Value)) / 2
' Useful Macro functions MACRO Pi = 3.141592653589793## MACRO DegreesToRadians(dpDegrees) = (dpDegrees*0.0174532925199433##) MACRO RadiansToDegrees(dpRadians) = (dpRadians*57.29577951308232##) |
See also |