home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / calculat / sm30a.zip / SYMBMATH.H18 < prev    next >
Text File  |  1993-11-07  |  6KB  |  136 lines

  1.         3.4.  Libraries and Packages
  2.     A library is a file of an external function, which filename is its
  3. function name within 8 letters plus extension .(x). e.g. the library named
  4. sin.(x) is a file of the sin(x) function definition.
  5.     You can protect a library (e.g. sin.(x)) for write-protect by 
  6. the DOS command:
  7.         attrib +r sin.(x)
  8. or for hidden-protect by the DOS command: 
  9.         attrib +h sin.(x)
  10.     You can remove the write-protect of a library by the DOS command:
  11.         attrib -r sin.(x)
  12. or remove the hidden-protect by the DOS command: 
  13.         attrib -h sin.(x)
  14.     The library (*.(x) file) is similar to the MS-DOS .bat file. You
  15. need not to load or read the library by any command. SymbMath automatically
  16. load the library when it is needed. For example, when you use the sin(x)
  17. function first time, the library sin.(x) will be autoloaded. The library
  18. must be in the default directory, otherwise the library is not loaded and
  19. the function is not working. Only the assignments in the library can be
  20. loaded, and others in the library will be omitted, but all of these
  21. assignments will be not evaluated when they are loaded. You can clear the
  22. library sin.(x) from memory by clear(sin(x)).
  23.     You can have libraries (external functions) as many as your disk
  24. space available. You should use the "one function per file" convenience.
  25.         Note that all names of the variables in libraries and packages
  26. are public (global) except for those declared by local() and name
  27. conflicts must be avoided.
  28.  
  29.     A package is the SymbMath program file which filename has not 
  30. extension .(x). It is recommanded that its filename has the extension .sm.
  31.         A package is similiar to a libarary, but the package must be read
  32. by a command
  33.         readfile("filename")
  34.     The filename can be any MS-DOS filename. It is recommended that
  35. the filename is same function name used in your program, plus the
  36. extension .sm. e.g. inte.sm is the filename of the integral package as
  37. the name of integral function is inte().
  38.     After reading the package, you can call the commands in the
  39. package from your program.
  40.     The readfile() command must be in a single line anywhere.
  41.     Many packages can be read at a time.
  42.     Alternately, a part of the package file rather than the whole
  43. package file can be copied into the Input window by pressing <F7> 
  44. (external copy) in order to save memory space.
  45.     You can convert a package of f.sm into a library by renaming f.sm
  46. to f.(x) for auto loading, or a library f.(x) to a package by renaming
  47. f.(x) to f.sm for not auto loading.
  48.     There are many libraries and packages. The following are some 
  49. of them.
  50.  
  51.         Table 3.4.1      Libraries and Packages
  52. ------------------------------------------------------------------------
  53. File Name               Package Function
  54.  
  55. plot.(x)                plotting functions.
  56. d.(x)                   derivatives.
  57. inte.(x)                integrals.
  58. sin.(x)                 sin(x) function.
  59. cos.(x)                 cos(x) function.
  60. fac.(x)                 n!.
  61. sign.(x)                sign(x) function.
  62. abs.(x)                 abs(x) function.
  63. arg.(x)                 arg(x) function.
  64. sum.(x)                 sum function.
  65. NInte.(x)               numeric integration.
  66. NSolve.(x)              numeric solver of equation.
  67. DSolve.(x)              differential equation solver.
  68. gamma.(x)               gamma function.
  69. ei.(x)                  exponential integral function.
  70. series.(x)              Taylor series.
  71. partSum.(x)             partial sum.
  72. infSum.(x)              infinite sum.
  73. sinh.(x)                sinh(x) function.
  74. cosh.(x)                cosh(x) function.
  75. average.(x)             average([x]) function.
  76. listSum.(x)             sum of list of data.
  77. react.(x)               chemical reactions database.
  78. phoneNo.(x)             phone No. database.
  79. .......................................................................
  80. init.sm                 initial package when running the program in 
  81.             the Input window. It contains switches on the 
  82.             default status.
  83.  
  84. chemical.sm             the atomic weight of chemical elements.
  85. tExpand.sm              expansion of trig functions.
  86. expandLn.sm             expand ln(x*y).
  87. ExpandGa.sm             expand gamma(n,x).
  88. ExpandEi.sm             expand ei(n,x).
  89. units.sm                an units conversion.
  90. listPlot.sm             plotting a list of data.
  91. plotData.sm             intefacing software PlotData.
  92. -----------------------------------------------------------------------
  93.     
  94.         You can get help for all libraries by the library Index command 
  95. in the Help menu. You first open the library index window by this command,
  96. then open a library by selecting its library name in the library index
  97. window.
  98.  
  99.         3.4.1  Initial Package
  100.  
  101.     When a program is run in the Input window, SymbMath first
  102. automatically reads (or runs) the initial package "init.sm". 
  103. The commands in the "init.sm" package seems to be the SymbMath system 
  104. commands. You can read other packages (e.g. f.sm) in the initial 
  105. package "init.sm", so the commands in the package "f.sm" seems 
  106. to be in SymbMath system. You do this by adding the readfile("f.sm")
  107. into the init.sm file:
  108.         readfile("f.sm")
  109.         
  110.         3.4.2  ExpandLn Package
  111.     The lnexpand.sm package does the logarithmic expansion.
  112. e.g. ln(a*b) is expanded into ln(a)+ln(b).
  113.             
  114.         3.4.3  Chemical Calculation Package
  115.     SymbMath recognizes 100 symbols of chemical elements and 
  116. converts them into their atomic weights after the chemical package of
  117. "Chemical.sm" is read.
  118.  
  119.     Example 3.4.3.1. 
  120. Calculate the weight percentage of the element C in the molecule CH4.
  121.  
  122. IN:  readfile("chemical.sm")
  123. IN:  numeric:=on
  124. IN:  C/(C+H*4)*100*%
  125. OUT: 74.868 %
  126.  
  127.     Example 3.4.3.2. 
  128. Calculate the molar concentration of CuO when 3 gram of CuO is in 0.5 
  129. litre of a solution.
  130.  
  131. IN:  readfile("chemical.sm")
  132. IN:  numeric:=on
  133. IN:  g:=1/(Cu+O)*mol
  134. IN:  3*g/(0.5*l)
  135. OUT: 0.07543 mol/l
  136.