Ruby | Math acosh() function

The acosh() is an inbuilt function in Ruby returns the inverse hyperbolic cosine of an angle given in radians.

Syntax: Math.acosh(value)

Parameters: The function accepts one mandatory parameter value which specifies the inverse hyperbolic angle in radian which should be greater or equal to 1. If the argument is less than 1, domain error is returned.



Return Value: The function returns the inverse hyperbolic sine of the argument in radians which is in the range [0, inf].

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

#Ruby program for acosh() function
  
#Assigning values
val1 = 2 val2 = 877 val3 = 432 val4 = 43
  
#Prints the acosh() value
                                      puts Math.acosh(val1)
                                          puts Math.acosh(val2)
                                              puts Math.acosh(val3)
                                                  puts Math.acosh(val4)

chevron_right


Output:

1.3169578969248166
7.469653847888966
6.761571429209457
4.454212060602711

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

#Ruby program for acosh() function
  
#Assigning values
val1 = 20 val2 = 83 val3 = 332 val4 = 3
  
#Prints the acosh() value
                                      puts Math.acosh(val1)
                                          puts Math.acosh(val2)
                                              puts Math.acosh(val3)
                                                  puts Math.acosh(val4)

chevron_right


Output:

3.6882538673612966
5.111951496643704
6.498279881360139
1.762747174039086

Reference: https://devdocs.io/ruby~2.5/cmath#method-i-acosh



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.