eX version 0.4b User's Manual                         File eXMan21.txt
(C) Copyright 1995, 1996 William E. Wilgus III.   All rights reserved.


Numeric Functions
 

!
                         ! eev#
     Returns the factorial of eev#.  (Argument values are converted to
     data type long.)

abs
                         abs eev#
     Returns the absolute value of the numeric argument.

byte  (Not available in eX Lite.)
               byte<<$>>(eev#, ByteNumber#) <<:= eev#>> 
     Returns the value of ByteNumber# within eev#.  Bytes are numbered
     from right to left beginning with zero (0).  (No compensation
     should be made for the lsb ... msb order of storage.)  If the
     string suffix $ is used, a string with the binary 
     representation of the byte is returned.  It is assignable except
     for sequential files; however, only a numeric in the range 
     0--255 may be employed as the assignment value.  

combins  (Not available in eX Lite.)
                         combins(n#, r#)
     Returns the number of combinations of n# items taken r# at  
     a time.  

dword  (Not available in eX Lite.)
               dword<<$>>(eev#, n#) <<:= eev#>>
     Returns the nth double word (4 bytes) from eev#, which is  
     evaluated as a long data type.  If the string suffix $ is used, a
     string with the binary representation of the double word is
     returned.  Words are numbered from right (1) to left.  (No
     compensation should be made for the lsb ... msb order of
     storage.)  It is assignable except for sequential files.

e  (Not available in eX Lite.)
     Returns Euler's constant, 2.718281828459045, which is the base of
     natural logarithms.  

exp  
                         exp eev#
     Returns e to the power of eev#, where eev# <= 88.02969.

frac
                         frac eev#
     Returns the fractional part of eev#.

gcd  (Not available in eX Lite.)
                         gcd(n1#, n2#)
     Returns the greatest common denominator of n1# and n2#.  

int
                         int eev#
     Returns the largest integer <= to eev#.  

log
                         log eev#
     Returns the natural log for eev#, which must be > 0.

log10  (Not available in eX Lite.)
                         log10 eev#
     Returns the base 10 log for eev#, which must be > 0.

logX  (Not available in eX Lite.)
                         logX(n#, X#)
     Returns the base X# log for n#, which must be > 0.

permutes  (Not available in eX Lite.)
                         permutes(n#, r#)
     Returns the permutations of n# things taken r# at a time.

pi  (Not available in eX Lite.)
     Returns the value of pi (3.141592653589793).

prime  (Not available in eX Lite.)
                         prime eev#
     Returns true (-1) if eev# is prime, false (0) if not.  This
     function currently converts the argument to, and performs the
     test using data type long.

QuadEq  (Not available in eX Lite.)
                    QuadEq(a#, b#, c#)
     Solves the quadratic equation ax^2 + bx + c = 0 and returns a 
     result code:  

          0   There is no real-number solution. 
              The real part of the solution is in QuadEq1, and
              the imaginary part is in QuadEq2.  
          1   There is 1 real-number solution.
              The root is in QuadEq1.
          2   There are 2 real-number solutions.
              The first root is in QuadEq1, and
              the second root is in QuadEq2.

QuadEq1  (Not available in eX Lite.)
     Returns the quadratic equation solution component #1.  
     See QuadEq.

QuadEq2  (Not available in eX Lite.)
     Returns the quadratic equation solution component #2.  
     See QuadEq.  

rnd
     Returns a psuedo-random number.  There are three forms of rnd:

     rnd        returns the next random number in the sequence.
     rnd(n#), where
          n > 0 returns the next random number in the sequence
          n = 0 returns the last number generated
          n < 0 always returns the same number for any given n

     rnd(n1#, n2#) produces random floating point numbers in the
                range n1 <= random# <= n2

     (Note that no un-parenthesized argument form exists.)

rndint
                    rndint(n1#, n2#)
     Produces random integer numbers in the range  
                   n1 <= random# <= n2

root  (Not available in eX Lite.)
                    root(number#, order#)
     Returns the order order# root of number#, which may be negative.
     The precision is within 

                    +/- number# / 10.0^15

     For order 2 use sqr; it is faster and more accurate.

round
                    round(eev#, n#)
     Returns eev# rounded to n# decimal places.  Note that an n# of
     0 is valid and rounds eev# to an integer value.  If n# is given
     as a negative, the integer portion of eev# is rounded.  (Neat?) 
               round(1.05, 1)    returns   1.1
               round(1.05, 0)    returns   1.0
               round(2530, -2)   returns   2500

sign
                         sign eev#
     Returns a code indicating the sign of the argument, interpreted

     Result   Meaning
         1    eev# > 0
         0    eev# = 0
        -1    eev# < 0

     Rocket science!

sqr
                         sqr eev#
     Returns the square root of eev#.  See also root.

srnd
                        srnd<<(eev#)>>
     Seeds the random number generator and is otherwise inert.
     Valid arguments are in the range -32768 to 32767 and may contain
     a fractional part.  If no argument is given, the random number
     generator is seeded using esecs.  The un-parenthesized argument
     form is not allowed.

trunc
                         trunc eev#
     Returns eev# minus any fractional part.  See also frac, int. 


 
Financial Functions

In all of the financial functions, the argument identified as  

                         InterestRate#

is to be given as a percent.  That is, 12% should be given as 12.0,
not 0.12.  Further, the rate given should be appropriate for the
length of the period used in the argument  Periods#.  For example, to
determine the future value of $1,000.00 at 12% annual interest
compounded monthly for 2 years, the eXpression would be  

               fv(1000, 12 % / 12, 2 % * 12)

or 

                    fv(1000, 1, 24)


aPeriods  (Not available in eX Lite.)
          aPeriods(PaymentAmount#, FutureValue#, InterestRate#)     
     Returns the number of periods required by a level payment annuity     
     to reach the specified future value.  

CIPeriods  (Not available in eX Lite.)
          CIPeriods(PresentValue#, FutureValue#, InterestRate#) 
     Returns the number of periods required for the investment 
     PresentValue# (principal), to reach FutureValue# at compound
     interest InterestRate#.  

cir  (Not available in eX Lite.)
               cir(PresentValue#, FutureValue#, Periods#)
     Returns the compound interest rate required for a present value
     to grow to a future value during the time periods.

DDB  (Not available in eX Lite.)
               DDB(cost#, <<salvage#, >> life#, period#)
     Returns the depreciation expense for a specific period using  
     the Double-Declining-Balance Method, which is an accelerated
     method.  The optional argument salvage# should be given,
     particularly if period# is equal to life#, to prevent total
     depreciation from exceeding cost# - salvage#.  See also SYD.

EOQ  (Not available in eX Lite.)
          EOQ(PeriodUse#, UnitPeriodCarryingCost#, CostPerOrder#) 
     Returns the Economic Order Quantity, which is a trade-off between
     ordering costs and inventory carrying costs.

fv  (Not available in eX Lite.)
          fv(PresentValue#, InterestRate#, Periods#)
     Returns the future value (sometimes referred to as Terminal
     Value) of PresentValue# (principal) if invested at 
     InterestRate# for Periods#.

fva  (Not available in eX Lite.)
               fva(Payment#, InterestRate#, Periods#)
     Returns the future value of an annuity (stream of level payments)
     at InterestRate# for Periods#.

payment  (Not available in eX Lite.)
          payment(Principal#, InterestRate#, Periods#)
     Returns the payment amount for a loan of Principal# for  
     Periods# at InterestRate#.  It uses the formula

          Principal * (Interest / (1 - (1 + Interest)^-Periods))

     Payment amounts are calculated in different ways by different  
     financial institutions, and this formula may not provide anything
     closer than a `ball park' figure, but still may be useful in
     determining a loan's `afford-ability'.  The eXpression 

          Periods# * payment(Principal#, InterestRate#, Periods#) 
     might be useful in deciding if you really want that new car!  

pv  (Not available in eX Lite.)
               pv(FutureValue#, InterestRate#, Periods#)
     Returns the present value of FutureValue#, which will earn
     compound interest InterestRate# for Periods#.

pva  (Not available in eX Lite.)
               pva(Payment#, InterestRate#, Periods#)
     Returns the present value of an annuity (stream of level
     payments) of Payment# for Periods# at InterestRate#.

SYD  (Not available in eX Lite.)
               SYD(cost#, salvage#, life#, period#)
     Returns the depreciation expense for a specific period using  
     the Sum of the Years-Digits Method, which is an accelerated  
     method.  (The straight-line depreciation is, of course,
     (cost# - salvage#) / life#.)  See also DDB.

 
 
Trigonometric Functions
 
All of the Trig functions require that any angle argument(s) be
expressed in radians.  For those functions that return angles, the
angles are expressed in radians.  
 

Angle Functions
 
Each of the angle functions a `filter' function and the argument may
be un-parenthesized.  Therefore, I submit the following pro-forma to
cover them all: 

                    function argument#


acos  (Not available in eX Lite.)
     Arc, or inverse cosine: returns the angle whose cosine is 
     cosine#, where -1 < cosine# < 1.

acosh  (Not available in eX Lite.)
                    acosh HyperbolicCosine#
     Arc, or inverse hyperbolic cosine: returns the angle whose
     hyperbolic cosine is HyperbolicCosine#, 
     where HyperbolicCosine# > 1. 

acsc  (Not available in eX Lite.)
                         acsc cosecant#
     Arc, or inverse cosecant: returns the angle whose cosecant is 
     cosecant#, where cosecant# < -1 or cosecant# > 1. 

acsch  (Not available in eX Lite.)
                    acsch HyperbolicCosecant#
     Arc, or inverse hyperbolic cosecant: returns the angle whose
     hyperbolic cosecant is HyperbolicCosecant#, where 
     HyperbolicCosecant# <> 0. 

actn  (Not available in eX Lite.)
                    actn cotangent#
     Arc, or inverse cotangent: returns the angle for the cotangent 
     Cotangent#.

actnh  (Not available in eX Lite.)
                  actnh HyperbolicCotangent#
     Arc, or inverse hyperbolic cotangent: returns the angle whose
     hyperbolic cotangent is HyperbolicCotangent#, where 
                 HyperbolicCotangent# > 1.

asec  (Not available in eX Lite.)
                         asec secant#
     Arc, or inverse secant: returns the angle whose secant is
     secant#, where Secant# < -1 or Secant# > 1.

asech  (Not available in eX Lite.)
                    asech HyperbolicSecant#
     Arc, or inverse hyperbolic secant: returns the angle whose
     hyperbolic secant is HyperbolicSecant#, where 
                    0 < HyperbolicSecant# < 1.

asin  (Not available in eX Lite.)
                         asin sine#
     Arc, or inverse sine: returns the angle whose sine is sine#, 
     where -1 < Sine# < 1.

asinh  (Not available in eX Lite.)
                    asinh HyperbolicSine#
     Arc, or inverse hyperbolic sine: returns the angle whose
     hyperbolic sine is HyperbolicSine#.

atan
                         atan tangent#
     Arc, or inverse tangent: returns the angle whose tangent is  
     tangent#.

atanh  (Not available in eX Lite.)
                    atanh HyperbolicTangent#
     Arc, or inverse hyperbolic tangent: returns the angle whose
     hyperbolic tangent is HyperbolicTangent#, where 
                    0 <= HyperbolicTangent# < 1.

cos  
     Returns the cosine of RadianAngle#. 

cosh  (Not available in eX Lite.)
     Returns the hyperbolic cosine of RadianAngle#, where
                    0 < RadianAngle# < 1. 

csec  (Not available in eX Lite.)
     Returns the cosecant of RadianAngle#, where
                    RadianAngle# <> 0. 

csech  (Not available in eX Lite.)
     Returns the hyperbolic cosecant of RadianAngle#, where
                    RadianAngle# <> 0.

ctan  (Not available in eX Lite.)
     Returns the cotangent of RadianAngle#, where
                RadianAngle# <> 0, <> pi (180^0). 

ctanh  (Not available in eX Lite.)
     Returns the hyperbolic cotangent of RadianAngle#, where
                    RadianAngle# <> 0.

hsin  (Not available in eX Lite.)
     Returns the haversine of RadianAngle#.

sec  (Not available in eX Lite.)
     Returns the secant of RadianAngle#.

sech  (Not available in eX Lite.)
     Returns the hyperbolic secant of RadianAngle#.

sin
     Returns the sine of RadianAngle#.

sinh  (Not available in eX Lite.)
     Returns the hyperbolic sine of RadianAngle#.

tan
     Returns the tangent of RadianAngle#.

tanh  (Not available in eX Lite.)
     Returns the hyperbolic tangent of RadianAngle#.


 
Triangle Functions


The four cases in the solution of triangles are:  

     Case I,   given two angles and a side.  
     Case II,  given two sides and an angle opposite one of them.  
     Case III, given two sides and the included angle.  
     Case IV,  given three sides.  


The examples given for the triangle functions that follow use the
component labels in the Figure `The Components and Points of a
Triangle', supplied in seperate printed form, as arguments.  They are:


     The sides a, b, and c.
     The (internal) angles alpha, beta, and gamma.
     The points A, B, and C.
     The radius, r.
     The height h. 

All of the angle arguments in the triangle functions may optionally be
given as the external angle, which for any angle theta in degrees is

                         360^o - theta

and in radians is  
                         2pi - theta

While it is un-likely that the external angle would be known (and the
internal angle un-known), the circumstance has been provided for.  

Most of the triangle function names employ the term `trigon', which is
a synonym for triangle.  It was chosen over the more conventional 
triangle simply because it has fewer characters and, un-like an
abbreviation, is a standard (although obscure).


aTrigon1  (Not available in eX Lite.)
        aTrigon1(OppAngleRadians#, AdjacAngleRadians#, SideOpposite#)
        aTrigon1(alpha, beta, a)
        aTrigon1(alpha, gamma, a)
     Returns the area of Case I triangles.  The arguments must be
     given in their order in the triangle; that is, the angle opposite
     the given side must be first.

aTrigon3  (Not available in eX Lite.)
          aTrigon3(AdjacSide1#, InclAngleRadians#, OtherAdjacSide#)
          aTrigon3(c, alpha, b)
          aTrigon3(b, alpha, c)
     Returns the area of Case III triangles.  The arguments must be
     given in their order in the triangle; either side may be given
     first.  

aTrigon4  (Not available in eX Lite.)
               aTrigon4(Side1#, Side2#, Side3#)
               aTrigon4(a, b, c)
               aTrigon4(c, b, a)
     Returns the area of Case IV triangles.  The arguments must be
     given in their order in the triangle; either clock-wise or
     counter clock-wise.

hTrigon  (Not available in eX Lite.)
          hTrigon(AdjacentSide#, AdjacentAngleRadians#)
          hTrigon(a, beta)
          hTrigon(b, alpha)
     Height of a triangle function.  Given either side (other than the
     hypotenuse) and the included angle between that side and the
     hypotenuse, returns the height of the triangle.  The order that
     the arguments are given must be side, angle.

hypot  (Not available in eX Lite.)
                    hypot(side A, side B)
     Returns the hypotenuse of a right triangle.  

rTrigon  (Not available in eX Lite.)
               rTrigon(Side 1, Side 2, Side 3)
     Returns the radius of the circle inscribed within the triangle. 
     The arguments may actually be given in any order.  

trigon1a  (Not available in eX Lite.)
         trigon1a(OppAngleRadians, AdjacAngleRadians, SideOpp)
     Solves Case I triangles by the Law of Sines, returning the side
     adjacent the first angle argument that is not the side included
     between the two given angle arguments.  Hence, the raison d'etre
     of the terminal a in the function name.  The arguments must be
     given in their order in the triangle; that is, the angle opposite
     the given side must be first.  

               trigon1a(alpha, beta, a)    returns   b.
               trigon1a(alpha, gamma, a)   returns   c. 


trigon1i (Not available in eX Lite.)
          trigon1i(OppAngleRadians, AdjacAngleRadians, SideOpp)
     Solves Case I triangles by the Law of Sines, returning the side
     included between the two given angle arguments.  Therefore the
     terminal i in the function name.  The arguments must be given in
     their order in the triangle---either clock-wise  or counter
     clock-wise. That is, the angle opposite the given side must be 
     first.  

               trigon1i(alpha, beta, a)    returns   c.
               trigon1i(alpha, gamma, a)   returns   b.

trigon2  (Not available in eX Lite.)
               trigon2(SideOpp, SideAdj, OppAnglRadians)
     Attempts to solve Case II triangles (the ambiguous case) for the 
     (un-known) side adjacent to the angle argument given by the Law
     of Sines, returning the number of solutions found, either 0, 1,
     or 2.  The solutions, if any, may be obtained by the eX words
     trigon21 and trigon22.  The arguments must be given in their
     order in the triangle---either clock-wise or counter clock-wise.
     That is, the side opposite the angle argument given must be
     first.  

               trigon2(a, b, alpha)   solves for   c.
               trigon2(b, a, beta)    solves for   c.

trigon21  (Not available in eX Lite.)
     Returns solution one 1 of trigon2's last invocation, if any.  
     It does not take an argument. See trigon2. 

trigon22  (Not available in eX Lite.)
     Returns solution two 2 of trigon2's last invocation, if any.  
     It does not take an argument. See trigon2.

trigon3  (Not available in eX Lite.)
               trigon3(Side, InclAngleRadians, OtherSide)
     Solves Case III triangles by the Law of Cosines, returning the
     third side.  The arguments may be given in either clock-wise or
     counter clock-wise order.  

               trigon3(a, beta, c)   returns   b.
               trigon3(c, beta, a)   returns   b.

trigon4  (Not available in eX Lite.)
               trigon4(side 1, side 2, side 3)
     Solves Case IV triangles by the Law of Cosines, returning the
     angle opposite the first side argument in radians.  The arguments
     may be given in either clock-wise or counter clock-wise order.

          trigon4(a, b, c)   returns   a.
          trigon4(c, b, a)   returns   c.

