Skip to content
Related Articles

Related Articles

Getting tangent and hyperbolic tangent in Julia – tan(), tanh() and tand() Methods
  • Last Updated : 26 Mar, 2020

The tan() is an inbuilt function in julia which is used to calculate tangent of the specified radian values.

Syntax: tan(x)

Parameters:

  • x: Specified radian values.

Returns: It returns the calculated tangent of the specified radian values.

Example:






# 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))

Output:

0.0
-6.405331196646276
-1.995200412208242
0.017704699278685777

The tanh() is an inbuilt function in julia which is used to calculate hyperbolic tangent of the specified values.

Syntax: tanh(x)

Parameters:

  • x: Specified values.

Returns: It returns the calculated hyperbolic tangent of the specified values.

Example:




# 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))

Output:

0.0
1.0
1.0
1.0

The tand() is an inbuilt function in julia which is used to calculate tangent of the specified value in degrees.

Syntax: tand(x)

Parameters:

  • x: Specified value in degrees.

Returns: It returns the calculated tangent of the specified value in degrees.

Example:




# 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))

Output:

0.0
0.5773502691896258
Inf
1.0

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :