home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / engineer / solve1.zip / SOLVE.TXT < prev   
Text File  |  1993-07-26  |  6KB  |  148 lines

  1. /**************************************************************************
  2.                             SOLVE
  3.               Copyright (C) C. Kenneth Curtis, 1993
  4.             46 Woodland Drive, Califon, NJ 07830, USA
  5.  
  6. SOLVE is a DOS command line mathematical expression solver for engineers and
  7. scientists.  Expressions like 2.15 + 6 * sin(pi / 2) are evaluated and the
  8. result displayed.  SOLVE contains many built in functions including decimal-
  9. hexadecimal conversions.
  10.  
  11. SOLVE may be used without any fees.  The SOLVE.TXT and SOLVE.EXE files may
  12. not be altered, but compression is allowed for up/down loading to/from
  13. electronic bulletin boards.  No one is authorized to sell these files
  14. or distribute them for a fee without written permission from the author.
  15. **************************************************************************/
  16.  
  17. To use SOLVE, simply type the expression immediately after the program name,
  18. hit [Return] and the answer appears.
  19.  
  20. For example   SOLVE 2.15 + 6.0 * sin(PI/2)
  21.  
  22. Multiple expressions can be handled in a single command by separating them with
  23. semicolons.  The results from the one statement can be used as input for
  24. subsequent statements.
  25.  
  26. For example  SOLVE a = 1.7 * 32; b = .603 * 32; arctan(a,b)
  27.  
  28. The first equation calculates a value for a, the second computes b's value and
  29. the third finds the arctangent using a and b.
  30.  
  31. Spaces may be used for legibility, but they are not required.  At least one
  32. space is required between the program name and expressions.  SOLVE is not case
  33. sensitive.  Upper or lower case letters may be used.  The following are
  34. equivalent:
  35.  
  36.     solve 7 * (sin(.123) + .456)
  37.     SOLVE 7*(SIN(.123)+.456)
  38.     SoLvE 7 * (  S i N ( . 1 2 3 ) + . 4 5 6 )
  39.  
  40. SOLVE assumes all computations are integers unless it encounters a floating
  41. point value.  Then floating point is assumed.  However if a semicolon is
  42. encountered, SOLVE reverts back to integer mode where it stays until it sees a
  43. floating point value.
  44.  
  45. Integer values are between -2,147,483,648 and 2,147,438,647.
  46.  
  47. Floating point numbers may be represented in scientific notation, eg 1.23E-4.
  48. The mantissa must contain a decimal point.
  49.  
  50. Hexadecimal values begin with a # symbol, include the characters 0 through 9
  51. and A thru F, and may include a decimal point.  If the first character after
  52. the # is an 8 through F, the value is considered negative.
  53.  
  54.     #36 = 54 decimal
  55.     #A2 = -94 decimal
  56.     #0A2 = 162 decimal
  57.     #11.3 = 17.1875 decimal
  58.  
  59. SOLVE uses the mathematical operators
  60.  
  61.     =   assignment, eg X = 1 + 9
  62.     +   addition, binary operation between 2 values, eg 7 + 5
  63.     -   subtraction or negation, binary operation between 2 values, eg 7 - 5
  64.     *   multiplication, eg 29.0 * 32.3
  65.     /   division, eg 15.0 / 3.3333
  66.     **  raised to the power of, eg 3 ** 5
  67.     +   unary plus, operates on single value, eg 7 * +(14 * 3)
  68.     -   unary minus, operates on single value, eg 7 * -sin(.5)
  69.  
  70. Operators have a precedence.
  71.  
  72.          operator     precedence
  73.         -----------   ----------
  74.            =              1
  75.           +  -            2
  76.           *  /            3
  77.            **             4
  78.         unary +  -        5
  79.  
  80. SOLVE reads left-to-right but operations with higher precedence will be
  81. computed first.  In the expression
  82.  
  83.             5 + 4 ** 3 / 32
  84.  
  85. 4**3 equals 64 will be evaluated first.  Then 64 will be divided by 32 equals 2
  86. will be evaluated next, and lastly 5 + 2 equals 7 will be computed.
  87.  
  88. Parenthesis may be used to assure the order of computation.  In the next
  89. example, the sum of 5 and 4 will be multiplied by 7 resulting in 63.
  90.  
  91.             (5 + 4) * 7
  92.  
  93. Variable names may use letters, digits and underscores but must begin with
  94. a letter.  Named variables, like tau below must be assigned a value before
  95. they may be used.
  96.  
  97.     SOLVE exp(tau = - 5000 * 2.2e-9) + 1 - tau;
  98.  
  99. SOLVE has the following built in floating point constants
  100.  
  101.     PI        = the number of radians in 180 degrees
  102.     SQRT2     = square root of 2.0
  103.  
  104. SOLVE implements the functions listed below
  105.  
  106.   Trigonometric (Note: all return floating point values)
  107.  
  108.     Function      Description
  109.     ------------  ---------------------------------------------------
  110.     sin(r)        sine of r, r is in radians
  111.     cos(r)        cosine of r, r is in radians
  112.     tan(r)        tangent of r, r is in radians
  113.     arcsin(x)     angle in radians whose sine is x
  114.     arccos(x)     angle in radians whose cosine is x
  115.     arctan(y,x)   angle in radians whose tangent is y/x
  116.     deg(r)        degrees in r, r is in radians
  117.     rad(d)        radians in d, d is in degrees
  118.  
  119.   Powers (Note: all return floating point values)
  120.  
  121.     Function      Description
  122.     ------------  ---------------------------------------------------
  123.     sqrt(x)       square root of x
  124.     ln(x)         natural logarithm of x
  125.     log(x)        logarithm of x
  126.     exp(x)        exponent, e to the power of x
  127.  
  128. Results can be displayed in hexadecimal by embedding the grave symbol
  129. (backward apostrophe) in the expression.
  130.  
  131.     solve `-4*3   displays as   #F4 = -12
  132.  
  133. Floating point values can be displayed in hexadecimal as long as the
  134. result fits in 10 characters to the right of the decimal point and
  135. 10 characters to the left (approximately 5.4975e+11).
  136.  
  137.     solve `44.4444 displays as #2C.71C432CA57 = 4.4444400000e+01
  138.  
  139. Notes:
  140.  
  141. 1.  To get help, type SOLVE with no arguments.
  142.  
  143. 2.  Results will be accurate for practical sized numbers.  But errors
  144.     can occur with huge numbers which exceed 1.0e307 or division by a tiny
  145.     number which results in a huge number.
  146.  
  147.  
  148.