Back to library index.

Package std-math (in std.i) - simple mathematical functions

Index of documented functions or symbols:

abs

DOCUMENT abs(x)
      or abs(x, y, z, ...)
  returns the absolute value of its argument.
  In the multi-argument form, returns sqrt(x^2+y^2+z^2+...).

SEE ALSO: sign, sqrt

acos

DOCUMENT acos(x)
  returns the inverse cosine of its argument, range [0, pi].

SEE ALSO: sin, cos, tan, asin, acos, atan

acosh

SEE: asinh

asin

DOCUMENT asin(x)
  returns the inverse sine of its argument, range [-pi/2, pi/2].

SEE ALSO: sin, cos, tan, asin, acos, atan

asinh

DOCUMENT asinh(x)
         acosh(x)
         atanh(x)
  returns the inverse hyperbolic sine, cosine, or tangent of
  its argument.  The range of real acosh is >=0.0.

SEE ALSO: sinh, cosh, tanh, sech, csch

atan

DOCUMENT atan(x)
      or atan(y, x)
  returns the inverse tangent of its argument, range [-pi/2, pi/2].
  In the two argument form, returns the angle from (1, 0) to (x, y),
  in the range (-pi, pi], with atan(1, 0)==pi/2.  (If x>=0, this is
  the same as atan(y/x).)

SEE ALSO: sin, cos, tan, asin, acos, atan

atanh

SEE: asinh

ceil

DOCUMENT ceil(x)
  returns the smallest integer not less than x (no-op on integers).

SEE ALSO: floor, round

conj

DOCUMENT conj(z)
  returns the complex conjugate of its argument.

cos

SEE: sin

cosh

SEE: sinh

csch

SEE: sech

exp

DOCUMENT exp(x)
  returns the exponential function of its argument (inverse of log).

SEE ALSO: expm1, log, log10, sinh, cosh, tanh, sech, csch

expm1

DOCUMENT expm1(x)
      or expm1(x, ex)
  return exp(X)-1 accurate to machine precision (even for X<<1)
  in the second form, returns exp(x) to EX

SEE ALSO: exp, log1p

floor

DOCUMENT floor(x)
  returns the largest integer not greater than x (no-op on integers).

SEE ALSO: ceil, round

im_part

DOCUMENT im_part(z)
  returns the imaginary part of its argument.
  Unlike z.im, works if z is not complex (returns zero).

log

DOCUMENT log(x)
  returns the natural logarithm of its argument (inverse of exp).

SEE ALSO: log1p, log10, exp, asinh, acosh, atanh

log10

DOCUMENT log10(x)
  returns the base 10 logarithm of its argument (inverse of 10^x).

SEE ALSO: log, exp, asinh, acosh, atanh

log1p

DOCUMENT log1p(x)
  return log(1+X) accurate to machine precision (even for X<<1)
  from Goldberg, ACM Computing Surveys, Vol 23, No 1, March 1991,
    apparently originally from HP-15C Advanced Functions Handbook

SEE ALSO: expm1, log1p

lround

DOCUMENT round(x);
         lround(x);
  These functions return X rounded to the nearest integer.  The result of
  round(X) is a floating point value, while that of lround(X) is a long
  integer.  They are respectively equivalent to: floor(X+0.5) and
  long(floor(X+0.5)).

SEE ALSO: floor, ceil

pi

DOCUMENT pi
  roughly 3.14159265358979323846264338327950288

poly

DOCUMENT poly(x, a0, a1, a2, ..., aN)
  returns the polynomial  A0 + A1*x + A2*x^2 + ... + AN*X^N
  The data type and dimensions of the result, and conformability rules
  for the inputs are identical to those for the expression.

random

DOCUMENT random(dimension_list)
         random_seed, seed
  returns an array of random double values with the given
  DIMENSION_LIST (nil for a scalar result), uniformly distributed
  on the interval from 0.0 to 1.0.
  The algorithm is from Press and Teukolsky, Computers in Physics,
  vol. 6, no. 5, Sep/Oct 1992 (ran2).  They offer a reward of $1000
  to anyone who can exhibit a statistical test that this random
  number generator fails in a "non-trivial" way.
  The random_seed call reinitializes the random number sequence;
  SEED should be between 0.0 and 1.0 non-inclusive; if SEED is
  omitted, nil, or out of range, the sequence is reinitialized as
  when Yorick starts.
  The numbers are actually at the centers of 2147483562 equal width
  bins on the interval [0,1].  Although only these 2 billion numbers
  are possible, the period of the generator is roughly 2.3e18.

SEE ALSO: randomize

randomize

DOCUMENT randomize
         randomize()
  set the seed for random "randomly" (based on the timer clock
  and the current state of random).  As a function, returns the
  value of the seed passed to random_seed.

SEE ALSO: random, random_seed

random_seed

SEE: random

re_part

DOCUMENT re_part(z)
  returns the real part of its argument.  (Same as double(z).)
  Unlike z.re, works if z is not complex.

round

SEE: lround

sech

DOCUMENT sech(x)
         csch(x)
  returns the hyperbolic secant (1/cosh) or cosecant (1/sinh) of
  its argument, without overflowing for large x.

SEE ALSO: sinh, cosh, tanh, asinh, acosh, atanh

sign

DOCUMENT sign(x)
  returns algebraic sign of it argument, or closest point on the
  unit circle for complex x.  Guaranteed that x==sign(x)*abs(x).
  sign(0)==+1.

SEE ALSO: abs

sin

DOCUMENT sin(x)
         cos(x)
         tan(x)
  returns the sine, cosine, or tangent of its argument,
  which is in radians.

SEE ALSO: asin, acos, atan

sinh

DOCUMENT sinh(x)
         cosh(x)
         tanh(x)
  returns the hyperbolic sine, cosine, or tangent of its argument.

SEE ALSO: sech, csch, asinh, acosh, atanh

sqrt

DOCUMENT sqrt(x)
  returns the square root of its argument.

SEE ALSO: abs

tan

SEE: sin

tanh

SEE: sinh