home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / RMATH.ZIP / CMATH.DOC next >
Encoding:
Text File  |  1990-08-17  |  7.3 KB  |  247 lines

  1. CMATH -- a unit of complex mathematical routines for Turbo Pascal
  2.          versions 4, 5, and 5.5
  3.  
  4.          Copyright 1990, by J. W. Rider
  5.  
  6. CMATH.PAS provides a library of type definitions, functions and
  7. procedures for manipulation of mathematically complex variables
  8. (having both a "real" part and an "imaginary" part) for immediate
  9. use within Turbo Pascal programs (tested with version 5.5).
  10. Routines are provided for:
  11.  
  12.         Binary operators:
  13.                 cadd, csub, cmult, cdiv, cpow
  14.  
  15.         Exponenential, power-raising, and logarithmic procedures:
  16.                 cexp, cln, csqr, csqrt
  17.  
  18.         Circular and hyperbolic trigonometric procedures and
  19.         inverses:
  20.                 casin, casinh, cacos, cacosh, catan, catanh,
  21.                 csin, ccos, ctan, csinh, ccosh, ctanh
  22.  
  23.         Conversion functions:
  24.                 cabs, conj, cneg, cnjx, crecip, csqr, csqrt,
  25.                 phase
  26.  
  27.         Polynomial evaluation:
  28.                 cpoly
  29.  
  30.  
  31. Depending upon whether software or hardware numeric processing
  32. enabled, CMATH will use either MATH.TPU or MATH87.TPU,
  33. correspondingly.
  34.  
  35. General design approach:  While this implementation does not take
  36. advantage of the object-oriented syntax of TP5.5, the approach is
  37. still object-oriented.  Each complex variable is considered to be
  38. an object that "knows" how to do a variety of manipulations on
  39. itself.  Porting these units to a purer object-oriented form
  40. should be straight forward, but is otherwise left as an exercise
  41. for the reader.
  42.  
  43.         In order to improve performance, none of the CMATH
  44. routines perform any range-checking for invalid values.
  45. Generally, this only means that the result returned will be
  46. equally invalid.  However, there are some special values that
  47. WILL result in run-time errors for some of the routines.  Calling
  48. the CMATH routines with illegal or improper inputs is strictly at
  49. the programmer's risk.
  50.  
  51.  
  52. CMATH.PAS constants
  53.  
  54.         "MaxCXRay" is the largest index of the largest array of
  55. complex variables that can be represented.
  56.  
  57.  
  58. CMATH.PAS type definitions
  59.  
  60.         The principal type used within the unit is the "complex"
  61. variable, which is defined as a record with two fields: a real
  62. part component called "rp", and an imaginary part component
  63. called "ip".  Since complex variables are considered storage
  64. mechanisms, these two components are defined as being of type
  65. "math.float":
  66.  
  67.         complex = record rp, ip: float; end;
  68.  
  69.  
  70.         Additionally, CMATH.PAS defines the largest possible
  71. array of complex variables as "CXRay".  This is defined for
  72. typecasting purposes, and need not be used outside of the unit.
  73.  
  74.  
  75. CMATH.PAS function and procedure definitions
  76.  
  77. name    (parameter list)                           type of result
  78. ----    ----------------                           --------------
  79. cabs    (var x: complex)                                xfloat
  80.  
  81.         Returns the absolute value or magnitude of the complex
  82.         variable.
  83.  
  84.  
  85. cacos   (var x: complex)                                ------
  86.  
  87.         Transforms the complex variable into its inverse circular
  88.         cosine.
  89.  
  90.  
  91. cacosh  (var x: complex)                                ------
  92.  
  93.         Transforms the complex variable into its inverse
  94.         hyperbolic cosine.
  95.  
  96.  
  97. cadd    (var x,y: complex)                              ------
  98.  
  99.         Adds the complex value of "y" to "x".
  100.  
  101.  
  102. casin   (var x: complex)                                ------
  103.  
  104.         Transforms the complex variable into its inverse circular
  105.         sine.
  106.  
  107.  
  108. casinh  (var x: complex)                                ------
  109.  
  110.         Transforms the complex variable into its inverse
  111.         hyperbolic sine.
  112.  
  113.  
  114. catan   (var x: complex)                                ------
  115.  
  116.         Transforms the complex variable into its inverse circular
  117.         tangent.
  118.  
  119.  
  120. catanh  (var x: complex)                                ------
  121.  
  122.         Transforms the complex variable into its inverse
  123.         hyperbolic tangent.
  124.  
  125.  
  126. ccos    (var x: complex)                                ------
  127.  
  128.         Transforms the complex variable into its circular cosine.
  129.  
  130.  
  131. ccosh   (var x: complex)                                ------
  132.  
  133.         Transforms the complex variable into its hyperbolic
  134.         cosine.
  135.  
  136.  
  137. cdiv    (var x,y: complex)                              ------
  138.  
  139.         Divides the complex value "y" into "x".
  140.  
  141.  
  142. cexp    (var x: complex)                                ------
  143.  
  144.         Transforms the complex variable into its exponential
  145.         (i.e., raises "e" to the complex value "x" power).
  146.  
  147.  
  148. cjx     (var x: complex)                                ------
  149.  
  150.         Multiplies the complex variable by the positive square
  151.         root of -1.  (The "j" stems from my engineering
  152.         background.)
  153.  
  154.  
  155. cln     (var x: complex)                                ------
  156.  
  157.         Transforms the complex variable into its natural
  158.         logarithm.
  159.  
  160.  
  161. cmult   (var x,y: complex)                              ------
  162.  
  163.         Multiplies the complex variable "x" by the complex value
  164.         "y".
  165.  
  166.  
  167. cneg    (var x: complex)                                ------
  168.  
  169.         Multiplies the complex variable "x" by -1.
  170.  
  171.  
  172. cnjx    (var x: complex)                                ------
  173.  
  174.         Multiples the complex variable "x" by the negative square
  175.         root of -1.  (The "j" stems from my engineering
  176.         background.)
  177.  
  178.  
  179. conj    (var x: complex)                                ------
  180.  
  181.         Transforms the complex variable into its complex
  182.         conjugate. (i.e., multiplies the imaginary part by -1)
  183.  
  184.  
  185. cpoly   (var x: complex; degree: integer; var coeffs)   ------
  186.  
  187.         Evaluates a polynomial with complex coefficients.  See
  188.         "MATH.POLY" for ordering information.
  189.  
  190.  
  191. cpow    (var x,y: complex)                              ------
  192.  
  193.         Raise the complex variable "x" by the complex value of
  194.         "y".
  195.  
  196.  
  197. crecip  (var x: complex)                                ------
  198.  
  199.         Transforms the complex variable into its reciprocal.
  200.  
  201.  
  202. csin    (var x: complex)                                ------
  203.  
  204.         Transforms the complex variable into its circular sine.
  205.  
  206.  
  207. csinh   (var x: complex)                                ------
  208.  
  209.         Transforms the complex variable into its hyperbolic sine.
  210.  
  211.  
  212. csqr    (var x: complex)                                ------
  213.  
  214.         Multiplies the complex variable by itself.
  215.  
  216.  
  217. csqrt   (var x: complex)                                -------
  218.  
  219.         Transforms the complex variable into its square root.
  220.  
  221.  
  222. csub    (var x,y: complex)                              ------
  223.  
  224.         Subtracts the complex value of "y" from the complex
  225.         variable "x".
  226.  
  227.  
  228. ctan    (var x: complex)                                ------
  229.  
  230.         Transforms the complex variable into its circular
  231.         tangent.
  232.  
  233.  
  234. ctanh   (var x: complex)                                ------
  235.  
  236.         Transforms the complex variable into its hyperbolic
  237.         tangent.
  238.  
  239.  
  240. phase   (var x: complex)                                xfloat
  241.  
  242.         Returns the "phase" (also known as "modulus" or
  243.         "argument") of the complex variable.  It's the angle
  244.         between the x (or real) axis and the line connecting the
  245.         complex variable to the original in the complex number
  246.         plane.
  247.