Back to library index.
Package std-math (in std.i) - simple mathematical functions
Index of documented functions or symbols:
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: 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.
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: asinh
SEE: sin
SEE: sinh
SEE: sech
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
DOCUMENT im_part(z) returns the imaginary part of its argument. Unlike z.im, works if z is not complex (returns zero).
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
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)).
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.
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
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
SEE: random
DOCUMENT re_part(z) returns the real part of its argument. (Same as double(z).) Unlike z.re, works if z is not complex.
SEE: lround
DOCUMENT sech(x) csch(x) returns the hyperbolic secant (1/cosh) or cosecant (1/sinh) of its argument, without overflowing for large x.
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
DOCUMENT sin(x) cos(x) tan(x) returns the sine, cosine, or tangent of its argument, which is in radians.
DOCUMENT sinh(x) cosh(x) tanh(x) returns the hyperbolic sine, cosine, or tangent of its argument.
SEE: sin
SEE: sinh