Open In App

Calculate arc tangent of a value in R programming – atan2(y, x) function

Last Updated : 10 May, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

With the help of atan2(y, x) method, we can get the arc tangent between x axis and a vector from origin to (x, y) in R programming.

Syntax: atan2(y, x)
Return: Returns the arc tangent value.

Example 1:




x <- c(2, 3, 4)
  
# Using atan2(y, x) method
gfg <- atan2(1, x)
  
print(gfg)


Output:

[1] 0.4636476 0.3217506 0.2449787

Example 2:




x <- c(2, 3, 1)
  
# Using atan2(y, x) method
gfg <- atan2(pi/3, x)
  
print(gfg)


Output:

[1] 0.4823479 0.3358424 0.8084488

Similar Reads

Calculate arc cosine of a value in R programming - acos() function
The acos() is an inbuilt function in R Programming which is used to calculate arc cosine of the specified radian value and output is also in radians. Syntax: acos(radian) Return: Returns the arc cosine value of radian. Example 1: # Using acos() method gfg &lt;- acos(pi/4) print(gfg) Output: [1] 0.7853982 Example 2: # Using acos() method gfg &lt;- a
1 min read
Calculate Hyperbolic tangent of a value in R Programming - tanh() Function
tanh() function in R Language is used to calculate the hyperbolic tangent of the numeric value passed to it as argument. Syntax: tanh(x) Parameter: x: Numeric value Example 1: # R code to calculate hyperbolic tangent of a value # Assigning values to variables x1 &lt;- -90 x2 &lt;- -30 # Using tanh() Function tanh(x1) tanh(x2) Output: [1] -1 [1] -1
1 min read
Calculate tangent of a value in R Programming - tan() Function
tan() function in R Language is used to calculate the tangent of the numeric value passed to it as argument. Syntax: tan(x) Parameter: x: Numeric value Example 1: # R code to calculate tangent of a value # Assigning values to variables x1 &lt;- -90 x2 &lt;- -30 # Using tan() Function tan(x1) tan(x2) Output: [1] 1.9952 [1] 6.405331 Example 2: # R co
1 min read
Calculate Inverse tangent of a value in R Programming - atan() Function
atan() function in R Language is used to calculate the inverse tangent value of the numeric value passed to it as argument. Syntax: atan(x) Parameter: x: Numeric value Example 1: # R code to calculate inverse tangent of a value # Assigning values to variables x1 &lt;- -1 x2 &lt;- 0.5 # Using atan() Function atan(x1) atan(x2) Output: [1] -0.7853982
1 min read
Compute the tangent value which is multiples of pi in R Programming – tanpi() Function
tanpi() function in R Language is used to compute the tangent value of x which is the multiples of pi. Syntax: tanpi(x) Parameters: x: Numeric value, array or vector Example 1: # R program to illustrate # tanpi function # Calling the tanpi() function tanpi(0) tanpi(1 / 4) Output: [1] 0 [1] 1 Example 2: # R program to illustrate # tanpi function # C
1 min read
Calculate cosine of a value in R Programming - cos() Function
cos() function in R Language is used to calculate the cosine value of the numeric value passed to it as argument. Syntax: cos(x) Parameter: x: Numeric value Example 1: # R code to calculate cosine of a value # Assigning values to variables x1 &lt;- 90 x2 &lt;- 30 # Using cos() Function cos(x1) cos(x2) Output: [1] -0.4480736 [1] 0.1542514 Example 2:
1 min read
Calculate Hyperbolic cosine of a value in R Programming - cosh() Function
cosh() function in R Language is used to calculate the hyperbolic cosine value of the numeric value passed to it as the argument. Syntax: cosh(x)Parameter: x: Numeric value Example 1: C/C++ Code # R code to calculate cosine of a value # Assigning values to variables x1 &lt;- 90 x2 &lt;- 30 # Using cosh() Function cosh(x1) cosh(x2) Output: [1] 6.102
1 min read
Calculate sine of a value in R Programming - sin() Function
sin() function in R Language is used to calculate the sine value of the numeric value passed to it as argument. Syntax: sin(x) Parameter: x: Numeric value Example 1: # R code to calculate sine of a value # Assigning values to variables x1 &lt;- -90 x2 &lt;- -30 # Using sin() Function sin(x1) sin(x2) Output: [1] -0.8939967 [1] 0.9880316 Example 2: #
1 min read
Calculate Hyperbolic sine of a value in R Programming - sinh() Function
sinh() function in R Language is used to calculate the hyperbolic sine value of the numeric value passed to it as argument. Syntax: sinh(x) Parameter: x: Numeric value Example 1: # R code to calculate hyperbolic sine of a value # Assigning values to variables x1 &lt;- -90 x2 &lt;- -30 # Using sinh() Function sinh(x1) sinh(x2) Output: [1] -6.102016e
1 min read
Calculate Inverse sine of a value in R Programming - asin() Function
asin() function in R Language is used to calculate the inverse sine value of the numeric value passed to it as argument. Syntax: asin(x) Parameter: x: Numeric value Example 1: # R code to calculate inverse sine of a value # Assigning values to variables x1 &lt;- -1 x2 &lt;- 0.5 # Using asin() Function asin(x1) asin(x2) Output: [1] -1.570796 [1] 0.5
1 min read
Article Tags :