Skip to content
Related Articles

Related Articles

Getting cosine and hyperbolic cosine in Julia – cos(), cosh() and cosd() Methods
  • Last Updated : 26 Mar, 2020

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

Syntax: cos(x)

Parameters:

  • x: Specified radian values.

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

Example:






# Julia program to illustrate 
# the use of cos() method
  
# Getting cosine of the specified
# radian values.
println(cos(0))
println(cos(30))
println(cos(90))
println(cos(44))

Output:

1.0
0.15425144988758405
-0.4480736161291702
0.9998433086476912

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

Syntax: cosh(x)

Parameters:

  • x: Specified values.

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

Example:




# Julia program to illustrate 
# the use of cosh() method
  
# Getting cosine of the specified values.
println(cosh(0))
println(cosh(30))
println(cosh(90))
println(cosh(45))

Output:

1.0
5.343237290762231e12
6.102016471589204e38
1.7467135528742547e19

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

Syntax: cosd(x)

Parameters:

  • x: Specified value in degrees.

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

Example:




# Julia program to illustrate 
# the use of cosd() method
  
# Getting cosine of the specified value 
# in degree
println(cosd(0))
println(cosd(30))
println(cosd(90))
println(cosd(45))

Output:

1.0
0.8660254037844386
0.0
0.7071067811865476

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 :