Numérico
Prev | Chapter 11. List of GEL functions | Next

## Numérico

AbsoluteValue

      AbsoluteValue (x)

  Aliases: `abs`

  Absolute value of a number and if `x` is a complex value the modulus of `x`. I.e. this the distance of `x` to the origin. This is equivalent to `|x|`.

  See Wikipedia, Planetmath (absolute value), Planetmath (modulus), Mathworld (absolute value) or Mathworld (complex modulus) for more information.

Chop

      Chop (x)

  Replace very small number with zero.

ComplexConjugate

      ComplexConjugate (z)

  Aliases: `conj` `Conj`

  Calculates the complex conjugate of the complex number `z`. If `z` is a vector or matrix, all its elements are conjugated.

  See Wikipedia for more information.

Denominator

      Denominator (x)

  Get the denominator of a rational number.

  See Wikipedia for more information.

FractionalPart

      FractionalPart (x)

  Return the fractional part of a number.

  See Wikipedia for more information.

Im

      Im (z)

  Aliases: `ImaginaryPart`

  Get the imaginary part of a complex number. For example `Re(3+4i)` yields 4.

  See Wikipedia for more information.

IntegerQuotient

      IntegerQuotient (m,n)

  Division without remainder.

IsComplex

      IsComplex (num)

  Check if argument is a complex (non-real) number. Do note that we really mean nonreal number. That is, `IsComplex(3)` yields false, while `IsComplex(3-1i)` yields true.

IsComplexRational

      IsComplexRational (num)

  Check if argument is a possibly complex rational number. That is, if both real and imaginary parts are given as rational numbers. Of course rational simply means "not stored as a floating point number."

IsFloat

      IsFloat (num)

  Check if argument is a real floating point number (non-complex).

IsGaussInteger

      IsGaussInteger (num)

  Aliases: `IsComplexInteger`

  Check if argument is a possibly complex integer. That is a complex integer is a number of the form `n+1i*m` where `n` and `m` are integers.

IsInteger

      IsInteger (num)

  Check if argument is an integer (non-complex).

IsNonNegativeInteger

      IsNonNegativeInteger (num)

  Check if argument is a non-negative real integer. That is, either a positive integer or zero.

IsPositiveInteger

      IsPositiveInteger (num)

  Aliases: `IsNaturalNumber`

  Check if argument is a positive real integer. Note that we accept the convention that 0 is not a natural number.

IsRational

      IsRational (num)

  Check if argument is a rational number (non-complex). Of course rational simply means "not stored as a floating point number."

IsReal

      IsReal (num)

  Check if argument is a real number.

Numerator

      Numerator (x)

  Get the numerator of a rational number.

  See Wikipedia for more information.

Re

      Re (z)

  Aliases: `RealPart`

  Get the real part of a complex number. For example `Re(3+4i)` yields 3.

  See Wikipedia for more information.

Sign

      Sign (x)

  Aliases: `sign`

  Return the sign of a number. That is returns `-1` if value is negative, `0` if value is zero and `1` if value is positive. If `x` is a complex value then `Sign` returns the direction or 0.

ceil

      ceil (x)

  Aliases: `Ceiling`

  Get the lowest integer more than or equal to `n`. Examples:

      genius> ceil(1.1)
      = 2
      genius> ceil(-1.1)
      = -1

  Note that you should be careful and notice that floating point numbers are stored in binary and so may not be what you expect. For example `ceil(420/4.2)` returns 101 instead of the expected 100. This is because 4.2 is actually very slightly less than 4.2. Use rational representation `42/10` if you want exact arithmetic.

exp

      exp (x)

  The exponential function. This is the function `e^x` where `e` is the base of the natural logarithm.

  See Wikipedia or Planetmath or Mathworld for more information.

float

      float (x)

  Make number a floating point value. That is returns the floating point representation of the number `x`.

floor

      floor (x)

  Aliases: `Floor`

  Get the highest integer less than or equal to `n`.

ln

      ln (x)

  The natural logarithm, the logarithm to base `e`.

  See Wikipedia or Planetmath or Mathworld for more information.

log

      log (x)

      log (x,b)

  Logarithm of `x` base `b` (calls `DiscreteLog` if in modulo mode), if base is not given, `e` is used.

log10

      log10 (x)

  Logarithm of `x` base 10.

log2

      log2 (x)

  Aliases: `lg`

  Logarithm of `x` base 2.

max

      max (a,args...)

  Aliases: `Max` `Maximum`

  Returns the maximum of arguments or matrix.

min

      min (a,args...)

  Aliases: `Min` `Minimum`

  Returns the minimum of arguments or matrix.

rand

      rand (size...)

  Generate random float in the range `[0,1)`. If size is given then a matrix (if two numbers are specified) or vector (if one number is specified) of the given size returned.

randint

      randint (max,size...)

  Generate random integer in the range `[0,max)`. If size is given then a matrix (if two numbers are specified) or vector (if one number is specified) of the given size returned. For example,

      genius> randint(4)
      = 3
      genius> randint(4,2)
      =
      [0      1]
      genius> randint(4,2,3)
      =
      [2      2       1
       0      0       3]

round

      round (x)

  Aliases: `Round`

  Round a number.

sqrt

      sqrt (x)

  Aliases: `SquareRoot`

  The square root. When operating modulo some integer will return either a `null` or a vector of the square roots. Examples:

      genius> sqrt(2)
      = 1.41421356237
      genius> sqrt(-1)
      = 1i
      genius> sqrt(4) mod 7
      =
      [2      5]
      genius> 2*2 mod 7
      = 4

  See Wikipedia or Planetmath for more information.

trunc

      trunc (x)

  Aliases: `Truncate` `IntegerPart`

  Truncate number to an integer (return the integer part).

Prev | Up | Next
Constantes | Home | Trigonometria