Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Ruby – Find Inverse Hyperbolic Cosine – acosh() Method with Examples

acosh() method can be used to find the inverse hyperbolic cosine of the any given complex number in Ruby. acosh() method exists in CMath library of Ruby.

acosh() Method in Ruby

acosh() method exists in Standard CMath Library of Ruby. The purpose of this method is to provide perfect inverse hyperbolic cosine for the given complex number.

 

Syntax of the acosh() Method in Ruby

Syntax of acosh() method is:

 

Parameter of acosh() Method in Ruby

Parameter Description
xAny valid complex number. This parameter is required.

Note: If the x parameter is not a complex number,acosh() method will return an error.

 

Return Value of acosh()

acosh() method will return the inverse hyperbolic cosine of the given numeric complex number.

 

Ruby – Get the acosh() of the Given Numbers Example 1


Output

1.0612750619050357+0.9045568943023813i

 

Ruby – Get the acosh() of the Given Numbers Example 2


Output

-1.0612750619050355-2.2370357592874117i

 

Ruby – Get the acosh() of the Given Numbers Example 3


Output

0.0+1.5707963267948966i

 

Ruby – Handle Negative Values in acosh() Method Example 1


Output

-2.649196177806475+2.3511949067802878i

 

Ruby – Handle Negative Values in acosh() Method Example 2


Output

-2.2924316695611733+3.141592653589793i

 

Ruby – Getting the acosh() of a Particular Number


Output

2.8872709503576206

 

Loading...
LearnAndLearn.com © 2018 - All rights reserved