home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / MADTRB28.ZIP / COMPLEX.DOC < prev    next >
Encoding:
Text File  |  1985-01-24  |  31.4 KB  |  687 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.           -----------------------------------------------------------
  8.  
  9.                         S R COMPLEX FUNCTION LIBRARY
  10.  
  11.                        For the IBM PC and the IBM PC
  12.                        FORTRAN and  Pascal compilers
  13.  
  14.                                  Version 1.2
  15.  
  16.                   (C) Copyrighted by Robert Fruit, 1984
  17.  
  18.          ------------------------------------------------------------
  19.  
  20.      GENERAL INFORMATION
  21.  
  22.      With the advent of version 2.0 of IBM Pascal and FORTRAN compilers,
  23.      it has become practical to do serious numerical work with them.  In
  24.      accord with the new capabilities of these two compilers, a library of
  25.      functions of complex variables has been developed.  The library
  26.      includes the arithmetic, trigonometric, and transcendental functions,
  27.      in both single and double precision.  That library, COMPLEX.LIB is
  28.      found on this disk.  There are four things that make up the complete
  29.      complex function library.
  30.  
  31.           COMPLEX.DOC   documentation file for the complex function library
  32.           COMPLEX.LIB   complex function library
  33.           COMPLEXP.PAS  example Pascal program using the complex functions
  34.           COMPLEXF.FOR  example FORTRAN program using the complex functions
  35.  
  36.      The documentation has five parts.  The first part is the general
  37.      information that introduces you the the complex function library.  The
  38.      second part is for those who will be using the library with Pascal
  39.      programs.  The third part is for those who will be using the library
  40.      with FORTRAN programs.  The fourth part is specific information needed
  41.      both Pascal and FORTRAN users.  The fifth part contains the information
  42.      on how you can be register owner of the complex function library.  One
  43.      of the advantages of being a registered owner is that you will receive
  44.      40 IBM booklet size pages that describe all the complex functions.
  45.  
  46.      It is recommended that everyone who to us the complex function library
  47.      print and read the entire documentation file, before starting to use
  48.      it.
  49.          ------------------------------------------------------------
  50.  
  51.      NOTICE - A limited license is granted to all users of this library, to
  52.               make copies of this program and distribute them to other
  53.               users, on the following conditions:
  54.  
  55.            1- The notices contained on the first two pages of the
  56.               documentation, and the copyright notice inside the library,
  57.               are not altered or removed.
  58.  
  59.  
  60.  
  61.  
  62.      Documentation for Complex Function Library                      page 2
  63.  
  64.  
  65.  
  66.            2- The library and its documentation are not distributed to
  67.               others in modified form.
  68.  
  69.            3- No fee is to be charged for copying or distributing the
  70.               library or its documentation without an express written
  71.               agreement with Robert Fruit.  Computer clubs are allowed to
  72.               charge a distribution fee, so long as it does not exceed
  73.               $10.00 total.
  74.  
  75.            4- Companies are granted permission by the author to copy the
  76.               complex function library and documentation for use on other
  77.               computers and at other locations in the company, so long as:
  78.  
  79.               a- The full $45.00 registration fee has been paid for the
  80.                  original copy of the library.
  81.  
  82.               b- A usage fee of $25.00 is paid for each additional
  83.                  "building" where the complex function library will be
  84.                  used.  Within any building for which the usage fee has
  85.                  been paid, the complex function library, may be copied
  86.                  freely for use on any computers in that building.
  87.  
  88.      DISCLAIMER - The author has tried to create an error free complex
  89.               function library.  However, the author cannot be held liable
  90.               to you or anyone to whom you pass part of or all of the
  91.               complex library functions, be that as a library or part of
  92.               any program that you create with the library.  The author
  93.               will not be liable for any damages, including any lost
  94.               profits, lost savings, or other incidental or consequential
  95.               damages arising out of the use of, or inability to use these
  96.               library functions, even if the author has been advised of
  97.               the possibility of such damages, or any claim by any other
  98.               party.
  99.  
  100.                   (C) Copyright 1984 by Robert Fruit
  101.                       100 Fuller Rd., Hinsdale, Ill. 60521
  102.  
  103.          ------------------------------------------------------------
  104.  
  105.      PASCAL PROGRAM USERS
  106.  
  107.      All the libraries to be used with Pascal programs were compiled using
  108.      IBM's Pascal Compiler 2.0.  The changes that went into version 2.0 of
  109.      the Pascal compiler are such that programs created using the 2.0
  110.      compiler are not compatible with programs using earlier versions of
  111.      the Pascal compiler.  If you are not using an IBM Pascal compiler of
  112.      version 2.0 or greater, then this library will not be of use to you.
  113.      If someone wants a library to use with an earlier version of Pascal,
  114.      they can request a special service.  At this time I have not experi-
  115.      mented with using the 2.0 library building program with the earlier
  116.      version of IBM's Pascal.  It might be possible to build a library
  117.      for the earlier version of Pascal.  If one cannot be built, your fee
  118.      for the extra service would be returned.
  119.  
  120.  
  121.  
  122.  
  123.      Documentation for Complex Function Library                      page 3
  124.  
  125.  
  126.      All the usual complex functions have been created for this library.
  127.      To use these functions TYPE COMPLEX and DCOMPLEX must be defined,
  128.      before the functions are defined in the program.  The complex types
  129.      are used in defining the complex functions.  The complex type
  130.      declared are:
  131.  
  132.      TYPE
  133.        COMPLEX  = ARRAY[1..2] OF REAL4;
  134.        DCOMPLEX = ARRAY[1..2] OF REAL8;
  135.  
  136.      The complex functions available are:
  137.  
  138.       SINGLE      DOUBLE
  139.      PRECISION   PRECISION     DESCRIPTION
  140.  
  141.      CADD(X,Y)   CDADD(X,Y)    add the complex values X and Y
  142.      CSUB(X,Y)   CDSUB(X,Y)    subtract (X-Y) the complex values X and Y
  143.      CMUL(X,Y)   CDMUL(X,Y)    multiply the complex values X and Y
  144.      CDIV(X,Y)   CDDIV(X,Y)    divide (X/Y) the complex values X and Y
  145.      CINV(X)     CDINV(X)      1/X for complex X
  146.      CNPOWR(N,X) CDNPOWR(N,X)  raise complex X to integer power N
  147.      CNROOT(N,X) CDNROOT(N,X)  take integer root, N, of complex X
  148.      CSQRT(X)    CDSQRT(X)     take square root of complex X
  149.      CEXP(X)     CDEXP(X)      raise e to complex X
  150.      CLN(X)      CDLN(X)       take log to base e of complex X
  151.      CLOGXY(X,Y) CDLOGXY(X,Y)  take log of complex base Y of complex X
  152.      CYX(X,Y)    CDYX(X,Y)     raise complex Y to complex power X
  153.      CSIN(X)     CDSIN(X)      sine of complex X
  154.      CCOS(X)     CDCOS(X)      cosine of complex X
  155.      CTAN(X)     CDTAN(X)      tangent of complex X
  156.      CARCSIN(X)  CDARCSIN(X)   arc sine of complex X
  157.      CARCCOS(X)  CDARCCOS(X)   arc cosine of complex X
  158.      CARCTAN(X)  CDARCTAN(X)   arc tangent of complex X
  159.  
  160.      When the single precision functions are used, the X and Y values are of
  161.      type COMPLEX.  When the double precision functions are used the X and
  162.      Y are of type DCOMPLEX.  The integer, N, is always of the type INTEGER,
  163.      never of the type INTEGER4.
  164.  
  165.      Since no linking is done in the creation of the library, any functions
  166.      used from it can be linked with any of the Pascal compiler libraries.
  167.      If you use the REGMATH version of the Pascal library, then all the
  168.      functions called from the complex function library will have the
  169.      REGMATH properties.  If you use the 8087ONLY version of the Pascal
  170.      library, then all the functions called from the complex function
  171.      library will have the 8087ONLY properties.  It would be advisable that
  172.      no one create a program with the complex library and link with the
  173.      EMULATOR version of the Pascal library.  The time penality that anyone
  174.      without an 8087 co-processor chip would pay, makes the EMULATOR version
  175.      a poor choice.  It would be better to just use the REGMATH version,
  176.      rather than the EMULATOR version, in almost every instance.
  177.  
  178.      Below is an example of the way a Pascal program would define the
  179.      EXTERNAL functions in the complex library.
  180.  
  181.  
  182.  
  183.  
  184.      Documentation for Complex Function Library                      page 4
  185.  
  186.  
  187.      TYPE
  188.        COMPLEX  = ARRAY[1..2] OF REAL4;
  189.        DCOMPLEX = ARRAY[1..2] OF REAL8;
  190.  
  191.      FUNCTION CADD( X,Y : COMPLEX) : COMPLEX; EXTERN;
  192.      FUNCTION CSUB( X,Y : COMPLEX) : COMPLEX; EXTERN;
  193.      FUNCTION CMUL( X,Y : COMPLEX) : COMPLEX; EXTERN;
  194.      FUNCTION CDIV( X,Y : COMPLEX) : COMPLEX; EXTERN;
  195.      FUNCTION CINV( X : COMPLEX): : COMPLEX; EXTERN;
  196.      FUNCTION CNPOWR( N : INTEGER; X : COMPLEX) : COMPLEX; EXTERN;
  197.      FUNCTION CNROOT( N : INTEGER; X : COMPLEX) : COMPLEX; EXTERN;
  198.      FUNCTION CSQRT( X : COMPLEX) : COMPLEX; EXTERN;
  199.      FUNCTION CEXP( X : COMPLEX) : COMPLEX; EXTERN;
  200.      FUNCTION CLN( X : COMPLEX) : COMPLEX; EXTERN;
  201.      FUNCTION CLOGXY( X,Y : COMPLEX) : COMPLEX; EXTERN;
  202.      FUNCTION CYX( X,Y : COMPLEX) : COMPLEX; EXTERN;
  203.      FUNCTION CSIN( X : COMPLEX) : COMPLEX; EXTERN;
  204.      FUNCTION CCOS( X : COMPLEX) : COMPLEX; EXTERN;
  205.      FUNCTION CTAN( X : COMPLEX) : COMPLEX; EXTERN;
  206.      FUNCTION CARCSIN( X : COMPLEX) : COMPLEX; EXTERN;
  207.      FUNCTION CARCCOS( X : COMPLEX) : COMPLEX; EXTERN;
  208.      FUNCTION CARCTAN( X : COMPLEX) : COMPLEX; EXTERN;
  209.  
  210.      The definitions shown here are for single precision functions.  If
  211.      double precision functions are wanted, two things must be done
  212.      differently.  First, the C at the beginning of each function name
  213.      must be changed to CD.  Second, DCOMPLEX must be used in place of
  214.      COMPLEX every place it appears.  If the COMPLEX type were used
  215.      with a function that starts with CD, the program would compile and
  216.      link.  However, there is no telling what the results would be.  The
  217.      program could mysteriously hang up, making you turn the computer off
  218.      to regain control.  Strange results, which may or may not be obviously
  219.      wrong, could be occurring.  Double check all programs to make sure that
  220.      the correct definitions are being used when the functions are defined.
  221.      Never mix single and double precision types in the function calls.  If
  222.      a single precision variable, or number, is to be used in a double
  223.      precision function, convert it before the call is made.  Mixing the
  224.      single and double precision types in the other direction is just as
  225.      bad.
  226.  
  227.      The steps necessary to link a program using the complex function
  228.      library will be covered in the fourth part of this documentation.
  229.  
  230.      With the information provided here, and the example program
  231.      COMPLEXP.PAS, there should be no problems with using the portions of
  232.      the complex function library needed for your Pascal programs.
  233.  
  234.      FORTRAN PROGRAM USERS
  235.  
  236.      All the libraries to be used with FORTRAN programs were compiled using
  237.      IBM's FORTRAN Compiler 2.0.  The changes that went into the 2.0 version
  238.      of the compiler are such that programs created using the earlier version
  239.      of FORTRAN are not compatible.  This means that if you are using an
  240.  
  241.  
  242.  
  243.  
  244.      Documentation for Complex Function Library                      page 5
  245.  
  246.  
  247.      earlier version of FORTRAN, this library will not be of any use to
  248.      you.  If someone wants a library to use with an earlier version of
  249.      FORTRAN, they should request a special service.  I have not experimented
  250.      with using the 2.0 library building program with the earlier versions
  251.      of FORTRAN.  If a library cannot be built, the fee for the extra service
  252.      would be returned.
  253.  
  254.      All the usual complex functions have been created for this library.
  255.      To use these functions, there are a few things that must be known about
  256.      the variables used in the SUBROUTINEs.  The X,Y,and Z have the
  257.      following definitions:
  258.  
  259.      For single precision SUBROUTINEs   REAL*4 X(2),Y(2),Z(2)
  260.      For double precision SUBROUTINEs   REAL*8 X(2),Y(2),Z(2)
  261.  
  262.      The FORTRAN SUBROUTINEs available are:
  263.  
  264.       SINGLE       DOUBLE
  265.      PRECISION    PRECISION     DESCRIPTION
  266.  
  267.      FCADD(X,Y,Z) FCDADD(X,Y,Z) add the complex values X and Y, answer in Z
  268.      FCSUB(X,Y,Z) FCDSUB(X,Y,Z) subtract (X-Y) the complex values X and Y,
  269.                                 answer in Z
  270.      FCMUL(X,Y,Z) FCDMUL(X,Y,Z) multiply the complex values X and Y, answer
  271.                                 in Z
  272.      FCDIV(X,Y,Z) FCDDIV(X,Y,Z) divide (X/Y) the complex values X and Y,
  273.                                 answer in Z
  274.      FCINV(X,Z)   FCDINV(X,Z)   1/X for complex Z, answer in Z
  275.      FCNPR(N,X,Z) FCDNPR(N,X,Z) raise complex X to the integer power N,
  276.                                 answer in Z
  277.      FCNRT(N,X,Z) FCDNRT(N,X,Z) take the integer root N of complex X,
  278.                                 answer in Z
  279.      FCSQR(X,Z)   FCDSQR(X,Z)   take the square root of complex X, answer
  280.                                 in Z
  281.      FCEXP(X,Z)   FCDEXP(X,Z)   raise e to the complex X, answer in Z
  282.      FCLN(X,Z)    FCDLN(X,Z)    take log to base e of complex X, answer
  283.                                 in Z
  284.      FCLGY(X,Z)   FCDLGY(X,Z)   take log to complex base Y of complex X,
  285.                                 answer in Z
  286.      FCYX(X,Y,Z)  FCDYX(X,Y,Z)  raise complex Y to complex power X, answer
  287.                                 in Z
  288.      FCSIN(X,Z)   FCDSIN(X,Z)   sine of complex X, answer in Z
  289.      FCCOS(X,Z)   FCDCOS(X,Z)   cosine of complex X, answer in Z
  290.      FCTAN(X,Z)   FCDTAN(X,Z)   tangent of complex X, answer in Z
  291.      FCASN(X,Z)   FCDASN(X,Z)   arc sine of complex X, answer in Z
  292.      FCACS(X,Z)   FCDACS(X,Z)   arc cosine of complex X, answer in Z
  293.      FCATN(X,Z)   FCDATN(X,Z)   arc tangent of complex X, answer in Z
  294.  
  295.      When the SUBROUTINE is single precision (that is the ones that start
  296.      with FC) the X,Y, and Z are also single precision.  When the SUBROUTINE
  297.      is double precision (that is, the ones that start with FCD) the X,Y, and
  298.      Z are also double precision.  The integer, N, is always INTEGER*2
  299.      regardless of whether the SUBROUTINE is single or double precision.
  300.      That means the integer, N, is never an INTEGER*4.
  301.  
  302.  
  303.  
  304.  
  305.      Documentation for Complex Function Library                      page 6
  306.  
  307.  
  308.      Since no linking is done in the creation of the library, any functions
  309.      used from it can be linked with any of the FORTRAN compiler libraries.
  310.      If you use the REGMATH version of the FORTRAN library, then all the
  311.      functions called from the complex function library will have the
  312.      REGMATH properties.  If you use the 8087ONLY version of the FORTRAN
  313.      library, then all the functions called from the complex function
  314.      library will have the 8087ONLY properties.  It would be advisable that
  315.      no one create a program with the complex library and link with the
  316.      EMULATOR version of the FORTRAN library.  The time penality that anyone
  317.      without an 8087 co-processor chip would pay, makes the EMULATOR version
  318.      a poor choice.  It would be better to just use the REGMATH version,
  319.      rather than the EMULATOR version, in almost every instance.
  320.  
  321.      The FORTRAN compiler expects calls for the complex function to look
  322.      like:
  323.  
  324.      REAL*4 X(2),Y(2),Z(2)
  325.  
  326.      CALL FCADD(X,Y,Z)
  327.      CALL FCSUB(X,Y,Z)
  328.      CALL FCMUL(X,Y,Z)
  329.      CALL FCDIV(X,Y,Z)
  330.      CALL FCINV(X,Z)
  331.      CALL FCNPR(N,X,Z)
  332.      CALL FCNRT(N,X,Z)
  333.      CALL FCSQR(X,Z)
  334.      CALL FCEXP(X,Z)
  335.      CALL FCLN(X,Z)
  336.      CALL FCLGY(X,Y,Z)
  337.      CALL FCYX(X,Y,Z)
  338.      CALL FCSIN(X,Z)
  339.      CALL FCCOS(X,Z)
  340.      CALL FCTAN(X,Z)
  341.      CALL FCASN(X,Z)
  342.      CALL FCACS(X,Z)
  343.      CALL FCATN(X,Z)
  344.  
  345.      FORTRAN assumes that all CALLs are for external subroutines, so the
  346.      link step will look for the names in the libraries.
  347.  
  348.      The definitions shown here are for single precision functions.  If
  349.      double precision functions are wanted, two things must be done
  350.      differently.  First, the FC at the beginning of each subroutine name
  351.      must be changed to FCD.  Second, the REAL*4 must be a REAL*8.  If
  352.      the REAL*4 number type was used with the double precision functions,
  353.      the program would compile and link.  However, there is no telling what
  354.      the results would be.  The program could mysteriously hang up, making
  355.      you turn off the computer to regain control.  Strange results, which may
  356.      or may not be obviously wrong, could be occurring.  Double check all
  357.      programs to make sure that the correct definitions are being used when
  358.      the functions are called.  Never mix single and double precision
  359.      definitions in the functions calls.  If a single precision variable
  360.      is to be used in a double precision function, convert the variable
  361.  
  362.  
  363.  
  364.  
  365.      Documentation for Complex Function Library                      page 7
  366.  
  367.  
  368.      before the call is made.  Mixing the single and double precision
  369.      definitions in the other direction is just as bad.
  370.  
  371.      The steps necessary to link a program using the complex function
  372.      library will be covered in the fourth part of this documentation.
  373.  
  374.      With the information provided here, and the example program
  375.      COMPLEXF.FOR, there should be no problem using the portions of the
  376.      library needed for your FORTRAN programs.
  377.  
  378.      EVERYONE USING THE COMPLEX FUNCTION LIBRARY
  379.  
  380.      Due to the differences in the FORTRAN and Pascal compilers, there are
  381.      two sets of the complex functions in the library, one for Pascal
  382.      programs, and one for FORTRAN programs.  It was easier to write them
  383.      twice than it was to make one set work with both compilers.  This
  384.      means that the FORTRAN subroutines should never be called by a
  385.      Pascal program, and the Pascal functions should never be called by a
  386.      FORTRAN program.  Creating two sets of all the functions makes the
  387.      complex function library about 75% larger than it would otherwise be,
  388.      if one set of the functions could be made available to both languages.
  389.  
  390.      The link step must be changed slightly to call in the complex function
  391.      library.  For this example it will be assumed that the Pascal example
  392.      program was used on a computer with two disk drives.  The linker disk
  393.      will be in drive A:, and the program object file, COMPLEXP.OBJ, and
  394.      the complex function library, COMPLEX.LIB, will be in drive B:.  Call
  395.      up the linker as you normally would, then:
  396.  
  397.          Object Modules [.OBJ]: COMPLEXP
  398.          Run File [COMPLEXP.EXE]:
  399.          List File [NUL.MAP]:
  400.          Libraries [.LIB]: B:COMPLEX.LIB,A:PASCAL.LIB
  401.  
  402.      Notice the only thing that you are doing differently is on the
  403.      libraries line.  Then, not only is the location of the libraries given,
  404.      but its full name is given also.  If you follow this step exactly, then
  405.      you will have no problem in compiling the example program.  If you
  406.      want to compile the FORTRAN library, then its link step would look
  407.      like:
  408.  
  409.          Object Modules [.OBJ]: COMPLEXF
  410.          Run File [COMPLEXF.EXE]:
  411.          List File [NUL.MAP]:
  412.          Libraries [.LIB]: B:COMPLEX,A:FORTRAN.LIB
  413.  
  414.      There are six reserved words in the library.  If they are used in such a
  415.      way that the complier will check for them in the library then unpredict-
  416.      able things may happen.  Those reserved word are:
  417.  
  418.          ACOPYRIGHT               FARSN               FDRC2P
  419.          COMPLEXS                 FDARSN              FRC2P
  420.  
  421.  
  422.  
  423.  
  424.      Documentation for Complex Function Library                      page 8
  425.  
  426.  
  427.      The best advice is not to use the reserve words anywhere in programs
  428.      that will be linked using the complex function library.
  429.  
  430.      Should there be any difficulty with using the complex function library
  431.      or the example program, contact me, Robert Fruit, at:
  432.  
  433.          Robert Fruit
  434.          Simulation Rule
  435.          100 Fuller Road
  436.          Hinsdale, Ill. 60521
  437.  
  438.     Below is an sample of the program COMPLEXP.PAS, using a complex X of
  439.     1.25 1.5, and a complex Y of 0.75 1.4, and an integer N of 8.  This
  440.     sample will let you compare the results you get with the correct values.
  441.  
  442.      COMPLEXP
  443.  
  444.      What is the complex X? 1.25 1.5
  445.      What is the complex Y? .75 1.4
  446.      What is the integer N? 8
  447.                     COMPLEX FUNCTION TEST
  448.  
  449.         X REAL         X COMPLEX          Y REAL        Y COMPLEX       N
  450.         1.25000          1.5000           0.75000         1.40000        8
  451.  
  452.      X + Y =                    2.00000     2.90000
  453.      X - Y =                    0.50000     0.10000
  454.      X * Y =                   -1.16250     2.87500
  455.      X / Y =                    1.20416    -0.24777
  456.      X TO THE N POWER =       158.09690   140.14530      0.00354   -0.00314
  457.      N ROOT OF X =              1.94454     0.17678      1.94454    0.17678
  458.      SQUARE ROOT OF X =         1.26542     0.59269      1.25000    1.50000
  459.      E TO THE X POWER =         0.24690     3.48160      1.25000    1.50000
  460.      E TO THE -X POWER =        0.02027    -0.28579      1.25000    1.50000
  461.      COMPLEX LN(X) =            0.66914     0.87606      1.25000    1.50000
  462.      LOG OF X BASE Y =          0.91045    -0.22979      1.25000    1.50000
  463.      Y TO THE X POWER =        -0.16063     0.31477      1.25000    1.50000
  464.      COMPLEX SIN(X) =           2.23240     0.67141      1.25000    1.50000
  465.      COMPLEX COS(X) =           0.74177    -2.02065      1.25000   -1.50000
  466.      COMPLEX TAN(X) =           0.06458     1.08108      1.25000    1.50000
  467.      COMPLEX ARCSIN(X) =        0.63321     1.37956      1.25000    1.50000
  468.      COMPLEX ARCCOS(X) =        0.93759    -1.37956      1.25000    1.50000
  469.      COMPLEX ARCTAN(X) =        1.20748     0.36525      1.25000    1.50000
  470.  
  471.      For the four arithmetic operations (+,-,*,/) it is easy to check that
  472.      that the real and complex parts of the results shown are correct.
  473.      However, for the other functions, it is not obvious what the correct
  474.      results should be.  To help with seeing that a function is working,
  475.      the function and its inverse are shown on the same line.  The first
  476.      two numbers are the real and complex parts of applying the function.
  477.      The third and fourth column are the real and complex parts after
  478.      applying the function's inverse to the values in columns one and
  479.      two.
  480.  
  481.  
  482.  
  483.  
  484.      Documentation for Complex Function Library                      page 9
  485.  
  486.  
  487.      There is one exception to this display of a function and its inverse.
  488.      That occurs on the lines 'X to the N power' and 'N root of X'.  Since
  489.      the inverse function is on the line below, the inverse of X to the N
  490.      power, is found on the line below.  The values in columns three and
  491.      four are the negative powers of N used on the same X.  As in columns
  492.      one and two, the inverse is on the line below.
  493.  
  494.      One thing that should be remembered in complex functions is that
  495.      applying a function, and then applying the function's inverse to
  496.      the results, may not return you to the original value.  Usually, the
  497.      difference is either a multiple of Pi, or a half integer multiple of
  498.      Pi.  So don't assume that different results automatically mean that
  499.      something is wrong.
  500.  
  501.      The minus sign on the 1.5 on the COS(X) might surprise you, but it is
  502.      correct.  Remember that COS(X) = COS(-X), so when the inverse of the
  503.      function is run, it cannot know what the sign should be.  This is just
  504.      as it is with the square root function.  The sign on the square root
  505.      of a number can be either + or -.  The + sign is usually shown, just
  506.      because that is the convention, but it doesn't need to be that way.
  507.      This is another way answers can be different, and still be correct.
  508.  
  509.      There is another line that may appear wrong because the inverse does
  510.      not return the original values.  That is the N root of X line.  This
  511.      is another example of how the trigonometric nature of complex functions
  512.      does not always act in a manner we would expect from past experience.
  513.      The values shown above, 1.94454  0.17678, are correct.
  514.  
  515.      Below is a sample using the COMPLEXF.FOR program, using a complex X of
  516.      1.41421 0, and a complex Y of 1.73205 0, and an integer N of 2.  This
  517.      sample will let you compare your results and see that you are getting
  518.      the correct answers.
  519.  
  520.      COMPLEXF
  521.  
  522.      What is the complex X?
  523.        1.41421  0.00000
  524.      What is the complex Y?
  525.        1.73205  0.00000
  526.      What is the integer N?
  527.         2
  528.  
  529.                     COMPLEX FUNCTION TEST
  530.  
  531.         X REAL         X COMPLEX          Y REAL        Y COMPLEX       N
  532.         1.41421          0.00000          1.73205         0.00000        2
  533.  
  534.      X + Y =                    3.14626     0.00000
  535.      X - Y =                   -0.31784     0.00000
  536.      X * Y =                    2.44949     0.00000
  537.      X / Y =                    0.81650     0.00000
  538.      X TO THE N POWER =         1.99999     0.00000      0.50000    0.00000
  539.      N ROOT OF X =              1.41421     0.00000      1.41421    0.00000
  540.      SQUARE ROOT OF X =         1.18921     0.00000      1.41421    0.00000
  541.  
  542.  
  543.  
  544.  
  545.      Documentation for Complex Function Library                      page 10
  546.  
  547.  
  548.      E TO THE X POWER =         4.11325     0.00000      1.41421    0.00000
  549.      E TO THE -X POWER =        0.24312     0.00000      1.41421    0.00000
  550.      COMPLEX LN(X) =            0.34657     0.00000      1.41421    0.00000
  551.      LOG OF X BASE Y =          0.63093     0.00000      1.41421    0.00000
  552.      Y TO THE X POWER =         2.17458     0.00000      1.41421    0.00000
  553.      COMPLEX SIN(X) =           0.98777     0.00000      1.41421    0.00000
  554.      COMPLEX COS(X) =           0.15594     0.00000      1.41421    0.00000
  555.      COMPLEX TAN(X) =           6.33412     0.00000      1.41421    0.00000
  556.      COMPLEX ARCSIN(X) =        0.00000     0.00000      0.00000    0.00000
  557.      COMPLEX ARCCOS(X) =        1.57080     0.00000      0.00000    0.00000
  558.      COMPLEX ARCTAN(X) =        0.95532     0.00000      1.41421    0.00000
  559.  
  560.      The zeros in the arcsin and arccos lines occur because their is a
  561.      special arcsin function internal to the library, that sets the arcsin
  562.      value to zero when its argument exceeds 1.
  563.  
  564.      BECOMING A REGISTERED OWNER
  565.  
  566.       The four points listed on the first two pages in the general infor-
  567.       mation section covers the main points of becoming a registered
  568.       owner of the complex function library.
  569.  
  570.       The cost of becoming a registered owner of the complex function
  571.       library is $45.00.  The benefits of being a registered owner are:
  572.  
  573.          You will receive a set of 40 pages for your IBM compiler books.
  574.          The 40 pages are a complete descriptions of all the available
  575.          functions in the complex function library.
  576.  
  577.          You will receive free one up-date of the complex function library,
  578.          should one be necessary, up to one year after you are register.  If
  579.          a company with multiple locations is the registered owner, the
  580.          alternate locations will receive a notice about the up-date.
  581.  
  582.          You will receive any notices that are sent out about the complex
  583.          function library, and other products that Simulation Rule has
  584.          developed.  This should be of particular value to people who are
  585.          not using the IBM compilers.  Simulation Rule will act as a
  586.          clearing house of other compilers which can be linked with the
  587.          complex library.  As information warrants notices will be sent
  588.          to registered owners.
  589.  
  590.      The last page of this documentation can be used as a bill for regis-
  591.      tering, and for requesting special services.  If the last page is not
  592.      used make sure that all the information requested is included in your
  593.      mailing to become registered.
  594.  
  595.      This is part of the experiment in distributing computer programs by
  596.      user-support.  This is based on the beliefs that:
  597.  
  598.        1- The value and utility of the library is best assessed by the
  599.           user in their own system.
  600.  
  601.  
  602.  
  603.  
  604.      Documentation for Complex Function Library                      page 11
  605.  
  606.  
  607.        2- The creation of personal computer programs can and should be
  608.           supported by the computing community.
  609.  
  610.        3- The copying of programs should be encouraged, rather than
  611.           restricted.
  612.  
  613.      This means anyone may legally obtain an evaluation copy of the program
  614.      from a friend or computer club.  After you have had a chance to use
  615.      and evaluate the library in your own environment, you are trusted to
  616.      either forward the registration fee to the author, or to discontinue
  617.      using the library.  In any case, you are encouraged to copy the
  618.      library for evaluation by others.
  619.  
  620.      The free distribution of the library and the voluntary payment for its
  621.      use eliminates the cost for advertising and distributing the library.
  622.      You obtain quality programs at a greatly reduced cost, get the
  623.      opportunity to try it before buying it, and you get to do so at your
  624.      own pace, in the convenience of your own home or office.  In this
  625.      environment only the best programs will survive.
  626.  
  627.      Join the experiment, support user supported programs.
  628.  
  629.  
  630.  
  631.                      COMPLEX FUNCTION LIBRARY 1.1
  632.  
  633.      Robert Fruit
  634.      Simulation Rule
  635.      100 Fuller Road
  636.      Hinsdale, Ill. 60521
  637.  
  638.  
  639.          Complex Function Library          $45.00        ___________
  640.  
  641.          1.0 compiler versions of library   12.00        ___________
  642.          (specify if it is to be Pascal or FORTRAN)
  643.  
  644.          Other services $12.00 additional each (specify)
  645.  
  646.          _____________________              12.00        ___________
  647.  
  648.          _____________________              12.00        ___________
  649.  
  650.          Other buildings where the complex function
  651.          library will be used (give addresses on back
  652.          if they are to receive notice of updates).
  653.          number of buildings ____  @ $25.00 each         ___________
  654.  
  655.      Total                                               ___________
  656.  
  657.      You can purchase a copy of the source code that was used to create
  658.      the complex function library.  The source code version of the library
  659.      costs $750.00 and requires that you sign a non-disclosure form.  Both
  660.      the money and the non-disclosure form must be sent to Simulation Rule
  661.      before the source code version of the library will be sent.  Write
  662.      to Simulation Rule to get the bill and the non-disclosure form.
  663.  
  664.      Registration information              registration date ___/___/___
  665.  
  666.      Company           _____________________________
  667.  
  668.      Contact person    _____________________________
  669.  
  670.      Address           _____________________________
  671.  
  672.      City, State       _____________________________  Zip _________
  673.  
  674.      Have you had any difficulty with the complex function library or its
  675.      documentation?  If so, please use this space to comment.
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.      Are there any other services that Simulation Rule could be providing
  684.      for you?  If so, please state what they may be.  Simulation Rule
  685.      specializes in creating simulations and making complicated
  686.      mathematical functions easy for others to use.
  687.