LiveEdu Quiz of the Day: 06/01/2017

Ruby Quiz

Ruby Quiz What is the name of the Ruby module that offers a wide variety of methods for conducting mathematical tasks and operations?



The Ruby Math module provides the Ruby programmer with an extensive range of methods for performing mathematical tasks. In addition, the Math module includes two commonly used mathematical constants:

As mentioned previously, Ruby provides an extensive range of math related methods. These are listed and described in the following table.

Method name Description
Math.acos, Math.acos! Arc cosine
Math.acosh, Math.acosh! Hyperbolic arc cosine
Math.asin, Math.asin! Arc sine
Math.asinh, Math.asinh Hyperbolic arc sine
Math.atan, Math.atan!, Math.atan2, Math.atan2! Arc tangent. atan takes an x argument. atan2 takes x and y arguments
Math.atanh, Math.atanh! Hyperbolic arc tangent
Math.cos, Math.cos! Cosine
Math.cosh, Math.cosh Hyperbolic cosine
Math.sin, Math.sin! Sine
Math.erf Error function
Match.erfc Complementary error function
Math.exp, Math.exp! Base x of Euler
Math.frexp Normalized fraction and exponent
Math.hypot Hypotenuse
Math.ldexp Floating-point value corresponding to mantissa and exponent
Math.sinh, Math.sinh! Hyperbolic sine
Math.sqrt, Math.sqrt! Square root
Math.tan, Math.tan! Tangent
Math.tanh, Math.tanh! Hyperbolic tangent

Now that we have a list of the math methods available to us, we can start to use them:

To perform a square root:

Or a Euler calculation:

If you want to explore more, visit our Ruby edu & tutorials section!

Below are some examples:

Building a Ruby on Rails app for managing students

Trello clone app in Ruby

About author

About Author Dr. Michael Jurgen Garbade is the founder of LiveEdu.TV, Kyuda, Education Ecosystem. He is future Venture Capitalist, Future Politician and always on the lookout for the Next Big Challenge. Obtained Masters in business administration and physics, and a Ph.D. in finance with professional work experience in high-paced environments at Fortune 500 companies like Amazon and General Electric. Expertize: Python, PHP, Sencha Touch & C++, SEO, Finance, Strategy & E-commerce. He speaks English and German and has worked in the US, Europe, and Asia. At Education Ecosystem he is the CEO and runs business operations.
Related posts
Artificial IntelligenceCoding Community

10 Projects to Practice with During the Pandemic

Coding CommunityE-Learning

Education Ecosystem is joining Unesco and IBM in the CodeTheCurve Hackathon


Education Ecosystem Announces Second Giveaway!


Education Ecosystem to Distribute $1 Million Grants to Developers