MATHFNS
By Kelly Roach. Mathematical functions not already provided by Interlisp. Last revised: Aug 27, 1983.

<LISPUSERS>MATHFNS (and .DCOM) contain functions from mathematics that are not already provided by Interlisp, including extra trigonometric functions, hyperbolic functions, and macros and functions for complex arithmetic. Gamma, Bessel, Error, and other special functions are planned.

NEW CONSTANTS

The following constants are defined.

E = 2.718282
EULER = .5772157
PI = 3.141593

EXTRA LOGARITHMS AND EXPONENTIATION

The following functions are made availble in addition to LOG and EXPT provided by Interlisp.

(EXP X)
E to the power of X. The same as (ANTILOG X).
(LOG2 X)
Same as (LOG X 2.0).
(LOG10 X)
Same as (LOG X 10.0).

EXTRA TRIGONOMETRIC FUNCTIONS


The following functions are made available inaddition to SIN, COS, TAN, ARCSIN, ARCCOS, ARCTAN, and ARCTAN2 provided by Interlisp.

(SEC X RADIANSFLG)
(CSC X RADIANSFLG)
(COT X RADIANSFLG)
(ARCSEC X RADIANSFLG)
(ARCCSC X RADIANSFLG)
(ARCCOT X RADIANSFLG)

HYPERBOLIC FUNCTIONS

The hyperbolic functions are set up similar to the trigonometric functions except that there is no RADIANSFLG. All angles are in radians.

(SINH X)
(SECH X)
(COSH X)
(CSCH X)
(TANH X)
(COTH X)
(ARCSINH X)
(ARCCOSH X)
(ARCTANH X)
(ARCCSCH X)
(ARCSECH X)
(ARCCOTH X)

COMPLEX ARITHMETIC.

Complex numbers are implemented as CONS cells. The CAR is the real part and the CDR is the imaginary part. Macros COMPLEX, REAL, IMAGINARY, and COMPLEXIFY are the best way to assemble and take apart complex numbers.
To keep things speedy, no coercion of real numbers to complex numbers or vice verca is attempted. The user must be sure to supply only complex numbers to functions which take complex args.

COMPLEX0 = (0.0 . 0.0)
Complex number 0.
COMPLEX1 = (1.0 . 0.0)
Complex number 1.
COMPLEXI = (0.0 . 1.0)
Complex number I. The square root of -1.
COMPLEXE = (2.718282 . 0.0)
COMPLEXPI = (3.141593 . 0.0)
(COMPLEX R I)
Returns complex number with real part R and imaginary part I.
(REAL Z)
Returns real part of a complex number.
(IMAGINARY Z)
Returns imaginary part of a complex number.
(COMPLEXIFY R)
Returns complex number with real part R and imaginary part 0.0. The same as (COMPLEX R 0.0).
(CONJUGATE Z)
Returns complex conjugate of Z.
(CZEROP Z)
Predicate tests if complex Z is complex 0.
(CMINUS Z)
(CDIFFERENCE Z1 Z2)
(CPLUS Z1 Z2 ... Zn)
(CTIMES Z1 Z2 ... Zn)
(CQUOTIENT Z1 Z2)
(CABS Z)
Returns real absolute value of Z.
(CARG Z)
Returns real argument of complex Z.
(CLOG Z)
Complex natural logarithm of complex Z.
(CEXP Z)
Complex E to the power of Z. Same as (CANTILOG Z).
(CSQRT Z)
Complex square root of complex Z.

COMPLEX TRIGONOMETRIC FUNCTIONS.

There is no RADIANSFLG arg to any of the complex trigonometric functions. All angles are in radians.

(CSIN Z)
(CCOS Z)
(CTAN Z)
(CCOT Z)
(CSEC Z)
(CCSC Z)
(CARCSIN Z)
(CARCCOS Z)
(CARCTAN Z)
(CARCCSC Z)
(CARCSEC Z)
(CARCCOT Z)

COMPLEX HYPERBOLIC FUNCTIONS.

There is no RADIANSFLG arg to any of the complex hyperbolic functions. All angles are in radians.

(CSINH Z)
(CSECH Z)
(CCOSH Z)
(CCSCH Z)
(CTANH Z)
(CCOTH Z)
(CARCSINH Z)
(CARCCOSH Z)
(CARCTANH Z)
(CARCCSCH Z)
(CARCSECH Z)
(CARCCOTH Z)

PLANS AND COMMENTS.

Functions GAMMA, BETA, ERF, EI, SI, CI, FRESNELSIN, FRESNELCOS, BESSELJ, BESSELY, BESSELI, BESSELK, HANKLE1, HANKLE2, BER, BEI, KER, and KEI are on their way. A small set of extra number theoretic functions are also planned. If you have implemented a worthwhile function or have a better implementation of any of the functions I’m providing in this package, send it to me and I’ll see that it gets in.