Learn and Learn

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

Ruby – Find Arc Cosine – acos() Method – Examples & Explanation

acos() method can be used to find the arc cosine of the any given complex number in Ruby language.

acos() Method in Ruby

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

 

Syntax of the acos() Method in Ruby

Syntax of acos() method is:

 

Parameter of acos() Method in Ruby

ParameterDescription
xAny valid complex number. This parameter is required.

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

 

Return Value of acos()

acos() method will returns the arc cosine of the given numeric complex number.

 

How to get the acos() Value of Given Numbers in Ruby?


Output

0.9045568943023813-1.0612750619050357i

 

Ruby acos() Method Example 2


Output

2.2370357592874117-1.0612750619050357i

 

Ruby – Various Ways to Get the acos() of Given Numbers Example 3


Output

1.5707963267948966+0.0i

 

Ruby acos() Method Example 4


Output

2.3511949067802878+2.649196177806475i

 

Ruby acos() Method Example 4


Output

3.141592653589793-2.2924316695611777i

 

Ruby acos() Method Example 4


Output

1.5707963267948966

 

LearnAndLearn.com © 2018 - All rights reserved