ElixirMath v0.1.1 ElixirMath View Source

Math library for Elixir.

Link to this section Summary

Functions

Returns the arccosine of a number

Returns the hyperbolic arccosine of a number

Returns the arc sine of a number

Returns the hyperbolic arc sine of a number

Returns the arc tangent of a number

Returns the tangent inverse of y / x, where y is the proportion of the y coordinate and x is the proportion of the x coordinate

Returns the hyperbolic arc tangent of a number

Returns smallest number greater than or equal to the given number

Returns the cosine of given angle

Returns the hyperbolic cosine of given number

Returns the error function of x

Returns 1.0 - erf(x), computed by methods that void cancellation for large x

Returns returns e^x, where x is the argument, and e is Euler’s number

Returns the largest integer less than or equal to a given number

Returns the remainder when x is divided by y

Returns the greatest common divisor of a set of numbers

Returns true if a number is prime

Returns the least common multiple of a set of numbers

Returns the logarithm of a number

Returns the base 10 logarithm of a number

Returns the base 2 logarithm of a number

Returns PI

Returns the base to the exponent power

Returns a list of prime numbers

Returns the sine of a number

Returns the hyperbolic sine of a number

Returns the square root of a number

Returns the tangent of a number

Returns the hyperbolic tangent of a number

Link to this section Functions

Returns the arccosine of a number.

Examples

iex> ElixirMath.acos(0.5)
1.0471975511965976

Returns the hyperbolic arccosine of a number.

Examples

iex> ElixirMath.acosh(15)
3.4000844141133397

Returns the arc sine of a number.

Examples

iex> ElixirMath.asin(0.5) 0.5235987755982988

Returns the hyperbolic arc sine of a number.

Examples

iex> ElixirMath.asinh(15)
3.4023066454805946

Returns the arc tangent of a number.

Examples

iex> ElixirMath.atan(0.5)
0.46364760900080615

Returns the tangent inverse of y / x, where y is the proportion of the y coordinate and x is the proportion of the x coordinate.

Examples

iex> ElixirMath.atan2(10, 15)
0.5880026035475675

Returns the hyperbolic arc tangent of a number.

Examples

iex> ElixirMath.atanh(0.5)
0.5493061443340549

Returns smallest number greater than or equal to the given number.

Examples

iex> ElixirMath.ceil(0.5)
1.0

Returns the cosine of given angle.

Examples

iex> ElixirMath.cos(45)
0.5253219888177297

Returns the hyperbolic cosine of given number.

Examples

iex> ElixirMath.cosh(0.45)
1.102970168555971

Returns the error function of x.

Examples

iex> ElixirMath.erf(20) 1.0

Returns 1.0 - erf(x), computed by methods that void cancellation for large x.

Examples

iex> ElixirMath.erfc(0.2) 0.7772974107895215

Returns returns e^x, where x is the argument, and e is Euler’s number.

Examples

iex> ElixirMath.exp(15)
3269017.3724721107

Returns the largest integer less than or equal to a given number.

Examples

iex> ElixirMath.floor(15.2) 15.0

Returns the remainder when x is divided by y.

Examples

iex> ElixirMath.fmod(10, 3.5) 3.0

Returns the greatest common divisor of a set of numbers.

Example

iex> ElixirMath.gcd(90, 9)
9

iex> ElixirMath.gcd(9, 90)
9

Returns true if a number is prime.

Examples

iex> ElixirMath.is_prime(3)
true

iex> ElixirMath.is_prime(10)
false

Returns the least common multiple of a set of numbers.

Examples

iex> ElixirMath.lcm(90, 9)
90

iex> ElixirMath.lcm(9, 90)
90

Returns the logarithm of a number.

Examples

iex> ElixirMath.log(15) 2.70805020110221

Returns the base 10 logarithm of a number.

Examples

iex> ElixirMath.log10(15) 1.1760912590556813

Returns the base 2 logarithm of a number.

Examples

iex> ElixirMath.log2(15) 3.9068905956085187

Returns PI.

Examples

iex> ElixirMath.pi 3.141592653589793

Returns the base to the exponent power.

Examples

iex> ElixirMath.pow(16, 2) 256.0

Link to this function prime_numbers(count \\ 10) View Source
prime_numbers(number()) :: list()

Returns a list of prime numbers.

Examples

iex> ElixirMath.prime_numbers(10)
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

Returns the sine of a number.

Examples

iex> ElixirMath.sin(15) 0.6502878401571169

Returns the hyperbolic sine of a number.

Examples

iex> ElixirMath.sinh(0.5) 0.5210953054937474

Returns the square root of a number.

Examples

iex> ElixirMath.sqrt(100) 10.0

Returns the tangent of a number.

Examples

iex> ElixirMath.tan(15) -0.8559934009085189

Returns the hyperbolic tangent of a number.

Examples

iex> ElixirMath.tanh(0.5) 0.46211715726000974