Calculates the arc tangent of a value; the returned angle is in the range -π/2 through π/2.
Note
Math functions on ARM architecture may return different results in very high-precision calculationsc compared to Intel/AMD architectures.
Hide omitted argument names for this function
Omitted Argument NamesThe argument name for
field
can be omitted; the following forms of this function are equivalent:logscale Syntaxmath:arctan("value")
and:
logscale Syntaxmath:arctan(field="value")
These examples show basic structure only.
math:arctan()
Examples
Click
next to an example below to get the full details.Calculate Arc Tangent of Value
Calculate the arc tangent using the
math:arctan()
function
Query
x := 1.0
| math:arctan(x, as=angle)
Introduction
In this example, the math:arctan()
function is used
to calculate the arc tangent of 1.0, which represents a slope of 1
(45-degree angle).
Step-by-Step
Starting with the source repository events.
- logscale
x := 1.0
Assigns the value
1.0
to field x. This value represents a slope of 1 (rise over run), which should result in an angle ofπ/4
radians (45 degrees). - logscale
| math:arctan(x, as=angle)
Calculates the arc tangent of the value in field x and returns the result in radians in a field named angle. If the
as
parameter is not specified, the result is returned in a field named _arctan as default. Event Result set.
Summary and Results
The query is used to calculate angles from slope values, which is useful in various mathematical and geometric calculations where you need to find an angle from a ratio.
This query is useful, for example, to calculate angles from slopes, determine inclination from gradients, or analyze ratios in trigonometric calculations.
Sample output from the incoming example data:
angle |
---|
0.7853981633974483 |
The result shows that the arc tangent of 1.0
is
approximately 0.7854
radians (π/4 radians or 45
degrees). This means a slope of 1 corresponds to a 45-degree angle.
Note that the math:arctan()
function only returns
values between -π/2
and π/2
radians (-90 to 90 degrees). For full angle determination in all
directions (0 to 360 degrees), use math:arctan2()
instead.
The math:arctan()
function is often used with
math:rad2deg()
when angles need to be displayed in
degrees. For applications requiring angles in all directions, consider
using math:arctan2()
instead.