R语言 计算一个值的弧正切 – atan2(y, x)函数 在 atan2(y, x) 方法的帮助下,我们可以在R编程中得到x轴与原点到(x, y)的矢量之间的弧正切值。 语法: atan2(y, x) 返回: 返回弧正切值。 例子 1 : x <- c(2, 3, 4) # Using atan2(y, x) method gfg <- atan2(1, x) print(gfg) RCopy 输出 [1] 0.4636476 0.3217506 0.2449787 RCopy 例2 : x <- c(2, 3, 1) # Using atan2(y, x) method gfg <- atan2(pi/3, x) print(gfg) RCopy 输出 [1] 0.4823479 0.3358424 0.8084488 RCopy