Ruby CMath cosh() Method with example
cosh() method is Math class which is used to returns the hyberbolic cosine of the given value.
Syntax: Math.cosh(z)
Parameter: Here, z is the value whose hyberbolic cosine is to be calculated.
Returns: This method returns the hyberbolic cosine value of the z.
Example 1:
# Ruby code for cosh() method require 'cmath' # Initializing value a = 0.3584b = 2 # Printing result puts "cosh value of a : #{CMath.cosh(a)}\n\n" puts "cosh value of b : #{CMath.cosh(b)}\n\n" |
chevron_right
filter_none
Output:
cosh value of a : 1.0649157114377563 cosh value of b : 3.7621956910836314
Example 2:
# Ruby code for cosh() method require 'cmath' # Initializing values a = 0b = -0.247 # Printing result puts "cosh value of a : #{CMath.cosh(a)}\n\n" puts "cosh value of b : #{CMath.cosh(b)}\n\n" |
chevron_right
filter_none
Output:
cosh value of a : 1.0 cosh value of b : 1.0306599031548231
Recommended Posts:
- Ruby CMath tan() Method with example
- Ruby CMath cos() Method with example
- Ruby CMath sin() Method with example
- Ruby CMath cbrt() Method with example
- Ruby CMath sinh() Method with example
- Ruby CMath sqrt() Method with example
- Ruby CMath tanh() Method with example
- Ruby CMath atan() Method with example
- Ruby | CMath asin() Method
- Ruby | CMath acos() Method
- Ruby | Math cosh() function
- Ruby | Set > method
- Ruby | Set <= method
- Ruby | Set - method
- Ruby | Set & method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



