Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/gipsy/sub/fie.dc2
Дата изменения: Thu Nov 11 16:55:06 1999
Дата индексирования: Thu Jan 15 20:38:34 2009
Кодировка:

Поисковые слова: п п п п п р п

Document: FIE

Purpose: Describes the routines FIEINI (parses an input string
which contains mathematical expression), FIEDO (which
does the actual calculations) and FIEDUMP (which dumps
the code generated by FIEINI).

Category: MATH

File: fie.c

Author: K.G. Begeman

Description: FIEINI parses an input string which contains a
mathematical formula. The input string may contain:
1) functions; syntax ff(..); where ff is one of the
following available functions:
abs(x) absolute value of x
sqrt(x) square root of x
sin(x) sine of x
asin(x) inverse sine of x
cos(x) cosine of x
acos(x) inverse cosine of x
tan(x) tangent of x
sec(x) secans of x
csc(x) cosecans of x
cot(x) cotangent of x
atan(x) inverse tan of x
atan2(x,y) inverse tan (mod 2pi) x = sin, y = cos
exp(x) exponential of x
ln(x) natural log of x
log(x) log (base 10) of x
sinh(x) hyperbolic sine of x
asinh(x) inverse hyperbolic sine of x
cosh(x) hyperbolic cosine of x
acosh(x) inverse hyperbolic cosine of x
tanh(x) hyperbolic tangent of x
sech(x) hyperbolic secans of x
csch(x) hyperbolic cosecans of x
coth(x) hyperbolic cotangent of x
bj(n,x) Bessel function of 1st kind, integer order
by(n,x) Bessel function of 2nd kind, integer order
bi(n,x) modified Bessel fn. of 1st kind, integer order
bk(n,x) modified Bessel fn. of 2nd kind, integer order
rad(x) convert x to radians
deg(x) convert x to degrees
erf(x) error function of x
erfc(x) 1-error function
sinc(x) sin(x)/x (sinc function)
sign(x) sign of x (-1,0,1)
step(x) returns 1 if x > 0, else 0
rect(x) returns 1 if |x| < 0.5, else 0
mod(x,y) gives remainder of x/y
int(x) truncates to integer
nint(x) nearest integer
ranu(x,y) generates uniform noise between x and y
rang(x,y) generates gaussian noise with mean x
and dispersion y
ranp(x) generates poisson noise with mean x
ifeq(x,y,a,b) returns a if x == y, else b
ifne(x,y,a,b) returns a if x != y, else b
ifgt(x,y,a,b) returns a if x > y, else b
ifge(x,y,a,b) returns a if x >= y, else b
iflt(x,y,a,b) returns a if x < y, else b
ifle(x,y,a,b) returns a if x <= y, else b
ifblank(x,a,b) returns a if x == BLANK, else b

Some (statistical) functions have a variable number
of arguments:

sum(x1,..,xn) sum of elements x1 .. xn
mean(x1,..,xn) mean
var(x1,..,xn) variance
sdev(x1,..,xn) standard deviation
adev(x1,..,xn) absolute deviation
skew(x1,..,xn) skewness
kurt(x1,..,xn) kurtosis
median(x1,..,xn) median
nblanks(x1,..,xn) number of blanks

max(x1,..,xn) maximum of elements x1 .. xn
min(x1,..,xn) minimum

Note that n <= 128

2) constants; syntax cc; where cc is one of the following
available constants:
PI 3.14159....
C speed of light (SI)
H Planck (SI)
K Boltzmann (SI)
G gravitation (SI)
S Stefan-Boltzman (SI)
M mass of sun (SI)
P parsec (SI)
BLANK Universal undefined value
Note: the Hubble constant is not included.
3) operators; syntax op; where op is one of the following
available operators:
+ addition
- subtraction
* multiplication
/ division
** power
4) parameters; syntax $n; where 1 <= n <= 128. A parameter
is a value taken from a real array inserted at the
position of $n in the expression. FIEDO inserts the
parameters in the expression.
Note: With the subroutine fiepar the programmer can
define parameter names.

The working of FIEINI is best explained by an example;
the expression '1.0+exp($1)*sinc($3)' is decoded into
the following commands:

LDC 1.0 ! load constant
LDP 1 ! load parameter 1
FIE EXP ! exp()
LDP 3 ! load parameter 3
FIE SINC ! sinc()
MUL ! *
ADD ! +
HLT ! end of code

This code is stored internally for later processing by
FIEDO. The procedure FIEDUMP displays the internally
stored instructions as shown above on stdin. There are at
the moment 16 different buffers for storage of
instructions.

Notes: 1) The calculations are all done in double precision.
2) FIEDO recognizes BLANK values. Any operation on a
BLANK causes the result to be set to BLANK (except the
function IFBLANK). Also all illegal operations, like
dividing by zero or the logarithm of a negative value,
will cause the result to be set to BLANK.
3) If you cannot find your favorite constant or function
in the list, please contact the author. He might be
persuaded to put it in.

Updates: Mar 11, 1987: RPK original code
Mar 12, 1987: KGB document created
May 28, 1987: KGB RPK bug removed
Oct 27, 1987: RPK KGB bug removed
Aug 15, 1988: KGB RPK bug in decoding reals fixed
Aug 1, 1989: KGB converted to GPS
Mar 28, 1991: KGB parameter names allowed
Feb 21, 1995: KGB/VOG multi-parameter functions added
Feb 7, 1997: JPT named parameters supersede built-in constants.
Jun 30, 1998: JPT implemented Bessel functions.
Aug 11, 1998: JPT fixed bug in nint; added sec, csc, cot, sech,
csch, coth, asinh, acosh, atanh, step and rect.
Nov 11, 1999: VOG Avoid r1 == 0.0 in log in rang function.