Back to library index.

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

Index of documented functions or symbols:

abs

acos

acosh

asin

asinh

atan

atanh

ceil

conj

cos

cosh

csch

exp

expm1

floor

im_part

log

log10

log1p

lround

pi

poly

random

randomize

random_seed

re_part

round

sech

sign

sin

sinh

sqrt

tan

tanh

### 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+...).```

### acos

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

SEE: asinh

### asin

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

### 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.```

### 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: asinh

### ceil

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

### conj

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

SEE: sin

SEE: sinh

SEE: sech

### exp

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

### 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```

### floor

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

### 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).```

### log10

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

### 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```

### 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)).```

### 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.
```

### 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: 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.```

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.```

### 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.```

### sin

```DOCUMENT sin(x)
cos(x)
tan(x)
returns the sine, cosine, or tangent of its argument,

### sinh

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

### sqrt

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