home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / utility / sm22a.zip / SYMBMATH.DOC < prev    next >
Text File  |  1993-04-23  |  54KB  |  1,476 lines

  1.     SymbMath 2.2: A Symbolic Calculator with Learning
  2.         (Version 2.2)
  3.  
  4.         by Dr. Weiguang HUANG
  5.     Dept. Analytical Chemsitry, University of New South Wales,
  6.     Kensington, Sydney, NSW 2033, Australia
  7.     Phone: 61-2-697-4643
  8.     Fax:   61-2-662-2835
  9.     E-mail: w.huang@unsw.edu.au
  10.  
  11.         Copyright (C) 1990-1993
  12.         April 15, 1993
  13.     
  14.     This is Part One of SymbMath manual. The SymbMath manual has
  15. three parts in the files SymbMath.DOC, SymbMath.DO2 and SymbMath.DO3.
  16.     If you have any problem or advice, please feel free to write 
  17. to the author.
  18.  
  19.  
  20.             Contents
  21.  
  22. 1. Introduction
  23. 2. Capabilities
  24. 3. Shareware, Student and Advanced Versions
  25. 4. A List of Files in SymbMath
  26. 5. Pull-down Menu and Pop-up Menu
  27.     5.1 File Menu
  28.     5.2 Edit Menu
  29.         5.2.1 Edit Help Menu
  30.     5.3 Run Menu
  31.     5.4 Window Menu
  32.     5.5 Color Menu
  33.     5.6 Help Menu
  34.     5.7 Print Menu
  35. 6. Programming in SymbMath
  36.     6.1. Data Types
  37.         6.1.1 Numbers
  38.         6.1.2 Constants
  39.         6.1.3 Variables
  40.         6.1.4 Patterns
  41.         6.1.5 Functions
  42.             6.1.5.1 Built-in Standard Functions
  43.             6.1.5.2 Calculus and Transformation Functions
  44.             6.1.5.3 User-defined Functions
  45.         6.1.6 Equations
  46.         6.1.7 Lists, Arrays, Vectors and Matrices
  47.         6.1.8 List Index
  48.     6.2. Operators
  49.         6.2.1 Assignment Operators
  50.         6.2.2 Arithmetic Operators
  51.         6.2.3 Relational Operators
  52.         6.2.4 Logical Operators
  53.     6.3. Expressions
  54.         6.3.1 Numerical Exprssions
  55.         6.3.2 Boolean Expressions
  56.     6.4. Statements
  57.         6.4.1 Comment Statement
  58.         6.4.2 Evaluation Statement
  59.         6.4.3 Assignment Statement
  60.         6.4.4 Conditional Statement
  61.         6.4.5 Loop Statement
  62.         6.4.6 Switch Statement
  63.         6.4.7 Command Statement
  64.         6.4.8 Compound Statement
  65.         6.4.9 Include Statement
  66.         6.4.10 End Statement
  67.     6.5 Output Form
  68.     6.6 Input and Output
  69. 7. Examples
  70.     7.1 Simplification and Assumption
  71.     7.2 Calculation
  72.     7.3 Defining Your Own Functions, Procedures and Rules
  73.     7.4 Limits
  74.     7.5 Differentiation
  75.     7.6 Integration
  76.         7.6.1 Indefinite Integration
  77.         7.6.2 Definte Integration
  78.     7.7 Equations
  79.         7.7.1 Algebraic Equations
  80.         7.7.2 Differential Equations
  81.     7.8 Sums and Products
  82.     7.9 Lists, Arrays, Vectors and Matrices
  83.         7.9.1 Entering Lists
  84.         7.9.2 Accessing Lists
  85.         7.9.3 Modifying Lists
  86.         7.9.4 List Operations
  87.         7.9.5 Vector Operations
  88.     7.10 Complex Analysis
  89.     7.11 Tables of Function Values
  90.     7.12 Transformation and Pieces of Expressions
  91.     7.13 Learning from Users
  92.         7.13.1 Learning indefinite and definite integrals
  93.             from derivatives
  94.         7.13.2 Learning complicated indefinite integrals
  95.             from a simple indefinite integral
  96.         7.13.3 Learning definite integral from indefinite integral
  97.         7.13.4 Learning integrals from algebra
  98.         7.13.5 Learning complicated derivatives from a simple
  99.             derivative
  100.         7.13.6 Learning complicated algebra from simple algebra
  101. 8. Packages
  102.     8.1 Initial Package
  103.     8.2 Derivative Package
  104.     8.3 Total Derivative Package
  105.     8.4 Integral Package
  106.     8.5 Numeric Integration Package
  107.     8.6 Numeric Solving Package
  108.     8.7 Seriers Package
  109.     8.8 Infinite Sum Package
  110.     8.9 Chemical Calculation Package
  111.     8.10 Chemical Reaction Package
  112.     8.11 Plot Function Package
  113.     8.12 Plot Data Package
  114. 10. Interface with Other Software
  115. 11. Inside SymbMath
  116. 12. System Limits
  117. 13. Keywords
  118.     13.1 Keywords in Functional Order
  119.     13.2 Keywords in Alphabetical Order
  120.     13.3 Glossary
  121. 14. References
  122.  
  123.  
  124.         1.       Introduction
  125.     SymbMath (an abbreviation for Symbolic Mathematics) is a
  126. symbolic calculator that can solve symbolical math problems. SymbMath 
  127. also perform exact numeric computation. It can manipulate complicated 
  128. formulas and return answers in terms of symbols, formulas and exact 
  129. numbers. 
  130.     SymbMath is an expert system that is able to learn from users.  
  131. If users only input one formula without writing any code, it will 
  132. automatically learn many problems related to this formula (e.g. it 
  133. learns the integrals of an unknown function from a derivative of that 
  134. unknown function).
  135.     SymbMath is a programming language in which you can write
  136. programs, functions and procedures.
  137.     SymbMath is a computing environment where you can set up,
  138. run and document your calculation.
  139.     SymbMath is a text editor in which you can edit many documents 
  140. in many windows.
  141.     It runs on small IBM PCs (8086) with 420 KB free memory under 
  142. MS-DOS. 
  143.  
  144.  
  145.           2.     Capabilities
  146.     Its capabilities include facilities to provide analytical and 
  147. numerical answers for:
  148.     o Differentiation: regular or higher order, partial or total,
  149.       mixed and implicit differentiation, one-sided derivatives.
  150.     o Integration: indefinite or definite integration, multiple
  151.       integration, infinity as a bound, parametric or iterated 
  152.       integration, line or surface integrals, discontinuous or 
  153.       implicit integration.
  154.     o Solution of equations: roots of a polynomial, systems of
  155.       algebraic or differential equations.
  156.     o Manipulation of expressions: simplification, factoring or 
  157.       expansion, substitution, evaluation, built-in standard or 
  158.       user-defined functions.
  159.     o Calculation: exact and floating-point numerical computation 
  160.       of integer, rational, real and complex numbers in the range 
  161.       from minus to plus infinity, even with different units.
  162.     o Limits: real or complex limits, one-sided limits, 
  163.       indeterminate forms.
  164.     o Complex: calculation, functions, derivatives, integration.
  165.     o Sum and product: finite or infinite, partial.
  166.     o Others: series, lists, arrays, vectors, matrices, tables, etc.
  167. Also included are:
  168.     o Pull-down and pop-up menus, resizable and colourable windows.
  169.     o Multi-windowed text editor with syntax check.
  170.     o Programming in integrated edit-interpret-debug environment.
  171.     o Reading and generating BASIC and FORTRAN codes.
  172.     o Displaying two-dimensional math notation.
  173.     o On-line help, and on-line manual.
  174.     o Procedural, conditional, iterational, recursive, functional,
  175.       rule-based, logic, and pattern-matching programming.
  176.     o Editable library in "formula format" or SymbMath language.
  177.     o Learning from user.
  178.     o Plotting functions and data.
  179.  
  180.         3. Shareware, Student and Advanced Versions
  181.  
  182.     Please read two document files SymbMath.DOC and SymbMath.DO*
  183. and all *.TXT files before running SymbMath. You should print them out
  184. if you need the printed documents. Please follow examples in the 
  185. document to practise.
  186.     Type SymbMath on the MS-DOS prompt to run.
  187.     SymbMath has three versions: Shareware Version A, Student
  188. Version B and Advanced Version C. You cannot input the lacked 
  189. functions in shareware or student version, but all versions can 
  190. output all of these functions.
  191.  
  192. ----------------------------------------------------------------------
  193. Version         Class   Lacked Functions on Input       Price
  194.  
  195. Shareware       A       solve(), dsolve(),              US$20 or AU$25
  196.             trig (except sin(x)), 
  197.             hyerbolic, 
  198. Student         B       hyerbolic, dsolve()             US$50 or AU$65
  199. Advanced        C                                       US$99 or AU$130
  200. Packages    *.sm                    US$20 or AU$25
  201. ----------------------------------------------------------------------
  202. Upgrade         same                                    50%
  203. ----------------------------------------------------------------------
  204.     Multiple copies discount is less 20%. 
  205. ----------------------------------------------------------------------
  206.  
  207.     Other foreign money is accepted at the current exchange rate.
  208.     You must provide the photocopy of your license or license 
  209. number for upgrades.    
  210.     If you send the author your payment by cheque, money order
  211. or bank draft that must be drawn in Australia, you will get the 
  212. latest version. If you sign the license (see the LICENSE.TXT file) 
  213. and send it to the author, you will be legal users for upgrades. 
  214. If you write a paper about this software on publication, you will get 
  215. a free upgrade.
  216.     It has three versions: Shareware, Student, and Advanced. The 
  217. shareware version is available from SIMTEL20 archives on anonymous FTP 
  218. sites (wsmr-simtel20.army.mil as /calculator/sm22a.zip, rana.cc.deakin.
  219. oz.au as /huang/sm22a.zip, etc) or by e-mail from listserv@vm1.nodak.edu, 
  220. listserv@ndsuvm1.bitnet.
  221.  
  222.  
  223.         4. A List of Files in SymbMath
  224.  
  225. -------------------------------------------------------------------------
  226. SymbMath.exe    executable SymbMath system.
  227. SymbMath.ini    initial file.
  228. SymbMath.h*     help files, * is numbers.
  229. SymbMath.txt    introduction of SymbMath.
  230. SymbMath.doc    part one of document file or manual file.
  231. SymbMath.do2    part two of document file or manual file.
  232. SymbMath.do3    part three of document file or manual file.
  233. readme          the read-me file, this file should be read first.
  234. readme.2        the read-me file, for PlotData.
  235. init.sm         initial SymbMath program file.
  236. *.sm            user SymbMath program files or packages.
  237. problem.txt     problems that other software cannot solve, but
  238.         SymbMath can do.
  239. comment*.txt    comments on SymbMath.
  240. statisti.txt    the download statistics at FTP site of garbo.uwasa.fi.
  241. prolog.err      error messages.
  242. shareware.txt   shareware concept.
  243. software.txt    software available from the author Dr. W. Huang.
  244. update.txt    the latest updates in SymbMath.
  245. PlotData.exe    program of plotting data.
  246. PlotData.ini    initial file of PlotData.
  247. PlotData.doc    PlotData manual file.
  248. PlotData.hlp    PlotData help file.
  249. PlotData.txt    introduction of PlotData.
  250. ------------------------------------------------------------------------
  251.  
  252.  
  253.         5. Pull-down Menu and Pop-up Menu
  254.  
  255.     The screen is divided into four areas: a menu line, an edit 
  256. window, an output window, and a status line.
  257.     The menu line is the main menu and locates in the top of the 
  258. screen. 
  259.     The edit window is a multi-windowed text editor.
  260.     The output window displays the output.
  261.     The status line indicates the current status or which key to 
  262. be active. It places in the bottom of the screen. The content of the 
  263. status line will be changed according to which active window.
  264.  
  265.     The menu line has 6 choices:
  266.  
  267. ------------------------------------------------------
  268. | File   Edit    Run     Window     Color       Help |
  269. ------------------------------------------------------
  270.  
  271.     When the menu line or the pull-down menus is active, the 
  272. content of the status line is
  273.  
  274. --------------------------------------------------------------------------
  275. SymbMath 2.2 | Arrow keys and <Enter>, First capital letter, <Alt>P Print
  276. --------------------------------------------------------------------------
  277.  
  278. Select the menu by the arrow keys and <Enter>, the first capital 
  279. letter, or pop up the Print menu by <Alt>P. The <Esc> key always 
  280. escape from the current window and return to the previous window.
  281. Two pop-up menus are the Print menu and the Edit Help menu.
  282.  
  283.  
  284.         5.1 File Menu
  285.  
  286.     The File menu has 5 choices in the pull-down menu:
  287.  
  288. -----------
  289. |Load     |
  290. |New file |
  291. |Save     |
  292. |OS shell |
  293. |Quit     |
  294. -----------
  295.  
  296.     The "Load" command loads a file from a disk into the Edit
  297. window. This command pops up a Directory window and changes the 
  298. content of the status line to
  299.  
  300. ---------------------------------------------------------------------
  301. <F4> File mask, <F5> Zoom, <Pg Dn> More, -><- Select, <Enter> Accept
  302. ---------------------------------------------------------------------
  303.  
  304. In the Directory window, the following commands are available.
  305.  
  306.     Table 5.1       Commands in the Directory Window 
  307. -------------------------------------------------------
  308. key             action
  309.  
  310. <F4>            file mask, e.g. *.sm.
  311. <F5>            zoom the window, zoom back by <F5> again.
  312. <Shift><F10>    resize the window with the -><- keys
  313. -><-            select
  314. <Pg Up>         page up
  315. <Pg Dn>         page down
  316. <Enter>         accept
  317. <Esc>           abort
  318. --------------------------------------------------------
  319.  
  320.  
  321.     The "New file" command creates a new file, clears the Edit 
  322. window, and changes the content of the status line to
  323.  
  324. ----------------------------------------------------------------------------
  325. Input filename | <F8> Last filename, -><- Edit, <Enter> Accept, <Esc> Abort
  326. ----------------------------------------------------------------------------
  327.  
  328.     The "Save" command saves the program in the Edit window into a 
  329. disk for a new filename.
  330.     The "OS shell" command executes a DOS command and automatically
  331. returns to the SymbMath system if users provide a special DOS command on
  332. the command window, otherwise it goes to the DOS shell, the control must 
  333. be returned to the resident SymbMath system with the EXIT command on the 
  334. DOS shell.
  335.     The "Quit" command exit from SymbMath.
  336.  
  337.  
  338.         5.2 Edit Menu
  339.  
  340.      SymbMath includes multi-windowed text editors for creating 
  341. and modifying program files.  Usage of the editors is similar to 
  342. WordStar in nondocument mode, to Borland's SideKick, or to Borland's C
  343. compiler. 
  344.     Within the Edit window, press <F8> to open an Aux Edit window 
  345. with an auxiliary editor. In the Auxi Edit window, press <F8> again to 
  346. open another Aux Edit window. So the user can open many Aux Edit 
  347. windows to edit many files.
  348.     Text in the Edit window always be saved after exit by pressing
  349. <Esc>. The Aux Edit window is closed with saving by pressing <F10>, or 
  350. without saving by pressing <Esc>.
  351.     In the Edit window or the Aux Edit window, press <F1> to pop-
  352. up the Edit Help menu (see 5.8 Edit Help Menu), or <Shift><F1> to call 
  353. the manual, and <F7> to copy block from the an Aux Edit window into 
  354. the main editor or into the last Aux Edit window. 
  355.     Move the cursor around in the editor with the arrow
  356. keys, <Page Up>, <Page Down>, and some other keys listed below.  The
  357. editor has two typing modes, Insert and Overwrite.  In Insert
  358. mode, anything you type is inserted at the cursor position.  In
  359. Overwrite mode, pressing a key replaces the current character
  360. at the cursor position with the new typed character.  Initially,
  361. the editor operates in Insert mode, to switch modes, press the
  362. <Insert> key or <Ctrl>V.  (<Ctrl>V means to hold down the <Ctrl> key
  363. on your keyboard while you press V.  The V need not be in upper
  364. case.)
  365.     Unlike a more standard word processing program, the editor
  366. does not have word-wrap. You must press <Enter> at the end of each
  367. line.
  368.     The editor has an autoindent feature that allows subsequent
  369. lines to automatically indent.  If you leave several spaces at the
  370. start of a line, use <Ctrl>OI to indent subsequent lines the same
  371. amount.  The command sequence is a toggle, so you need only
  372. press <Ctrl>OI again to stop indenting.
  373.     Sometimes you may want to see more than the area covered by
  374. the current window.  You can zoom the window, expanding it to the
  375. size of the entire screen, by pressing <F5>.  To return the window
  376. to its usual size, press <F5> again.  For other window commands,
  377. such as moving and resizing a window, see the window command table, 
  378. below.
  379.  
  380.     Table 5.2       window command
  381. ---------------------------------------------------------------------
  382. Key             Action
  383.  
  384. <F5>            zoom window, zoom back by <F5> again.
  385. <Shift><F10>    resize window with the -><- keys.
  386. <F8>            open an Aux Edit window.
  387. <F10>           close the Aux Edit window with saving.
  388. <Esc>           close the Aux Edit window without saving.
  389. <F7>            block copy from an Aux Edit window into the last window.
  390. ---------------------------------------------------------------------
  391.  
  392.     The content of the status line is
  393.  
  394. --------------------------------------------------------------------------
  395. <F1> Help, <Shi><F1> Manual, <F3> Load, <F5> Zoom, <F7> XCopy, <F8> XEdit
  396. --------------------------------------------------------------------------
  397.  
  398.  
  399.       Table 5.2  Summary of the editing commands.
  400. ---------------------------------------------------------------
  401.   Cursor Movement Commands (move cursor to):
  402.  
  403.   Character left         <Ctrl>S  or Left arrow <-
  404.   Character right        <Ctrl>D  or Right arrow  ->
  405.   Word left              <Ctrl>A  or <Ctrl> <-
  406.   Word right             <Ctrl>F  or <Ctrl> ->
  407.   Line up                <Ctrl>E  or Up arrow
  408.   Line down              <Ctrl>X  or Down arrow
  409.   Scroll up              <Ctrl>W
  410.   Scroll down            <Ctrl>Z
  411.   Page up                <Ctrl>R  or <Pg Up>
  412.   Page down              <Ctrl>C  or <Pg Dn>
  413.   Beginning of line      <Ctrl>QS or <Home>
  414.   End of line            <Ctrl>QD or <End>
  415.   Top of screen          <Ctrl>QE or <Ctrl><Home>
  416.   Bottom of screen       <Ctrl>QX or <Ctrl><End>
  417.   Top of file            <Ctrl>QR or <Ctrl><Pg Up>
  418.   Bottom of file         <Ctrl>QC or <Ctrl><Pg Dn>
  419.   Beginning of block     <Ctrl>QB
  420.   End of block           <Ctrl>QK
  421.   Previous point         <Ctrl>QP
  422.   Marker 0               <Ctrl>Q0
  423.   Marker 1               <Ctrl>Q1
  424.   Marker 2               <Ctrl>Q2
  425.   Marker 3               <Ctrl>Q3
  426.   Set marker 0           <Ctrl>K0
  427.   Set marker 1           <Ctrl>K1
  428.   Set marker 2           <Ctrl>K2
  429.   Set marker 3           <Ctrl>K3
  430.  
  431. ...........................................................
  432.  
  433.   Insert & Delete Commands:
  434.  
  435.   Insert mode on/off                 <Ctrl>V or <Ins>
  436.   Insert line                        <Ctrl>N
  437.   Delete line                        <Ctrl>Y
  438.   Delete to end of line              <Ctrl>QY
  439.   Delete left character              <Ctrl>H or <Backspace>
  440.   Delete character under cursor      <Ctrl>G or <Del>
  441.   Delete right word                  <Ctrl>T
  442.  
  443. ...........................................................
  444.  
  445.   Block commands:
  446.  
  447.   Mark block begin       <Ctrl>KB
  448.   Mark block end         <Ctrl>KK
  449.   Mark word              <Ctrl>KT
  450.   Hide block             <Ctrl>KH
  451.   Copy block             <Ctrl>KC or <Ctrl><F5>
  452.   Repeat the last copy   <Shift><F5>
  453.   Move block             <Ctrl>KV or <Alt><F6>
  454.   Delete block           <Ctrl>KY
  455.   Read block             <Ctrl>KR or <F7>
  456.   Write block            <Ctrl>KW
  457.   Print block            <Ctrl>KP
  458.  
  459. .....................................................................
  460.  
  461.   Miscellaneous Commands:
  462.  
  463.   Quit edit                     <Esc>, <F10>, <Ctrl>KD, or <Ctrl>KQ
  464.   Call the auxiliary editor     <F8>
  465.   Tab                           <Ctrl>I  or <Tab>
  466.   Tab mode toggle               <Ctrl>OT
  467.   Auto indent on/off            <Ctrl>OI
  468.   Restore line                  <Ctrl>QL
  469.   Find                          <Ctrl>QF or <Ctrl><F3>
  470.   Repeat last find              <Ctrl>L  or <Shift><F3>
  471.   Find & replace                <Ctrl>QA or <Ctrl><F4>
  472.   Repeat last find & replace    <Ctrl>L  or <Shift><F4>
  473.   Control key prefix            <Ctrl>P
  474.   Abort operation               <Ctrl>U
  475.   Restore error message         <Ctrl>QW
  476.  
  477.   Search Options:
  478.  
  479.   L           Local search
  480.   G           Global search
  481.   N           Replace without asking
  482.   Y           Replace with asking
  483. ------------------------------------------------------------------
  484.  
  485.     Pop-up the Edit Help menu by <F1>, select the editing commands
  486. from its sub-menus by the arrow keys and <Enter>.
  487.  
  488.  
  489.                5.2.1 Edit Help Menu
  490.  
  491.        Users pop-up the Edit Help menu by pressing <F1> within the
  492. Edit window or the Aux Edit window.
  493.     This menu has 7 choices:
  494.  
  495. ------------------
  496. |Show help file  |
  497. |Cursor movement |
  498. |Insert & Delete |
  499. |Block functions |
  500. |Wordstar-like   |
  501. |Miscellaneous   |
  502. |Global functions|
  503. ------------------
  504.  
  505. Except for the first choice of the "Show help file", others have their 
  506. own sub-menu. Users can select the edit command in the sub-menu by
  507. the up or down key and <Enter>.
  508.  
  509.  
  510.             5.3 Run Menu
  511.  
  512.     The Run menu executes the user program in the Edit window, and 
  513. outputs the results in the Output window.
  514.     Notice that it clears memory and executes the initial package 
  515. init.sm before it inteprets the users programm in the Edit window.
  516. You can run the user program from the disk (see Chapter 11 Packages).
  517.  
  518.  
  519.         5.4 Window Menu
  520.  
  521.     The Window menu has 2 choices:
  522.  
  523. --------
  524. |Clear |
  525. |Resize|
  526. --------
  527.  
  528.     The "Clear" command clears the Output window.
  529.     The "Resize" command changes the Output window size 
  530. (see Table 5.2 window command).
  531.  
  532.  
  533.  
  534.         5.5 Color Menu
  535.  
  536.     The Color menu has 4 choices in the pull-down menu:
  537.  
  538. ---------------
  539. |Menu line    |
  540. |Edit window  |
  541. |Output window|
  542. |Status line  |
  543. ---------------
  544.  
  545.     When users choose one of them, a color pattern will come up.
  546. There are 125 colors in the color pattern. Users select their favour 
  547. color by the arrow keys and <Enter>.
  548.  
  549.  
  550.         5.6 Help Menu
  551.  
  552.     The Help menu has 18 choices in the pull-down menu:
  553.  
  554. ---------------
  555. |How to help  |
  556. |Brief        |
  557. |Simplify     |
  558. |Calculate    |
  559. |Function     |
  560. |Limit        |
  561. |Differentiate|
  562. |Integrate    |
  563. |Equation     |
  564. |sUm          |
  565. |Vector       |
  566. |Table        |
  567. |leArn        |
  568. |Package      |
  569. |plOt          |
  570. |sWitch       |
  571. |Keyword      |
  572. |Glossary     |
  573. ---------------
  574.  
  575.     Each command has its own Help window and help file. The on-
  576. line help files are text (ASCII) files.
  577.     While the Help window is open, the status line is changed to
  578.  
  579. -----------------------------------------------------------------------------
  580. <Ctrl><F3> Find, <Shift><F3> Find again, <F5> Zoom, <Pg Dn> more, <Esc> Abort
  581. -----------------------------------------------------------------------------
  582.  
  583.     In the Help window, to search for a special word, you first
  584. press <Ctrl><F3>, then type the word you want to search, finally
  585. press <Ctrl><F3> again. e.g. if you want to search for the word
  586. "help", you first press <Ctrl><F3>, then type "help", finally
  587. press <Ctrl><F3> again. The cursor will go to the word "help".
  588. You press <Shift><F3> to repeat the last find.
  589.     The commands in the Help window are the same as that
  590. in the Edit window, except that text is unable to be changed.
  591.  
  592.  
  593.     Table 5.6        Commands in the Help window
  594. -------------------------------------------------------------------
  595. Keys            Action
  596.  
  597. -><-            move the cursor.
  598. <F5>            zoom the window, <F5> again to zoom out.
  599. <Esc>           exit from the window.
  600. <F10>           exit from the window, the same as <Esc>.
  601. <Pg Up>         page up.
  602. <Pg Dn>         page down.
  603. <Crtl><F2>      go to nth line, end by <crtl><F2> instead of <Enter>.
  604. <Ctrl><F3>      find the special word, end by <Ctrl><F3>
  605.         instead of <Enter>.
  606. <Shift><F3>     repeat last find.
  607. <Shift><F10>    re-size window by arrow keys.
  608. ----------------------------------------------------------------------
  609.  
  610.     There are other two help windows in the Edit window, press 
  611. <F1> to pop-up the Edit Help menu, or <Shift><F1> to open the manual
  612. window.
  613.  
  614.  
  615.             5.7 Print Menu
  616.  
  617.     Users pop up the Print Menu by <Alt>P, and set "Printer On" in
  618. the Print window to toggles echoing to a printer, or/and set "Log File
  619. On" to toggles echoing to the log file "Prolog.Log".
  620.     Another way to print, by using MS-DOS screen print command 
  621. <Print Screen>, everything on screen is printed out.
  622.  
  623.  
  624.             6. Programming in SymbMath
  625.  
  626.     SymbMath is an interpreter, and runs a SymbMath program in
  627. the Edit window, which is written by any editor in the text (ASCII) 
  628. file format. 
  629.     SymbMath language is procedure language, which is executed
  630. from top to bottom in a program, like BASIC, FORTRAN, or PACSAL.
  631. It also is an expression-oriented language and funtional language. 
  632.     The SymbMath program consists of a number of statements. 
  633. The most useful statement contains expressions, the expression 
  634. includes data, and the most important data is functions.
  635.     The structure of SymbMath language is:
  636.         data -> expression -> statement -> program
  637.     Note that upper and lower case letters are different in 
  638. SymbMath language, (e.g. abc is different from ABC) until the switch
  639. lowercase=on.
  640.  
  641.  
  642.             6.1. Data Types
  643.     The data types in SymbMath language is the numbers, constants, 
  644. variables, functions, equations, lists, arrays, vectors, matrixes, 
  645. and list index. All data can be operated. It is not necessary to declare
  646. data to be which type, as SymbMath can recognize it.
  647.  
  648.             6.1.1 Numbers
  649.     The types of numbers are integer, rational, real (floating-point), 
  650. and complex numbers in the range from -infinity to infinity. 
  651.     In fact, the range of the input real numbers is 
  652. -inf, -(10^307)^(10^307) to -(10^-307)^(10^-307), 0, (10^-307)^(10^-307)
  653.  to (10^307)^(10^307), inf.
  654.     The range of the output real numbers is the same as input 
  655. when the switch numerical=off, but when the switch numerical=on, it is
  656.     -inf, -1.E307 to -1.E-307, 0, 1.E-307 to 1.E307, inf.
  657.     It means that the number larger than 1.e307 is converted 
  658. automatically to inf, the absolute values of the number less than 
  659. 1.e-307 is converted to 0, and the number less than -1e307 is 
  660. converted to -inf.
  661.  
  662.     For examples:
  663. -------------------------------------------
  664. Numbers         Type
  665.  
  666. 23              integer
  667. 2/3             rational
  668. 0.23            real
  669. 2.3E2           real 
  670. 2+3*i           complex
  671. 2.3+i           complex
  672. ---------------------------------------------
  673.  
  674.  
  675. That "a" and "b" are the same means a-b = 0, while that they are 
  676. different means a-b <> 0. 
  677.     For the real numbers, the upper and lower case letters E 
  678. and e in exponent are the same, e.g. 1e2 is the same as 1E2.
  679.  
  680.  
  681.         6.1.2. Constants 
  682.  
  683.     The constants are the unchangeable values. There are some 
  684. built-in constants. The name of these built-in constants should be 
  685. avoided in the user-defined constants.
  686.  
  687. ------------------------------------------------------------------
  688. Built-in Constants      Meanings
  689.  
  690. pi=3.1415926536         the circular constant.
  691. e=2.7182818285          the base of the natural logarithms.
  692. i=sqrt(-1)              the imaginary sign of complex numbers.
  693. inf                     infinity.
  694. -inf                    negative infinity.
  695. complex_inf             complex infinity, both real and imaginary parts
  696.             of complex numbers are infinity. e.g. inf+inf*i.
  697. constant                the integral constant.
  698. discont                 discontinuity, e.g. 1/0. 
  699.             (You can evaluate the one-
  700.             sided value by x=x0+zero or x0-zero if the 
  701.             value of expr is discont).
  702. x0-zero                 approach x0 from negative (-inf) direction,
  703.             limit as zero ->0.
  704. x0+zero                 approach x0 from positive (+inf) direction,
  705.             limit as zero ->0.
  706. undefined               the undefined value, e.g. indeterminate forms:
  707.             0/0, inf/inf, 0*inf, 0^0, etc.
  708. --------------------------------------------------------------------
  709.  
  710.     Notice that the constants discont and undefined are
  711. different. If the value of an expression at x=x0 is discont, the
  712. expression only has the one-sided value at x=x0 and this one-sided 
  713. value is evaluated by x=x0+zero or x=x0-zero. If the value of an 
  714. expression at x=x0 is undefined, the expression may be evaluated by 
  715. the function lim(). 
  716.  
  717.     Example 6.1.1. evaluate 1/sgn(x) and sin(x)/x at x=0.
  718.     Input:
  719. f(x_) = 1/sgn(x)
  720. f(0)
  721. f(0+zero)
  722. end
  723.     Output:
  724. f(x_) = 1/sgn(x)
  725. discont
  726. 1
  727.  
  728.     Input:
  729. f2=sin(x)/x
  730. subs(f2, x=0)
  731. lim(f2, x=0)
  732. end
  733.     Output:
  734. f2 = sin(x)/x
  735. undefined
  736. 1
  737.  
  738.  
  739.         6.1.3. Variables
  740.  
  741.     The sequence of characters is used as the name of variables. 
  742. Variables are used to store the results of calculations.
  743. Variable names must start with a letter and use only letters and
  744. numbers.  They can be up to 124 characters long. They are
  745. case sensitive until the switch lowercase is set to on
  746. (lowercase=on).  To assign a result to a variable, just put
  747.       <var-name> =  before the expression to be evaluated:
  748.  
  749.                a = 2 + 3   # assign value to a
  750.  
  751.       Variables can be used like constants in expressions.  
  752. For example:
  753.  
  754.                a = 2 + 3
  755.                b = a*4
  756.  
  757.       If an undefined variable is used in an expression, then the
  758. expression returns a symbolic result (which may be stored in
  759. another variable).  Pick an undefined variable name, say x, and enter:
  760.  
  761.                y = 3 + x  # formula results since x undefined
  762.                x = 4      # Now x is defined
  763.                y          # y returns 7, but its value is
  764.                   # still the formula 3 + x
  765.                x = 7      # revalue x
  766.                y          # new value for y
  767.  
  768.     Note that in symbolic computation program, the variable has
  769. not only a numeric value but also a symbolic value.
  770.       Symbolic values for variables are useful mostly for viewing 
  771. the definitions of functions and symbolic differentiation and 
  772. integration.
  773.       Watch out for infinite recursion here.  Defining
  774.  
  775.                a = a+3
  776.  
  777. when  a  has no initial value will not cause an immediate
  778. problem, but any future reference to  a  will result in an
  779. infinite recursion !
  780.  
  781. The usual used independent variable is "x". A value can be assigned
  782. to the variable, by 
  783. (1) the assignment = or :=, 
  784. (2) the user-defined function f(), 
  785. (3) the function subs(). 
  786.  
  787. e.g. 
  788.  x=2, p:=3
  789. f(2)    # if f(x)=x^2 has been defined,
  790. subs(x^2, x=2)
  791.     The built-in variable is "last". The variable "last" is
  792. always automatically assigned the value of the last output result.
  793.  
  794.  
  795.         6.1.4 Patterns
  796.  
  797.     Patterns stand for classes of expressions.
  798.  
  799. _       any expression.
  800. x_      any expression, given the name x.
  801.  
  802. Patterns should appear on the left-hand side of the assignment only,
  803. not on the right-hand side of the assignment.
  804.  
  805.  
  806.         6.1.5. Functions
  807.         6.1.5.1 Built-in Standard Mathematical Functions
  808.  
  809.      Different versions of SymbMath have different built-in 
  810. standard mathematical functions. The Advanced Version C has all of them.
  811. See the following table in detail for other versions. All below standard
  812. functions, except for n!, fac(n) and atan2(x,y), can be differentiated 
  813. and integrated symbolically.
  814.  
  815.      Table 6.1.5.1        Built-in Standard Mathematical Functions
  816. -----------------------------------------------------------------------
  817. Functions       Meanings
  818.  
  819. n!              factorial of n.
  820. fac(n)          the same as n!.
  821. sqrt(x)         square root, the same as x^0.5.
  822. exp(x)          the same as e^x.
  823. sgn(x)          1 when Re(x) > 0, or Re(x) = 0 and Im(x) > 0; 0 when
  824.         x=0; -1 otherwise.
  825. abs(x)          absolute value of x.
  826. ln(x)           natural logarithmic function of x, based on e.
  827. sin(x)          sine function of x.
  828.  
  829. ............... above functions in Shareware Version A ...............
  830.  
  831. cos(x) 
  832. tan(x) 
  833. csc(x) 
  834. sec(x) 
  835. cot(x) 
  836. asin(x)         arc sine function of x, the inverse of sin(x).
  837. acos(x) 
  838. atan(x)
  839. acot(x)
  840. asec(x)
  841. acsc(x)
  842. atan2(x,y)      the radian angle of (x,y).
  843.  
  844. ............... above functions in Student Version B .................
  845.  
  846. sinh(x)         hyerbolic sine function of x.
  847. cosh(x) 
  848. tanh(x) 
  849. csch(x) 
  850. sech(x) 
  851. coth(x)
  852. asinh(x)        arc hyerbolic sine function of x, the inverse of sinh(x).
  853. acosh(x) 
  854. atanh(x)
  855. acoth(x)
  856. asech(x)
  857. acsch(x)
  858.  
  859. --------------------------------------------------------------------------
  860.  
  861.  
  862.         6.1.5.2 Calculus and Transformation Functions
  863.  
  864.     Calculus functions are for calculus calculation while trans-
  865. formations functions are to move or take a piece of expression. The 
  866. first argument of the function is for evaluation.
  867.  
  868.         Table 6.1.5.2       Calculus Functions
  869. ----------------------------------------------------------------------
  870. Functions       Meanings
  871.  
  872. subs(y, x=x0)   substitutes x in y by x0.
  873. lim(y, x=x0)    gives the limit of y when x approaches x0. Note that 
  874.         the correct answers only for the indeterminate forms:
  875.         0/0, inf/inf, 0*inf, 0^0, inf^0.
  876.  
  877. d(y, x)         differentiate y with respect to x.
  878. d(y, x, order)  gives the nth order derivative of y with respect to an 
  879.         undefined variable x.
  880. d(y, x=x0)      gives the derivative of y with respect to an undefined
  881.         variable x at x=x0.
  882. d(y, x=x0, n)   gives the nth order derivative of y with respect to an 
  883.         undefined variable x at x=x0.
  884. d(y)            implicit differentiation, used in differential 
  885.         equations, e.g. x*d(x)+y*d(y) === 0.
  886.  
  887. inte(y, x)      find the indefinite integral of y with respect to an
  888.         undefined variable x.
  889. inte(y,x,a,b)   find the definite integral of y with respect to an 
  890.         undefined variable x taken from x=a to x=b.
  891. inte(y, x from a to b)  the same as inte(y,x,a,b).
  892. inte(y)         implicit integration, used to integrate the 
  893.         differential equations.
  894.  
  895. dsolve(d(y)/d(x)===f(x,y), y)           solve differential equations.
  896.  
  897. sum(y, x from xmin to xmax step dx)     sum of y.
  898. sum(y, x from xmin to xmax)             sum of y step=1.
  899.  
  900. prod(y, x from xmin to xmax step dx)    product of y.
  901. prod(y, x from xmin to xmax)            product of y step=1.
  902. ---------------------------------------------------------------------
  903. Note: the Shareware and Studen Versions have not dsolve().
  904.  
  905.  
  906.         Table 6.1.5.3      Transformation Functions
  907. ---------------------------------------------------------------------
  908. expand(F)       expand F, e.g. expand((a+b)^2) gives a^2 + 2*a*b + b^2.
  909. factor(F)       factorise from F, e.g. factor(a^2 + 2*a*b + b^2) gives
  910.         (a+b)^2.
  911. solve(f(x)===0, x)      solve polynomial and systems of linear 
  912.             equations, or rearrange the equation.
  913. list(a+b)               transform sum to list.
  914. sum([a,b])              transform list to sum.
  915. coef(expr, x^n)         gives the coefficient of x^n in expr.
  916. assume(x>0)             assume x>0.
  917. assume(x<0)             assume x<0.
  918. isreal(x)=1             assume x is real.
  919. left(x^2===b)           left hand side of an equation.
  920. right(x^2===b)          right hand side of an equation.
  921. re(x)                   real part of complex numbers.
  922. im(x)                   imaginative part of complex numbers.
  923. float(x)                convert x to the floating-point number.
  924. ratio(x)                convert x to the rational number.
  925. round(x)                convert x to the rounded integer.
  926. trunc(x)                convert x to the truncated integer.
  927. ----------------------------------------------------------------------
  928. Note: the Shareware Version has not solve().
  929.  
  930.         Table 6.1.5.4 Test Function
  931. ---------------------------------------------------------------------
  932. Function        Meaning
  933.  
  934. isodd(x)        test if x if an odd number.
  935. iseven(x)        test if x is an even number.
  936. isinteger(x)        test if x is an integer number.
  937. isreal(x)        test if x is a real number.
  938. isnumber(x)        test if x is a number.
  939. isfree(y,x)        test if y is free of x.
  940. ----------------------------------------------------------------------
  941.         
  942.         Table 6.1.5.5     The List and Table Functions
  943. ----------------------------------------------------------------------
  944. list(f(x), x from xmin to xmax step dx)         lists of f(x).
  945. table(f(x), x from xmin to xmax step dx)        
  946.     data table of function values.
  947. ----------------------------------------------------------------------
  948.  
  949.  
  950.     For example:
  951. -----------------------------------------------------------
  952. differentiation         d()             d(x^2,x)
  953. integration             inte()          inte(x^2,x)
  954. limit                   lim()           lim(sin(x)/x, x=0)      
  955. solving                 solve()         solve(x^2+1===0, x)     
  956. expanding               expand()        expand((a+b)^2)         
  957. factoring               factor()        factor(a*c+b*c)         
  958. -----------------------------------------------------------
  959. where "x" is an undefined variable.
  960.  
  961.     Above functions can be operated and chained, like the standard 
  962. functions. 
  963.     If a second argument x is omitted in the functions d(y) 
  964. and inte(y), they are implicit derivatives and integrals. If f(x) is 
  965. undefined, d(f(x), x) is differentiation of f(x). These are useful 
  966. in the differential and integral equations. (see later chapters).
  967.     For examples:
  968.     inte(inte(F,x), y) is double integral of F with respect 
  969. to both variables x and y. 
  970.     d(y, x=x0, 2) is the second order derivative of y with 
  971. respect to x at x=x0.
  972.     d(d(y,x),t) is the mixed derivative of y with respect 
  973. to x and t.
  974.     The keywords "from" "to" "step" "," are the same as separators
  975. in multi-arguement functions. e.g. inte(f(x), x, 0, 1) are the same as
  976. inte(f(x), x from 0 to 1).
  977.  
  978.  
  979.         6.1.5.3 Users-defined Functions
  980.  
  981.     Users can define the new functions, which include the
  982. standard functions, calculus functions, and algebraic operators.
  983.     Users define a new function f(x) by  
  984.  
  985.         f(x_) := x^2
  986.  
  987. and then call f(x) as the standard functions. The function name can 
  988. be any name, except for the keywords. The maximum number of arguments 
  989. in the users-defined functions on this version is 5, but that in the
  990. users-defined rules on this version is 2.
  991.     Alternately, users assign x^2 to a variable f by f=x^2, and 
  992. then call the variable f by subs(f, x=x0). f=x^2 seems a function.
  993.     To clears a variable or function from memory by
  994.  
  995.         clear(x)          clear x from memory.
  996.         clear(f(x))       clear f(x) from memory.
  997.  
  998.      Variables can be used in function definitions. It leads to 
  999. an important difference between functions and variables.  When a 
  1000. variable is defined, all terms of the definition are evaluated.  When 
  1001. a function is defined, its terms are not evaluated; they are evaluated 
  1002. when the function is evaluated.  That means that if a component of the 
  1003. function definition is changed, that change will be reflected the next 
  1004. time the function is evaluated.
  1005.  
  1006.  
  1007.         6.1.6 Equations
  1008.  
  1009.     An equation is an equality of two sides linked by an equation
  1010. sign "===", e.g. x^2+p === 0, where the symbol "===" stands for an
  1011. equation. Note that the symbols "=", "==" and "===" are different: 
  1012. "=" is the assignment, "==" is the equal sign, and "===" is the 
  1013. equation sign. 
  1014.     Systems of equations are a list of equations, e.g. 
  1015. [a1*x+a2*y===a3, b1*x+b2*y===b3].
  1016.  
  1017.  
  1018.         6.1.7 Lists, Array, Vectors and Matrices
  1019.  
  1020.     A list is [a, b, c].
  1021.     An array is a list of lists. e.g. [a, b, [c1, c2]].
  1022.     A vector and matrix are similar a list and array, but in a
  1023. matrix, the number of elements in each row should be the same, e.g.
  1024. [[a11, a12], [a21, a22]].
  1025.  
  1026.  
  1027.         6.1.8 List Index
  1028.  
  1029.     The list index is the index for n-th element in a list. e.g.
  1030. b[2] indicates the second element in the list b.
  1031.     The built-in list index is last[number]. The name of last 
  1032. output list is "last", e.g. last[1] is the first element in the
  1033. last output list.
  1034.  
  1035.  
  1036.             6.2 Operators
  1037.  
  1038.     Table 6.2.1       Operators
  1039. -----------------------------------------------------------------
  1040. Operation               Operators       Examples        Order
  1041.  
  1042. comma                   ,               a=2, b=3        1
  1043. immedate assignment     =               p=2+b           2
  1044. delayed assignment      :=              p:=2+3          2
  1045. and                     and             a>-2 and a<2    2
  1046. or                      or              a>2 or b>2      2
  1047. equation                ===             x^2+x+1===0     3
  1048. equal                   ==              a==2            3
  1049. larger than             >               a>2             3
  1050. larger and equal        >=              a>=2            3
  1051. less than               <               a<2             3
  1052. less and equal          <=              a<=2            3
  1053. unequal                 <>              a<>2            3
  1054. plus                    +               a+b             4
  1055. minus                   -               a-b             4
  1056. mutilation              *               a*b             5
  1057. division                /               a/b             5
  1058. power                   ^               a^b             6
  1059. power                   **              a**b            6
  1060. factorial               !               n!              6
  1061. positive                +               +a              7
  1062. negative                -               -a              7
  1063. function                f()             sin(x)          7
  1064. list index              f[]             f[1]            7
  1065. parentheses             ()              (a+b)*c         7
  1066. list                    []              [a,b]           7
  1067. --------------------------------------------------------------------
  1068.  
  1069.     All functions have the same 7th order.
  1070.     Operations with higher order precede, otherwise operations are
  1071. performed left to right.  These are the usual algebraic conventions.
  1072.     a^b^c is the same as (a^b)^c.
  1073.  
  1074.         6.2.1 Assigment Operators
  1075.  
  1076.         immedate assignment operator    =               
  1077.         delayed assignment  operator    :=              
  1078.  
  1079.     e.g. 
  1080.     p=2+3
  1081. 2+3 is evaluated at the time of assignment, i.e. p is assigned with 5.
  1082.     p:=2+3
  1083. 2+3 is evaluated when the value of p is requested, i.e. p is assigned 
  1084. with 2+3.
  1085.     The delayed assignment operator is used in the definition of
  1086. a function or procedure.
  1087.  
  1088.         6.2.2 Arithmetic Operators
  1089.  
  1090. -----------------------------------------------------------
  1091. plus                    +               a+b             4
  1092. minus                   -               a-b             4
  1093. mutilation              *               a*b             5
  1094. division                /               a/b             5
  1095. power                   ^               a^b             6
  1096. power                   **              a**b            6
  1097. factorial               !               n!              6
  1098. positive                +               +a              7
  1099. negative                -               -a              7
  1100. ----------------------------------------------------------
  1101.  
  1102.         6.2.3 Relational Operators
  1103.  
  1104.       Before you can write loops, you must be able to write 
  1105. statements that evaluate to 1 or 0, and before you can do that, you
  1106. must be able to write useful statements with logical values.  In
  1107. mathematics, these are relational statements.
  1108.     SymbMath allows you to compare numbers six ways:
  1109.  
  1110.                a < b              less than
  1111.                a <= b             less than or equal to
  1112.                a > b              greater than
  1113.                a >= b             greater than or equal to
  1114.                a == b             equal to
  1115.                a <> b             not equals
  1116.  
  1117.       SymbMath uses the double equals sign == (like C language) for
  1118.  "is equal to" to distinguish this operator from the assignment operators
  1119. = and :=.
  1120.       The result of a comparison of two real numbers is one of
  1121. the values 1 or 0. If the comparsion is not both real numbers, it left
  1122. unevaluated.
  1123.  
  1124.  
  1125.         6.2.4    Logical operators
  1126.  
  1127.       SymbMath uses the logical operators:  AND, and OR.  You can
  1128. combine comparison operators with them to any level of complexity.
  1129. In contrast to Pascal, logical operators in SymbMath have a lower
  1130. order or precedence than the comparisons, so  a < b  and  c > d
  1131. works as expected.  The result of combining logical values with
  1132. logical operators is another logical value (1 or 0).  Bit operations 
  1133. on integers can be performed using the same operations.
  1134.       SymbMath uses the "short-circuit" definition of AND and OR 
  1135. when the arguments are boolean.  Here are tables that show how AND 
  1136. and OR are defined:
  1137.  
  1138.              a AND b
  1139. --------------------------------------------------------
  1140.             b       1       0
  1141.         a
  1142.         1               1       0
  1143.         0               0       0
  1144. ------------------------------------------------------
  1145.  
  1146.              a OR b
  1147. --------------------------------------------------------
  1148.             b       1       0
  1149.         a
  1150.         1               1       1
  1151.         0               1       0
  1152. ------------------------------------------------------
  1153.  
  1154.     Short-circuit evaluation is used because often one condition
  1155. must be tested before another is meaningful.
  1156.  
  1157.  
  1158.             6.3 Expressions
  1159.  
  1160.     An expression (i.e. expr) is combination of data and operators.
  1161.     There are two kinds of expressions: numeric and Boolean. The
  1162. numeric expression is combination of data and algebraic operators while
  1163. the Boolean expression is combination of data and relational operators
  1164. and logic operators. These two kinds of expressions can be mixed, but
  1165. the numeric expression has higher priority than Boolean operators.
  1166. x*(x>0) is different from x*x>0. x*x>0 is the same as (x*x)>0.
  1167.  
  1168. e.g.
  1169. a+b+3           numeric expression,
  1170. a>0             Boolean expression
  1171. a>0 and b>0     Boolean expression
  1172. x*(x>0)         mixed numeric and Boolean expression
  1173.  
  1174.     The result of Boolean expression with logic operators is 
  1175. 1 or 0. Boolean expression like 1 < 3 or 1 > 4 return a real value 1
  1176. or 0.  Numerical expressions can replace Boolean ones, provided
  1177. they evaluate to 1 or 0.  The advantage here is that you can
  1178. define the step function that is 0 for x < a and 1 for x > a by
  1179. entering:
  1180.  
  1181.             step(x_, a_) := x > a
  1182.  
  1183.     To define the function:
  1184.  
  1185.             f(x) = x-1    if x < 1
  1186.                  = x^2-x  if x >= 1
  1187.  
  1188.     enter:
  1189.            f(x_) := (x-1)*(x < 1) + (x^2-x)*(x >= 1)
  1190.  
  1191.     These functions can be differentiated and integrated symbolically.
  1192.  
  1193.  
  1194.             6.4 Statements
  1195.  
  1196.     The statements include:
  1197.         comment statement
  1198.         evaluation statement
  1199.         assignment statement
  1200.         conditional statement
  1201.         loop statement
  1202.         switch statement
  1203.         command statement
  1204.         compound statement
  1205.         include statement
  1206.         end statement
  1207. SymbMath program must be terminated by the end statement.
  1208.  
  1209.  
  1210.             6.4.1 Comment Statement
  1211.  
  1212.     # is the comment statement sign.
  1213.     You can add comments into a line, or even produce a single 
  1214. line which is entirely a comment, by preceding the comment sign with #.
  1215.     For example:
  1216.            # This is my program
  1217.            3 + 4    # My first calculation
  1218.  
  1219. Comments make your calculations more understandable, whether you
  1220. are making a printed record of what you are doing or if you just
  1221. want to jot some notes to yourself while you are working.
  1222.  
  1223.  
  1224.         6.4.2 Evaluation Statement
  1225.  
  1226.     The evaluation statement has the format:
  1227.  
  1228.         expression
  1229.  
  1230.     SymbMath evaluates any expression which in a line and gives
  1231. the value of the expression. e.g.
  1232.     Input:
  1233. 3 + 4
  1234.     Output:
  1235. 7        # the value of 3+4
  1236.  
  1237.     Input:
  1238. d(x^6, x)
  1239.     Output:
  1240. 6 x^5       # the value of d(x^6, x)
  1241.  
  1242.     The last output can be saved to a variable for the later use
  1243. by the built-in variable "last", e.g. f=last.
  1244.  
  1245.  
  1246.          6.4.3 Assignment Statement
  1247.  
  1248.     The assignment statement specifies that a new value of expr2 
  1249. be assigned to expr1, and saved into memory. The forms of the
  1250. assignment statements are
  1251.  
  1252.         expr1 = expr2
  1253.         expr1 := expr2
  1254.  
  1255. where = is the immediate assignment operator (expr2 is evaluated at 
  1256. the time of assignment), and := is the delayed assignment operator 
  1257. (expr2 is evaluated when the value of expr1 is requested).
  1258.     Note that not only a single variable but also an expression
  1259. can be assigned. e.g. x=2, sin(x)/cos(x)=tan(x).
  1260.     e.g. evaluate of d() and assign the result (6*x^5) to f.
  1261.     f=d(x^6,x)
  1262.  
  1263.  
  1264.         6.4.4 Conditional Statement
  1265.  
  1266.     There are two conditional statement:
  1267.         if(test, f, g)
  1268.         if(test, f)
  1269. if(condition, x, y)     gives x if condition evaluates to 1, y if it 
  1270.             evaluates to 0, or no output if it evaluates 
  1271.             to neither 1 or 0.
  1272. if(condition, x)    gives x if condition evaluates to 1, or no 
  1273.             output otherwise.
  1274. It is useful in definition of the use-defined function to left the
  1275. function unevaluted if the argument of the function is not number.
  1276. e.g. define f(x_):=if(isnumber(x), 1), then call f(x), f(10) gives 1, 
  1277. and f(a) gives f(a).
  1278.  
  1279.  
  1280.         6.4.5 Loop Statement
  1281.     You can use two kinds of loops in SymbMath, fixed length
  1282. loops controlled by do() and variable-length loops controlled by
  1283. repeat(). The do() loop is similar to the FOR loop in BASIC language.
  1284.     The control variable in the do() loops is not limited to
  1285. integer values.  You can say:
  1286.         do(f=f+1, x from xmin to xmax step dx)
  1287. It is similar to
  1288.         FOR x = xmin TO xmax STEP dx
  1289.         f=f+1
  1290.         NEXT x
  1291. where xmin, xmax, and dx are real values.  If STEP dx is omitted, it
  1292. defaults to 1.
  1293.  
  1294.     e.g.
  1295.     Input:
  1296. x=1
  1297. do(x=x+1, j from 1 to 5 step 1)
  1298. end
  1299.     Output:
  1300. x=1
  1301. x=5
  1302. end
  1303.  
  1304.       The conditional loops are probably more useful than the do()
  1305. loops if a number of iteration is unknown. It is
  1306.         repeat(f, test)
  1307. The repeat() repeats to evaluate f until the test is true (i.e. the
  1308. result of the test is 1).
  1309.     e.g.
  1310.     Input:
  1311. x=1
  1312. repeat(x=x+1, x>5)
  1313. end
  1314.     Output:
  1315. x=1
  1316. x=6
  1317. end
  1318.  
  1319.  
  1320.           6.4.6 Switch Statement
  1321.  
  1322.     The switch statement sets or changes the switch status. The
  1323. switch status is unchanged in memory until the new switch status is
  1324. assigned.
  1325.  
  1326. ----------------------------------------------------------------------
  1327. Switch                  Action
  1328.  
  1329. lowercase=on            convert letters into the lower-case letters.
  1330. lowercase=off           not convert letters into the lower-case letters,
  1331.             this is default.
  1332.  
  1333. output=basic            output form is BASIC format, this is default.
  1334. output=fortran          output form is FORTRAN format.
  1335. output=prolog           output form is Prolog format (internal form).
  1336. output=twodim           output form is two dimension.
  1337. output=off              not display output.
  1338. output=on               the same as ouput=basic
  1339.  
  1340. numerical=on            convert numbers to floating-point numbers.
  1341. numerical=off           not convert numbers to floating-point numbers, 
  1342.             this is default.
  1343.  
  1344. expand=on               expansion. e.g. c*(a+b) to c*a+c*b.
  1345. expand=off              disable expansion, this is default.
  1346.  
  1347. expexpand=on            exponent expansion. e.g. c^(a+b) to c^a*c^b.
  1348. expexpand=off           disable exponent expansion, this is default.
  1349.  
  1350. lnexpand=on             log expand, e.g. ln(a*b) to ln(a)+ln(b)
  1351. lnexpand=off            disable log expansion, this is default.
  1352. ----------------------------------------------------------------------
  1353.  
  1354.     When the switch lowercase = on, all letters are converted into
  1355. the lower-case letters so the upper- and lower- case letters are the 
  1356. same, e.g. EXP(x) is the same as exp(x).
  1357.     When the output is written to a disk file, it is recommended
  1358. to set the switch output=basic.
  1359.  
  1360.  
  1361.         6.4.7 Command Statement
  1362.  
  1363.     The command statement neither evaluates any expression nor
  1364. saves any expression. It executes a command.
  1365.  
  1366. ----------------------------------------------------------------------
  1367. Commands         Action
  1368.  
  1369. last             show and simplify the last output.
  1370. last[1]          show the first element of the last output list.
  1371. clear(x)         clear the variable x from memory.
  1372. clear(f(x))      clear the user-defined function f(x) from memory.
  1373. system(xx)       execute the MS-DOS command xx.
  1374. end              terminate the program or file.
  1375. ---------------------------------------------------------------------
  1376.  
  1377.  
  1378.         6.4.8 Compound Statement
  1379.  
  1380.     The all above statements are simple statements. The compound
  1381. statement specifies that its component statements are to be executed
  1382. in the same sequence as they are written. They are separated by the
  1383. separators (comma ","). e.g.
  1384.         a+b, 2+3
  1385.  
  1386.  
  1387.         6.4.9  Include Statement
  1388.     The include statement includes a file into the user program. 
  1389. It seems to copy the included file into the user program.
  1390.     The format of include statement is
  1391.         include('filename')
  1392. The filename is any MS-DOS file anme.
  1393. e.g. to include a file named 'inte.sm'.
  1394.         include('inte.sm')
  1395.     The file to be included must be in the current directory.
  1396.     After a file is included, users can call any part of this 
  1397. package from a second package, as it seems the part of the first 
  1398. program has already been in the second program. Users can include 
  1399. many files in the SymbMath program at a time. However, all names 
  1400. of the variables are public and name conflicts must be avoided.
  1401.  
  1402.         6.4.10    End Statement
  1403.  
  1404.     Program must be terminated by the end statement. The end 
  1405. statement is "end" in a single last line:
  1406.         end
  1407.  
  1408.  
  1409.         6.5. Output Form
  1410.     When the switch output=basic, the output form is the BASIC
  1411. language format. When the switch output=fortran, the output form is 
  1412. the FORTRAN language format. When the switch output=twodim, the 
  1413. output form is the two dimensional math notation, but the expression
  1414. of power written to a disk file may be strange (e.g. x^6 is written 
  1415. as x6). The default switch is output=basic.
  1416.  
  1417.         Table 6.5.1      output switch
  1418. ---------------------------------------------------------------------
  1419. output=basic            output form is BASIC format, this is default.
  1420. output=fortran          output form is FORTRAN format.
  1421. output=prolog           output form is Prolog format (internal form).
  1422. output=twodim           output form is two dimension.
  1423.  
  1424. output=off              not display output.
  1425. output=on               the same as ouput=basic.
  1426. ---------------------------------------------------------------------
  1427.  
  1428.     The output switch only change the output format, neither affect
  1429. the internal format nor the calculation.
  1430.  
  1431.         6.6 Input and Output
  1432. ---------------------------------------------------------------------
  1433. include('flename')    read (run or include) the disk file 'filename'.
  1434.  
  1435. openfile('filename')    open the disk file 'filename' for writing.
  1436. closedfile('filename')    closed the file 'filename' and return output
  1437.             to screen.
  1438. ---------------------------------------------------------------------
  1439.  
  1440.     The filename is any MS-DOS filename.
  1441.     SymbMath can read expressions from a disk file,
  1442. then manipulate the expression, and finally write the result into 
  1443. another disk file.
  1444.     Example: an expression y=x^6 is already in the file 'y.in',
  1445.  
  1446. The contents of the file 'y.in':
  1447. ---------------------------------------------------------------------
  1448. y=x^6
  1449. end
  1450. -----------------------------------------------------------------------
  1451.  
  1452.     run this SymbMath program
  1453. ----------------------------------------------------------------------------
  1454. include('y.in')        # read the expression y=x^6 from the file 'y.in'
  1455. openfile('y.out')    # open a disk file 'y.out' for writing
  1456. d(y,x)            # find derivative of y and write the result to the file
  1457. closefile('y.out')    # close the file and return output to screen
  1458. end
  1459. ----------------------------------------------------------------------------
  1460.  
  1461.  
  1462. The contents of the file 'y.out':
  1463. ---------------------------------------------------------------------
  1464. 6*x^5
  1465. ---------------------------------------------------------------------
  1466.  
  1467. In this way you can interface to other software (see 10. Interface with
  1468. Other Software).
  1469.     These output in the disk file can be edited in the Edit window 
  1470. or the Aux Edit window. 
  1471.     It is recommended to use the BASIC output format by setting 
  1472. the switch output=basic when you write the output into the disk file. 
  1473. The default switch is output=basic.
  1474.  
  1475.                 (continued on the file SymbMath.DO2)
  1476.