在 Julia 中获取正切和双曲正切 – tan()、tanh() 和 tand() 方法
tan()
是 julia 中的内置函数,用于计算指定弧度值的正切。
Syntax: tan(x)
Parameters:
- x: Specified radian values.
Returns: It returns the calculated tangent of the specified radian values.
例子:
# Julia program to illustrate
# the use of tan() method
# Getting tangent of the specified
# radian values.
println(tan(0))
println(tan(30))
println(tan(90))
println(tan(44))
输出:
0.0
-6.405331196646276
-1.995200412208242
0.017704699278685777
tanh()
是 julia 中的内置函数,用于计算指定值的双曲正切。
Syntax: tanh(x)
Parameters:
- x: Specified values.
Returns: It returns the calculated hyperbolic tangent of the specified values.
例子:
# Julia program to illustrate
# the use of tanh() method
# Getting hyperbolic tangent
# of the specified values.
println(tanh(0))
println(tanh(70))
println(tanh(90))
println(tanh(45))
输出:
0.0
1.0
1.0
1.0
tand()
是 julia 中的内置函数,用于计算以度为单位的指定值的正切。
Syntax: tand(x)
Parameters:
- x: Specified value in degrees.
Returns: It returns the calculated tangent of the specified value in degrees.
例子:
# Julia program to illustrate
# the use of tand() method
# Getting tangent of the specified value
# in degree
println(tand(0))
println(tand(30))
println(tand(90))
println(tand(45))
输出:
0.0
0.5773502691896258
Inf
1.0