home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-12-15 | 64.7 KB | 1,890 lines |
- ************************************
- * PLEASE READ THIS CAREFULLY *
- ************************************
-
- *********** L I C E N S E A G R E E M E N T ********************
- You may freely and give this demo version to anyone, but you must
- always copy ALL the files provided with the demo. The Demo files
- may NOT be modified in any way whatsoever. The demo version of
- Solutions may be copied onto a BBS without Elan Software's
- permission.
-
- This program and all accompanying data are the sole proprety of
- Elan Software, Copyright 1992, all rights reserved.
-
- *********** L I M I T E D W A R R A N T Y ********************
- Because of the way the demo version of the program is distributed,
- Elan Software may not offer any warranty whatsoever.
- You use this demonstration version of Solutions at your own risk.
- Elan Software specifically disclaims all warranties express or
- implied, including, but not limited to, any implied warranty of
- merchantability or fitness for a particular purpose.
- *****************************************************************
-
- LIMITATIONS OF THE DEMO VERSION:
- - GDOS cannot be bundled with the version demo, so unless you
- have GDOS yourself, you will have some strange characters appearing
- on screen.
- - Loading, saving and printing are disabled.
- - The software will only plot the equation 'SIN(X)-COS(1.3*X)'
- despite the equation you enter.
- - The demo version does not allow any object of more than 9 nodes.
- Of course, is no such limit in the original version. Any such
- object will be rejected and the message "ERROR: Too complex for
- demo version" will appear.
-
- Before using the Solutions demo, it is necessary to install it
- using the installation program (INSTALL.PRG).
-
- - Solutions' installation may be done from any drive.
- - You may install Solutions on diskette by installing on B: when
- asked for paths and file names. In that case, use a double-sided
- pre-formatted diskette and, on single drive systems, always swap
- your destination and source diskettes when the system asks "Please
- insert disk ? into Drive B:". - The installation itself will not
- begin until you answer "Yes" to the dialog box "Are you ready to
- begin installation?" showing all the settings you have made. If
- anything is wrong, answer "No" and run "INSTALL.PRG" again.
-
- Before using Solutions, you must reboot, so that GDOS and the
- Solutions fonts are correctly installed.
-
-
- Thank you for trying Solutions!
-
- To order or for any additionnal information:
- Elan Software
- 550 Charest Est
- P.O. Box 30232
- Quebec, G1K 8Y2
- Canada
- Voice: (418) 692-0565
- Fax: (418) 683-9189
-
- GEnie: P.DUBE
- CompuServe: 70471,3676
-
- December 1, 1992
-
- Solutions est aussi disponible en français.
-
- **************************** T U T O R I A L **********************
-
- **********************************************
- *** NOTE: SYMBOL CONVENTION IN ASCII FILES ***
- **********************************************
-
- Solutions uses some special characters that cannot be reproduced in
- normal ascii text. Those caracters are represented in this text in
- this way: (*symbol*). For example (*integral*) means the
- integration symbol. The special caracters are all represented and
- accessible in the "Special Keys" item under the "Help" menu. The
- right arrow symbol is represented as -> in this text but takes only
- one character within solutions. The same thing is true for <=, >=.
-
-
- Chapter 1
- ---------
-
-
- Introduction
- ------------
-
-
- This text is intended to teach you how to use the software more
- efficiently and be able to concentrate more on your mathematical
- problems than on software problems. There are important notions
- you should read in the following pages, followed by explanations by
- the editor, different modes (display mode, multi-line, angle mode,
- etc.), recovery commands, memory library, loading and saving to
- disk, printing. The following sections explain in detail the
- particularities of every object type and family of functions.
-
-
- Solutions is designed with a user friendly interface and has many
- functions to solve mathematical, engineering and computer science
- problems. And you are not limited to working with numbers,
- problems can be formulated symbolically, and equations can be
- manipulated directly and converted into numerical results later if
- desired.
-
- Solutions will assist you in the following areas:
-
- ∙ Algebraic computation: simplification, manipulation and
- expansion of expressions are just a few clicks away.
-
- ∙ Calculus: Solutions features numerical integration as well
- as fully algebraic differentiation.
-
- ∙ Graphics: you can plot algebraic expressions and
- statistical data.
-
- ∙ Statistics: you can handle single-variable and multi-
- variable statistics, and instantly obtain the mean, standard
- deviation, etc.
-
- ∙ Integer and bit manipulations: you can execute many
- functions with binary integer numbers, from base conversion to bit
- manipulation. These numbers can have up to 64 bits.
-
- ∙ Unit conversions: you can convert from one unit to another
- amongst the 120 built-in units. If that is not enough, you can
- define your own units.
-
-
- Since the documentation focuses on the use of Solutions, it assumes
- that you are already familiar with mathematics.
- Chapter 2
-
-
-
- Using Solutions
- ---------------
-
-
- 2.1. Installation
- -----------------
-
- Please read the instructions at the beginning of this file.
-
-
-
- 2.2. Concepts used in Solutions
- -------------------------------
-
- Solutions is a mathematical package that will assist you in solving
- a wide range of mathematical, engineering and computer science
- problems. It is intended to be easy to use and provides you with
- many helpful functions.
-
- The way it works is very uniform, efficient and versatile.
-
- If you are not familiar with the concepts used in Solutions, we
- suggest that you carefully read this chapter in order to make
- efficient use of the software. You are provided with 11 object
- types for your calculation needs, as follows:
-
- ∙ Real numbers: range from -9.999999999999E4899 to
- 9.999999999999E4899, the lowest representable numbers being +/-
- 1E-4899.
-
- ∙ Complex numbers: both the real and imaginary parts each have the
- same range as real numbers.
-
- ∙ Strings: characters strings of arbitrary length.
-
- ∙ Vectors: unidimensional arrays containing real and/or complex
- numbers.
-
- ∙ Matrices: bidimensional arrays containing real and/or complex
- numbers.
-
- ∙ Binary integers: integer numbers up to 64 bits long.
-
- ∙ Lists: data structures of arbitrary length containing objects of
- any type.
-
- ∙ Names: used to identify variables in the mathematical sense of
- the word.
-
- ∙ Algebraics: equations containing names and operators (e.g. 'X^2
- + SIN(Y)' )
-
- ∙ Programs: contain a series of instructions to be executed
- sequentially. The flow of control can be altered by special
- functions (IF...THEN...ELSE, DO...UNTIL, WHILE...REPEAT,
- FOR...NEXT).
-
- ∙ Operations: this object type performs all the work you want to
- do. They are the base of the kernel. There are more than 240
- functions, each one capable of accomplishing many different tasks.
-
-
-
- Because Solutions not only works with simple numbers, but with many
- different types of data, we have introduced the concept of object.
- An object is a piece of information with which you intend to work.
- There are 11 different types of objects which you can work with.
- These objects can be combined in various ways by applying operators
- to them in order to obtain new objects. To correctly harness the
- power of objects, Solutions makes use of a STACK. Every object is
- manipulated on the stack. Functions always take their arguments
- from the stack and return their results to it. The stack has
- arbitrary depth, and it can hold intermediate results for use in
- further calculations. Remember that pressing Esc will always
- cancel the current system operation.
-
- Solutions uses a simple technique, called RPN (Reverse Polish
- Notation), to combine all these functions and facilities. When you
- work in RPN, function arguments must precede the function.
-
- For example, if you want to add 1 and 2, in RPN you would enter 1,
- 2, +.
-
- This notation was chosen for several reasons. First of all,
- with RPN, you will be able to keep intermediate results on the
- stack. Secondly, when using RPN, there is no need for parentheses.
- Finally, the technique is consistent through the use of all
- functions (which is not what you see on most handheld calculators:
- e.g. arithmetic operations are used in true algebraic notation, and
- trigonometric functions used in RPN). With a little practice, it
- will become easy and natural. If you prefer, you may also enter
- your equations in true algebraic notation by typing a quote (')
- before the equation and evaluating it (EVAL) by pressing CTRL-H.
-
- The following example illustrates the use of RPN:
-
- Suppose you want to calculate 3+LOG(100)
-
-
-
- Type 3 and ENTER.
-
- Type 100 and ENTER.
-
- The stack will look like this:
-
-
-
- ______________________________
- | Stack |
- | (2 pi) |
- |4: |
- |3: |
- |2: 3|
- |1: 100|
- ------------------------------
-
-
- Now type LOG and ENTER.
-
- The stack will look like this:
-
- ______________________________
- | Stack |
- | (2 pi) |
- |4: |
- |3: |
- |2: 3|
- |1: 2|
- ------------------------------
-
-
- Finally press +.
-
- The final result (5) will appear on the first level of the stack:
-
- ______________________________
- | Stack |
- | (2 pi) |
- |4: |
- |3: |
- |2: |
- |1: 5|
- ------------------------------
-
-
- All functions take their arguments from the stack (they remove the
- objects from the stack) and return the result to the stack.
-
-
- The tools palette contains functions associated with the currently
- selected entry in the class menu. If you select a function from
- the tools palette, and the command editor is not empty, the
- function name will either be inserted in the command editor buffer,
- or normally executed after the execution of the content of the
- command editor buffer (depending on the current entry mode). To
- see the tool palette select "Show Tools Menu" in the "Options"
- menu. For more information, refer to the next section: "Editor".
-
-
-
- 2.3. Editor
- -----------
-
- This section explains how to work efficiently with the editor. You
- will learn what the editor and its numerous related functions can
- do.
-
- All the data for your calculations must be entered via the
- keyboard. This information first goes through the command editor.
- When you are finished editing, press "Enter" (or "Return"), and the
- command editor buffer will be analyzed. If an error is found
- during the analysis, a dialog box appears displaying which error
- has been detected. The cursor is then set at the point where the
- error is located.
-
- You insert a new line in the editor by pressing Control-Return.
-
-
-
- 2.3.1. Entry modes
- ------------------
-
- There are 3 different entry modes: numeric, text and algebraic.
- The current mode is displayed on the move bar of the editor window.
-
- Numeric mode is used to enter simple data. If you select a command
- or a function in the menu, the command editor buffer is analyzed
- and executed (if no errors occur), just as if you had pressed
- "Enter" before selecting the menu item.
-
- Text mode is used for free editing of any object. In text mode,
- the only way to enter data into the stack is to press "Enter". If
- you select a function or command, the name is inserted into the
- command editor. When " or « is pressed, text mode is
- automatically set (unless another mode is already locked in).
-
- Algebraic mode is used to enter algebraic equations. The
- particularity of this mode is that when you select a function, its
- name is inserted into the command editor buffer with a parenthesis
- following it, so that the function's arguments can be entered
- immediately. If the entry mode is not locked, pressing ' allows
- entry into and out of algebraic entry mode. The entry mode can be
- changed by pressing "Tab". It then changes from numeric to text to
- algebraic and finally back to numeric.
-
- If you press Control-X (or click on the corresponding item in the
- menu) while editing, a minus sign will be added to the object you
- just entered. If you press Control-X again, it will toggle to a +.
- If you press Control-X while not editing, the NEG function is
- applied to the selected object (default is level 1).
-
-
-
- Locking an entry mode
- ---------------------
-
- When you finish editing your data and enter it on the stack, the
- entry mode is automatically reset to numeric mode, unless another
- entry mode is locked in. You may lock in an entry mode by pressing
- "Control" before selecting the mode. The indication "[Locked]"
- will then appear in the menu, telling you that this entry mode is
- set and will not be reset to numeric after editing. Even pressing
- keys like ' or " will not change the entry mode. You may unlock
- the entry mode by selecting another entry mode or by pressing
- "Tab". If you press "Control" to unlock an entry mode, this new
- entry mode will be locked in. The entry lock mode is also
- controlled by flag 17.
-
-
-
- Insert mode
- -----------
-
- When editing, you may insert instead of overwriting by pressing the
- "Insert" key. It toggles between the overwrite and insert modes.
- The insert mode is controlled by flag 16. The replace mode is the
- default.
-
- Of course, using the arrow keys will move the cursor accordingly in
- the direction of the arrow.
-
-
-
- Being efficient at entering data
- --------------------------------
-
- In this section, we will give you some tips to help you enter data
- more efficiently by using less keystrokes and mouse operations.
- Let's see, for example, how you can save keystrokes when computing
- 3+4. The long and slow way would be to type: 3, [Enter], 4,
- [Enter], +. A more efficient way would be to type: 3 [space] 4 +.
- In this last example, if the entry mode was numeric, the last
- character (+) would not be entered into the command editor but
- directly executed. You can almost always replace the space
- delimiter with a comma (unless the radix character is the comma, in
- which case you would use a period). Comma (or period) and space
- are the two valid separators. They can be used in the editor to
- enter several objects at a time.
-
- Another way to save keystrokes is to use the tools palette
- containing functions. You simply select a function from the menu
- and this function is either executed or inserted into the command
- editor buffer (depending on the entry mode). You make the tools
- palette appear by selecting "Show Tools Menu" under Options (or by
- pressing Control-O).
-
- If you are only editing single objects, you don't have to type its
- ending delimiter ( ], ), ", ', } or »). For example, if you want
- to enter the vector [ 1 2 3 ], you would type [ 1 2 3 without the
- ending ]. But if you want to enter the vector [ 1 2 3 ] and the
- name xyz on the same line, you would have to type [ 1 2 3 ] xyz
- and not [ 1 2 3 xyz, because otherwise xyz would be considered as
- a vector element and an error would occur.
-
-
-
- Name restrictions
- -----------------
-
- You cannot use any variable name for object storage. There are a
- few names you should avoid in order not to make any errors. All
- Solutions' functions (in uppercase) cannot be used as variable
- names. You must also avoid the built-in names i, e and (*Pi*).
-
- There are also some variable names that are used for specific
- functions, for example EQ for plotting and solving. As for PPAR,
- (*SIGMA*)DAT, (*SIGMA*)PAR, you can use them, but is not
- recommended. You should leave them to their specific Solutions'
- uses.
-
- 2.3.2. Editing, Visiting
- ------------------------
-
- You can edit the object in level 1 by selecting Edit Object in the
- menu or just pressing Control-E. You can then edit the object any
- way you want. If you press ESC or delete all characters from the
- editor buffer, editing is cancelled. Press Enter to confirm and
- enter your modifications.
-
-
- If you want to edit the contents of an object stored in user
- memory, you just have to select Visit Variable or press Control-F
- while the object name is on the stack. This operation is called
- visiting. It is equivalent to 'name' RCL followed by editing and
- 'name' STO. If you press ESC or delete all characters from the
- editor buffer, editing is cancelled. Press Enter to confirm and
- enter your modifications.
-
-
-
- 2.4. Evaluation
- ---------------
-
- Evaluation plays a major part in Solutions since it occurs almost
- all the time, usually automatically. For example when you enter
- the name of a variable without entering the name delimiter ('), it
- is automatically evaluated. When you click on a variable name with
- the mouse in your tools palette, the variable name is entered on
- the stack and is evaluated. Some functions will evaluate arguments
- before using them (PUT, PUTI, GET, GETI, ->ARRAY, ROOT, and
- (*integrate*)).
-
- There are two functions that can be used to "manually" evaluate an
- object: EVAL and ->NUM.
-
-
-
- 2.5. Some modes
-
- The Modes class contains several functions that involve the various
- operational modes found in Solutions. The functions in the Modes
- class deal with number representation modes, recovery modes, the
- radix mode, and the multi-line display mode.
-
-
-
- 2.5.1. Number display
-
- The number representation modes only affect the way numbers are
- shown on the stack and have no impact on the precision of
- computations. You can change modes by using the STD, FIX, SCI and
- ENG commands.
-
- The standard mode displays all significant digits skipping the
- ending zeros.
-
- The fix mode displays numbers to a fixed number of digits, padding
- with zeros at the end of the number if necessary.
-
- The scientific mode displays numbers with a fixed length mantissa
- and an exponent preceded by an 'E'.
-
- The engineering mode displays numbers with a fixed length mantissa
- and an exponent preceded by an 'E'. The exponent is a factor of 3.
-
- These four modes have an adjustable number of digits, i.e. you can
- force Solutions to display less digits than the maximum.
-
-
-
- 2.5.2. Multi-line display
- -------------------------
-
- This mode determines if objects on the stack are displayed on more
- than one line, when appropriate. This mode is controlled by flag
- 45. It can also be modified using the ML command, which you will
- find in the Modes class.
-
-
-
- 2.5.3. Angle mode
- -----------------
-
- This mode determines how computations involving angular
- considerations will be done: in degrees or radians. This mode is
- controlled by flag 60. It can also be changed by the DEG and RAD
- functions.
-
-
-
- 2.5.4. Radix mark
- -----------------
-
- The radix mark indicates how the decimal point is displayed: it can
- be a period or a comma. This mode is controlled by flag 48. It
- can also be changed by the RADIX, command; you will find this
- command in the Modes class. When the radix mark is a comma, the
- objects delimiter is a period, and vice versa.
-
-
-
- 2.5.5. System flags
- ------------------
-
- There are two kind of flags: system flags and user flags. There
- are 64 flags of each type. The 64 user flags can be freely used by
- the user (you). The 64 system flags are dedicated to various
- predefined system settings. You can change the state of any of
- these flags, although, special care should be taken when using
- system flags to avoid unexpected results.
-
- The system flags are frequently updated without your knowledge.
- For example, when you change the binary integer base
- (DEC/BIN/OCT/HEX) or the number format (STD/FIX/SCI/ENG), the
- corresponding flags are automatically updated. You could also
- change the same flags directly with functions CSF and SSF to
- achieve the same result.
-
-
- 2.6. Recovery commands
- ----------------------
- Some special commands automatically make a copy of the stack before
- the execution of a function, or the arguments of the last function
- executed.
-
- The UNDO command allows you to recall the stack state as it was
- before execution of the last function or program. When UNDO is
- executed, after execution of a user program, the stack state is
- restored to what it was before the execution of the program. The
- UNDO mode is controlled by flag 29.
-
- The "Last Arguments" command allows you to recall the arguments of
- the last function executed. This command allows you to recall the
- arguments of the last function that was executed before the
- execution of the user program. The "Last Arguments" mode is
- controlled by flag 31.
-
-
- 2.7. Memory library
- -------------------
-
- Functions found in the Memory class deal with the management of
- user memory. User memory is a region of memory that is reserved
- for the user. The user can save objects in this memory for future
- use. Objects stored in user memory can be recalled or, in the case
- of programs, executed with a simple mouse selection. User memory
- is organized in a manner very similar to the organization of a disk
- directory.
-
- You can save (STO) objects in a directory, and even create
- subdirectories (CRDIR). Access to saved objects works on the
- current directory and up; this means that if Solutions searches for
- a certain name, it first checks if it can be found in the current
- directory; if it is not found, the search proceeds upwards through
- the directories, until the HOME directory is reached or the name is
- found.
-
- To move into a subdirectory, you just have to click on the
- corresponding name in the tools palette. Alternatively you may
- type the directory name and press "Enter". Directory names are
- shown with a down-arrow at their left. To go to the HOME directory
- (root), just type or click on HOME; to go to the parent directory,
- just type or click on UP.
-
- RCL is used to recall an object associated with a name and PURGE is
- used to delete it from user memory.
-
-
- 2.8. Load and Save
- ------------------
-
- ** NOT AVAILABLE IN DEMO VERSION **
-
- You may store all computed result on disk and recall them later.
- This is easily accomplished with items Load... and Save... in the
- File menu, but can also be done with functions LOAD and SAVE. You
- do not need to specify the type when loading.
-
- At startup, Solutions tries to load "SOLUTION.CFG", located in the
- same directory as the program, as the default configuration. See
- also section 2.8.7.
-
- 2.8.1. Objects
- --------------
-
- You can store single objects on disk with the Save... command from
- the File menu. The object is taken from level one of the stack.
-
-
-
- 2.8.2 Variable
- --------------
- You can store a single variable from the memory library to disk by
- pushing its name on the stack, selecting Save... from the File menu
- and choosing the variable button in the dialog box.
-
-
-
- 2.8.3 Stack
- -----------
- You can store the contents of the stack to disk by selecting
- Save... from the File menu and choosing Stack from the dialog box.
-
-
-
- 2.8.4. System flags
- -------------------
- You can store all the system flags on disk by selecting Save...
- from the File menu and choosing Flags from the dialog box. You
- cannot directly save user flags. However, you can do 1 RCLUF 2
- nLIST "filename" SAVE to save user flags and do "filename" LOAD
- STOUF to recall saved user flags.
-
-
-
- 2.8.5. User library
- -------------------
-
- You can store all objects in user memory along with their
- associated names on disk by selecting Save... from the File menu
- and choosing Library from the dialog box.
-
-
-
- 2.8.6. Graphic coordinates
- --------------------------
-
- The graphic coordinates option enables you to export the values of
- a function in a text file. These values are comma delimited and
- may easily be imported in most spreadsheet and graphic software.
-
-
-
- 2.8.7. Configuration
- --------------------
-
- You can store Solutions' configuration by selecting Save... from
- the File menu and choosing Configuration from the dialog box. The
- configuration includes the location of every window, their size and
- so on; in fact it includes a lot of system variables that are not
- directly accessible to the user. User flags are also saved with
- the configuration.
-
-
-
- 2.8.8. Context
- --------------
-
- You can store the Solutions context by selecting Save... from the
- File menu and choosing Context from the dialog box. The context is
- a combination of all objects on the stack, system flags, user
- memory, and the configuration. Therefore loading a context will
- return you to the exact state Solutions was in before saving the
- context.
-
-
-
- 2.9. Printing
- -------------
-
- ** NOT AVAILABLE IN DEMO VERSION **
-
- The functions found in the Print class are used to output graphics
- or stack objects to the printer. Graphics are sent to the printer
- via the GDOS software interface. GDOS is bundled with Solutions
- and should be installed following the instructions at the beginning
- of this file. Any other type of output to the printer is done in
- plain ASCII without any special control or formating codes. You
- are free to set up your printer the way you like (NLQ mode,
- condensed mode, etc.). You should make sure your printer is in a
- mode where it recognizes the extended ASCII IBM character set or
- some printouts will look strange.
-
-
-
- 2.9.1. A single stack level
- ---------------------------
- You may print stack level 1 with function PR1. The object is
- printed in multi-line format, when possible.
-
-
-
- 2.9.2. Stack
- ------------
-
- The PRSTACK function is used to print every stack level. Multi-
- line format is used, when possible.
-
-
-
- 2.9.3. Objects in memory library
- --------------------------------
- The PRUSR function is used to print all variables in the current
- directory and their content. If the current directory holds no
- user variables, the message No User Variables is printed.
-
-
-
- 2.9.4. Object names in memory library
- -------------------------------------
-
- The PRVAR function is used to print all variables in the current
- directory.
-
-
-
- 2.9.5. Graphic
- --------------
-
- The PRGRAPH function is used to print the graphic appearing in the
- current graphic window.
-
-
-
- 2.10. Unit conversions
- ----------------------
-
- Solutions allows you to convert from any unit into another unit
- from the 120 predefined units or their combinations. CONVERT is
- the function that computes the conversion.
-
- Each one of the 120 predefined units is expressed in terms of SI
- units (International System of Units). You may use units as you
- find them in the Units catalog, or use a combination of units to
- make a new unit, taking care to have consistent units. For
- example, you can convert 'm' (meters) into 'ft' (feet) but not into
- 's' (seconds). You can build units by using operators *, / and ^.
- Only one / symbol is allowed. The delimiters ', space and
- parentheses are ignored. So, you could, for example, convert 'kph'
- (kilometers per hour) into 'in/s' (inches per second). You may
- also use a prefix preceding the unit which represents a
- multiplicative power of 10.
-
- CONVERT computes a multiplicative factor for the two units given in
- argument. The operand is multiplied by this result and returned to
- the stack.
-
- Temperatures also involve additive constants. However, if any unit
- includes a prefix, an exponent or any other unit that is not a
- temperature unit, a relative conversion is done.
-
- You may use user-defined units, that will act as built-in unit
- types. The new unit type has to be stored in user memory and be
- accessible for use with CONVERT.
-
- For example, if you want to define a new unit called 'week',
- execute
-
- { 7 "d" } 'week' STO
-
- You may now use 'week' in your future conversions.
-
- You may also want to define dimensionless units or units that are
- not expressible in SI units. You just have to use "?" for unit.
-
- For example to convert between bytes and kilobytes define:
-
- { 1 "?" } 'byte' STO
-
- {1024 "?" } 'Kbyte' STO
-
- You may now convert between the two units.
-
- Check section 2.11.2 for a list of all the available units
-
-
- 2.11. Catalogs
- --------------
-
- There are two useful catalogs that can be used for looking up a
- function's arguments or a certain conversion unit.
-
-
-
- 2.11.1. Functions catalog
- -------------------------
-
- You can access the catalog of all Solutions functions from the Help
- menu; it can also be accessed by pressing Control-J.
-
- The small window shows all Solutions functions. You can scroll the
- window up or down to view additional functions. You can select any
- function and look at its possible argument types. There may be up
- to three object types represented on stack levels. The Next and
- Previous buttons are used to show the next and previous argument
- type combinations. You can press the Help button to obtain more
- information on the selected function. Pressing Fetch fetches the
- function name for the command editor. Pressing the up and down
- arrow keys moves the function selector up or down. Pressing a
- letter on the keyboard brings you to the first function beginning
- with that letter.
-
-
-
- 2.11.2 Units catalog
- --------------------
-
- You can access the built-in SI unit catalog from the Help menu; it
- can also be accessed by pressing Control-K.
-
- The small window shows all SI units. You can scroll the window up
- or down to view additional entries. Each line in this catalog
- shows you a unit name, its symbol and its value given in SI units.
- You can select a unit and fetch it for the command editor.
- Pressing the up or down arrow keys moves the units selector up or
- down. Pressing a letter on the keyboard brings you to the first
- unit beginning with that letter.
-
-
-
- 2.12. Memory management
-
- In order to maximize memory availability, it was necessary to
- implement a new memory manager, which is totally transparent to the
- user. This manager uses memory as efficiently as possible, and
- warns you when you are out of memory. The item "Memory..." in the
- "Help" menu displays the memory dialog box.
-
- This is where the amount of remaining memory is displayed. The
- "Garbage Collect" button can be used to force the system to perform
- garbage collection. This process causes the system to optimize the
- available memory. Automatic garbage collection is done by the
- system when a request for more memory is done. The system may be
- slowed down if you have just enough memory for a demanding task;
- this happens because the system is continuously doing garbage
- collection to obtain the memory it needs.
-
- Chapter 3
-
-
-
- Functions categories and object types
- -------------------------------------
-
- What follows is an explanation of each functions category and a
- list of the functions related to these categories. There is one
- category for each submenu in the Menus menu.
-
- Some functions appear in more than one section, so you should check
- all the appropriate sections to find the most pertinent information
- for your needs.
-
-
-
- 3.1 Algebra
- -----------
-
- An algebraic object is an equation that may contain one or more of
- the following:
-
- ∙ Real or complex numbers.
-
- ∙ Names (also called variables).
-
- ∙ Functions: any function that accepts algebraic objects as input.
- The function name will appear followed by one or more arguments
- within parentheses.
-
- ∙ Operators: There are two kinds of operators: prefix operators
- such as NOT, (*square root*) and NEG (which appears as the unary -
- sign in algebraic objects) and infix operators such as +, -, *, /,
- ^, =, ==, (*Not equal*), <, >, <=, >=, AND, OR and XOR. Prefix
- operators precede their arguments, while infix operators act on the
- expressions leading and trailing them.
-
-
-
- Operator precedence
-
- The evaluation of an algebraic object proceeds in an order
- dictated by the relative priority (called precedence) of the
- operators in it. The precedence rules are as follows:
-
- 1. Expressions within parentheses are always evaluated first; in
- the case of nested parentheses, evaluation proceeds outwards from
- the deepest nesting level.
-
- 2. Functions are evaluated once their arguments are evaluated and
- before the expressions they belong to can be evaluated.
-
- 3. Operators are evaluated according to the following precedence
- rules or from left to right when they have the same precedence.
-
-
- a) Exponentiation (^) and square root
- b) Negation (-), multiplication (*), and division (/)
- c) Addition (+) and substraction (-)
- d) Relational operators (==, (*Not equal*), <, >, (*less or
- equal*), (*greater or equal*))
- e) AND and NOT
- f) OR and XOR
- g) =
-
-
- where a) is the highest precedence and g) the lowest.
-
- When an equation contains the equality operator (=), the expression
- is divided into two subexpressions which are the arguments of the
- operator. When you apply a function to such an expression, the
- function is applied to each subexpression. When the expression is
- evaluated, the = operator is treated like a substraction (-).
-
- Unlike certain computer languages (like BASIC), the = operator
- doesn't mean "replace by" as in "A = 2". This operation is
- performed by the STO function. The = operator involves two
- arguments, and its purpose is to equate these two arguments. It
- behaves like = in mathematics.
-
-
-
- Automatic simplification
- ------------------------
-
- All entered data can be simplified automatically by evaluating it.
- For example, if you enter X 1 * , the result will simply be 'X'.
- The same thing happens when you evaluate an algebraic object. For
- example evaluation of '1*X' returns 'X'.
-
-
- Symbolic constants: e, i, (*Pi*), MAXR and MINR
-
- There are five predefined objects that represent often used
- constants. The evaluation of these constants is affected by the
- state of flag 35 (Constants mode) and flag 36 (Results mode).
-
- If flag 35 or flag 36 is clear, these objects will evaluate to
- their numeric values.
-
- If flags 35 and 36 are set, these objects will retain their
- symbolic form when evaluated.
-
-
-
- Here is the numerical value of each constant:
-
- e: 2.718281828459045
-
- i: (0,1)
-
- (*Pi*): 3.141592653589793
-
- MAXR: 9.999999999999999E4899 (maximum real number)
-
- MINR: 1.E-4899 (minimum real number)
-
-
-
- The algebra menu has functions to perform simplifications,
- expansions and various reorganizations of algebric expressions
- without affecting their value.
-
- The functions found in the Algebra class are: COLLECT, EXPAND,
- SIZE, FORM, OBSUB, EXSUB, TAYLOR, ISOL, OBGET, EXGET and SDIFF.
-
-
-
- 3.2. Arithmetic
- ---------------
-
- The usual arithmetic functions are available. They are: +, -, *,
- /, ^, INV, (*Square root*), SQ and NEG. For more informations
- about these functions you should consult the dictionary (Chapter
- 4).
-
-
-
- 3.3. Array
- ----------
-
- An array is composed of real or complex numbers. Arrays can have
- one or two dimensions. One-dimensional arrays are called vectors;
- two-dimensionnal arrays are called matrices.
-
-
-
- Example of a 6 element vector:
-
- [ 1 2 3 4 5 6 ]
-
-
-
- Example of a 2 row by 3 column matrix:
-
- [[ 1 2 3 ]
- [ 4 5 6 ]]
-
-
-
- Entering arrays with the command editor
-
- To enter a vector, first type [ followed by the vector elements
- separated by blank spaces. A vector must always contain at least
- one element. The elements may be real or complex. If you want to
- enter a single vector at this point, the ending ] is optional and
- will be added automatically. But if you start entering another
- object without typing ] at the end of your vector, the following
- objects will be treated as vector elements and an error is likely
- to occur. A matrix is entered as a series of vectors, one per row,
- separated by [ symbols.
-
- Ex.: [[2 3 [4 5 will become
-
- [[ 2 3 ]
- [ 4 5 ]]
-
- Some functions require the array dimensions. Array dimensions are
- given as a list of real numbers; the first number is the number of
- rows and the second number is the number of elements per row. In
- the case of a vector, only one number, specifying the number of
- elements, is used.
-
- The array functions are: ->ARRAY, ARRAY->, PUT, GET, PUTI, GETI,
- SIZE, RDM, TRN, CON, IDN, CROSS, DOT, DET, ABS, RNRM, CNRM, R->C,
- C->R, RE, IM, CONJ and NEG.
-
-
-
- 3.4. Binary
- -----------
-
- Binary integers are whole unsigned numbers that are represented
- internally on up to 64 bits. Binary integers are displayed with a
- # sign preceding them and end with a letter representing the
- current binary mode (b, d, o or h for binary, decimal, octal and
- hexadecimal respectively). These binary bases are only four
- different ways to view binary integer numbers. Internally, their
- representations do not change. The binary representation mode or
- base can be changed by using the functions BIN, DEC, OCT and HEX;
- the base is also controlled by flags 43 and 44.
-
- The binary wordsize indicates the number of bits used for
- calculations and determines how the numbers will be displayed. The
- binary wordsize can be changed with the STWS function and is also
- controlled by flags 37 to 42.
-
- In binary base, only digits 0 and 1 are allowed. In octal base,
- digits 0 through 7 are allowed. In decimal base, digits 0 through
- 9 are allowed, and in hexadecimal base, digits 0 through 9 and
- uppercase letters A through F are allowed. When entering a binary
- number, you first have to type # and then the number. The number
- will be entered in the current binary mode. You can force another
- binary mode by ending your number with b, d, o or h for binary,
- decimal, octal or hexadecimal respectively.
-
-
-
- The +, -, * and / functions can be applied to binary integer
- numbers.
-
- The functions described below are useful when working with binary
- integer numbers: they work with the bits that compose binary
- numbers. These functions perform rotations, translations, or do
- logical operations. They are: DEC, HEX, OCT, BIN, STWS, RCWS, RL,
- RR, RLB, RRB, RnB, BnR, SL, SR, SLB, SRB, ASR, AND, OR, XOR and
- NOT.
-
- 3.5. Calculus
- -------------
-
- Calculus is an important field in mathematics. There are two
- primary and important operations in calculus: differentiation and
- integration. Essentially, differentiation is used to find the
- slope of a given equation at any point, while integration is used
- to compute the area under the curve of an equation, over an
- interval. Differentiation is also used for the expansion of an
- expression into a Taylor series.
-
- Calculus functions are: (*differentiation*), (*integration*) and
- TAYLOR.
-
-
-
- 3.5.1. Differentiation
- ----------------------
-
- Differentiation is essentially used to find an equation describing
- the slope of an equation. The equation returned by the
- differentiation describes the slope at every point of the original
- equation.
-
- You can differentiate an equation in a single pass or do step by
- step differentiation. You execute the (*differentiation*) function
- with an equation on stack level 2 and the variable of interest on
- stack level 1.
-
- For example if you type 'X*SIN(X)' 'X' (*differentiation*), the
- returned expression will be 'X*COS(X)+SIN(X)', but if you type
- '(*differentiation*)X(X*SIN(X))' and repeatedly evaluate (EVAL)
- this expression, the result will be calculated step by step.
-
- This can be useful when you want to see every intermediate result
- of the differentiation. Before differentiating, the function
- always does an expression substitution, that is if a name is the
- name of a stored expression, the expression is substituted for the
- name in the equation.
-
- When the derivative of a function or a user-defined function is not
- available, partial differentiation is done, and is noted by der.
- For example, if you want to differentiate the equation '%(X,Y)'
- with respect to X, you get the result 'der%(X,Y,1,0)'. The name
- following der is the function name that has been partially
- differentiated, and the last two arguments are the initial two
- arguments differentiated with respect to the variable name. You
- can use this feature to implement the derivative of any new
- function you create and store it in your library. For example, to
- fully define the derivative of the % function, you would define the
- following function:
-
- « -> a b da db '(a*db+b*da)/100' » 'der%' STO
-
- You may now calculate the derivative of '%(3*X,Y^2)' for 'X' which
- would return 'Y^2*3/100'.
-
-
-
- 3.5.2. Integration
- ------------------
-
- Integration plays an important role in calculus and in mathematics;
- it also is involved in many engineering and physics problems. Its
- purpose is not only to compute the area under a curve, but if you
- don't know about integration, you can think of it this way. We
- recommend that you read an introductory book on calculus and
- integration if you want to understand it and use it correctly in
- Solutions.
-
- Numerical integration is possible with Solutions. Numerical
- integration is used to obtain a numerical result from a definite
- integral. This result can be represented as the area under the
- curve (the equation) between two given points (a and b). The
- accuracy determines the wanted precision of the result. The
- equation can be an algebraic expression or a program. If the
- argument in level 3 is a program, it can be of two types: it can
- demand arguments or not. If the program takes many arguments, you
- must explicitly name the variable of integration, and the result
- should be returned on the stack. If the program takes no argument,
- it must use the given argument on the stack and return its result
- to the stack. For example these two programs will produce the same
- results when numerically integrated:
-
- « X SIN » in level 3 with { X 1 2 } in level 2 and .001 in level 1
-
- and
-
- « SIN » in level 3 with { 1 2 } in level 2 and .001 in level 1.
-
- Here is another example of how to use numerical integration:
-
- 'SIN(X)' in level 3 with {X 1 2} in level 2 and .001 in level 1.
-
-
- As you can see, there are different ways to numerically integrate
- the equation 'SIN(X)' over the interval 1-2. Given these arguments
- on the stack, you just have to execute (*integration*).
-
-
-
- 3.5.3. Taylor series
- --------------------
-
- The TAYLOR function is used to compute the taylor series polynomial
- approximation for a function. The approximation is computed around
- point pt, or at 0 if no point is specified.
-
- You should look at your results closely if flag 59 is clear
- (infinite results do not generate errors) because incorrect results
- may occur if the equation is not differentiable at x=pt.
-
-
-
- 3.6. Complex numbers
- --------------------
-
- Complex numbers are made up of two real numbers enclosed in
- parentheses. Most arithmetic (+, -, *, /, INV, (*square root*),
- SQ, ^), trigonometric (SIN, ASIN, COS, ACOS, TAN, ATAN), hyperbolic
- (SINH, ASINH, COSH, ACOSH, TANH, ATANH) and logarithmic functions
- (EXP, LN, LOG, ALOG) accept complex numbers as arguments. The
- symbolic constant i represents the complex number (0,1).
-
- Functions found in the Complex class are: R->C, C->R, RE, IM, CONJ,
- SIGN, ABS, NEG and ARG.
-
-
-
- 3.7. Lists
- ----------
-
- Lists are collections of objects which appear on the stack
- surrounded by the { and } delimiters. Any object can be part of a
- list. There is no preset limit on the size of lists. It can be
- empty or contain many objects.
-
- The indexes of arrays and lists are usually described as lists; a
- one-element list describes an index within a vector or a list, and
- a two-element list describes a row and column index within a
- matrix.
-
- Functions available in the List class are: ->LIST, LIST->, PUT,
- GET, PUTI, GETI, SUB and SIZE.
-
-
-
- 3.8. Logs
- ---------
-
- Logarithmic and hyperbolic functions can be found in the Logs
- class. These functions are: LOG, ALOG, LN, EXP, SINH, ASINH, COSH,
- ACOSH, TANH and ATANH.
-
-
-
- 3.9. Memory
- -----------
-
- This topic has already been discussed in section 2.8. Functions
- available in the Memory class are: MEM, MENU, PATH, HOME, UP,
- CRDIR, VARS, PURGE and CLUSR.
-
-
-
- 3.10. Modes
- -----------
-
- This topic has already been discussed in section 2.6. Functions
- available in the Modes class are: STD, FIX, SCI, ENG, DEG, RAD and
- the commands CMD, UNDO, LAST, ML and RADIX,.
-
-
-
- 3.11. Plot
- ----------
-
- ** DEMO VERSION: PLEASE NOTE SOLUTIONS WILL ALWAYS PLOT THE
- EXPRESSION 'SIN(X) + COS(1.3*X)' REGARDLESS OF THE EQUATION YOU
- ENTER
-
- Items found in the Plot class will allow you to plot mathematical
- expressions, or generate statistical scatter plots. These graphics
- will always appear in the graphics window. The following steps
- describe how to plot a simple graphic.
-
- Suppose you want to plot the expression 'SIN(X) + COS(1.3*X)'.
- First, enter this equation on the stack, and execute STEQ. This
- stores the equation in the variable EQ. This variable is always
- used when plotting equations, so its name should be reserved for
- this application. Then you just have to execute DRAW. You should
- see the graphic window appear.
-
- When the computations are terminated, you can use the cursor to
- peek at the exact location of a pixel in the window. You can
- readjust the window's size to see more details or make the graphic
- smaller. The coordinates within the window are fixed, so changing
- the window's size should not change the graphic's form; you will
- just see the same graphic enlarged or reduced. The window's
- coordinates and some other parameters related to the current
- graphic are stored in variable PPAR (plotting parameters; PPAR is
- another name that should be reserved for plotting). When DRAW is
- executed, the variable PPAR is consulted for the current plot
- settings, or if it is not found, a default PPAR is created. A new
- default PPAR is created each time a function involving the graphic
- window is called and no PPAR has been created. The variable PPAR
- is a list containing the following 5 elements:
-
- (xmin, ymin): a complex number indicating the coordinates of the
- lower-left hand corner of the graphic window. Can also be changed
- with function PMIN.
-
- (xmax, ymax): a complex number indicating the coordinates of the
- upper-right hand corner of the graphic window. Can also be changed
- with function PMAX.
-
- independent: a variable name representing the abscissa of the plot.
- Can also be changed with function INDEP.
-
- resolution: a real number indicating the step between each
- calculated point. For example 2 would indicate that every 2 pixels
- the exact coordinate is to be computed. If flag 22 is set, a line
- is drawn through each computed point. Can also be changed with
- function RES.
-
- axes: a complex number indicating the center coordinates of the
- axes. By default, the axes are drawn at (0,0), but you can change
- this with the function AXES.
-
-
-
- You can also use programs to make plots. Your program must take
- one real argument on the stack and return one real number. The
- argument indicates the horizontal coordinate, and the result
- represents the vertical coordinate. The DRAW function plots the
- graph from the results returned by the program.
-
-
-
- You can also make statistical scatter plots. First enter your data
- points (refer to the Statistics section). Then execute
- SCL(*Sigma*) to scale the coordinates so all points will be
- displayed in the graphic window. And then execute DRAW(*sigma*) to
- generate the scatter plot.
-
- Functions available in the Plot class are: STEQ, RCEQ, PMIN, PMAX,
- INDEP, DRAW, PPAR, RES, AXES, CENTR, *W, *H, STO(*sigma*),
- RCL(*sigma*), COL(*sigma*), SCL(*sigma*), DRAW(*sigma*), CLSCR,
- PIXEL, DRAX, PRGRAPH.
-
-
-
- 3.12. Print
- -----------
-
- ** NOT AVAILABLE IN DEMO VERSION
-
- This topic has already been discussed in section 2.9. Functions
- available in the Print class are: PR1, PRVAR, PRGRAPH, PRSTACK,
- PRUSR, PRMD and the command TRACE.
-
-
-
- 3.13. Programming
- -----------------
-
- If you want to do more than simple manual execution of functions,
- you can do programming. A program is a powerful object type that
- allows you to execute a serie of functions and to make decisions
- allowing conditional execution and loops. Programs are delimited
- by « and » and appear as a series of structured instructions
- (functions) and objects. In fact, the contents of any editor
- buffer may be preceded with « to make it a program. All
- programming structures uses the RPN form (the arguments must
- precede the function).
-
- The purpose of this section is to teach you how to use the
- Solutions language for your needs. In fact, programs are just
- series of instructions or objects that are sequentially executed as
- if they were typed directly on the keyboard, one by one. There are
- special functions that are only available within programs that
- allow conditional execution and looping. Some of them
- conditionally alter the flow of execution (IF...THEN...END,
- IF...THEN...ELSE...END), some define conditional loops (FOR...NEXT,
- START...NEXT, DO...UNTIL...END, WHILE...REPEAT...END) and some trap
- errors (IFERR...THEN...END, IFERR...THEN...ELSE...END). These
- functions or program structures are explicitely defined in the
- Program Branch section below.
-
- The Program Control class contains the following functions: CLSCR,
- ERRN, ERRM and WAIT.
-
- The Program Branch class contains the following functions: IF,
- IFERR, THEN, ELSE, END, START, FOR, NEXT, STEP, IFT, IFTE, DO,
- UNTIL, WHILE and REPEAT.
-
- The Program Test class contains the following functions: SSF, CSF,
- SFS?, SFC?, SFS?C, SFC?C, SUF, CUF, UFS?, UFC?, UFS?C, UFC?C, AND,
- OR, XOR, NOT, SAME, ==, STOSF, RCLSF, STOUF, RCLUF and TYPE.
-
- You can include programs within programs to postpone their
- evaluation. For example, the program « 1 2 « a b » »
- pushes the numbers 1 and 2 on the stack, then pushes the program «
- a b » on the stack. Executing EVAL would then execute the
- program. The included program can be any valid program regardless
- of its complexity.
-
-
-
- 3.13.1. Local variables
- -----------------------
-
- Until now, all variables stored in the user menu were global
- variables. Local variables are variables that only exist within
- specific parts of programs and are erased when execution of the
- part is finished. Two functions can be used to create local
- variables: -> and FOR. The local variables created with the ->
- function can be used at any time within the program and thus will
- supersede any global variable of the same name without erasing
- them. When the program ends, the local variables are deleted.
- When searching for a variable name, Solutions always searches local
- variables first (from the inner most program outwards) and then the
- user library. The following examples illustrate the use of local
- variables:
-
- « -> A B
- « 4 A * B +
- »
- »
-
- Here, two local variables (A and B) are created when beginning the
- execution of the program. The -> function also requires that
- arguments be present on the stack to initialize the local
- variables. The first stack entry is used to initialize the last
- argument, and so on.
-
- « 1 5 FOR A 2 A * NEXT
-
- »
-
- Here, the variable A is local and only exists within the scope of
- the FOR loop (i.e. between the FOR and its corresponding NEXT).
-
-
-
- Recursion is the possibility for a program to call itself. For
- example, the factorial function can be defined recursively, where:
-
- x! = x*(x-1)! and
- 1! = 1
-
- In the Solutions language, it would appear like this:
-
- « -> X
- «
- IF X 1 ==
- THEN 1
- ELSE X X 1 - MYFACT *
- END
- »
- »
- 'MYFACT' STO
-
- As you can see in this example, a recursive program contains a call
- to itself. There must be a test clause to end the recursion, or
- the program will run until it runs out of memory.
-
-
-
- 3.13.2. User-defined functions
- ------------------------------
-
- You can create user-defined functions that act like built-in
- functions. They consist of a program that takes arguments off the
- stack and returns a result based on an expression in the code.
- Here's an example:
-
- The program:
-
- « -> X Y Z 'X + 2*Y + 3*Z'»
-
- 'XYZ' STO
-
- is a user-defined function. You could now execute the function in
- the traditionnal way:
-
- 1 4 9 XYZ
-
- or like this:
-
- 'XYZ(1,4,9)' EVAL
-
- and obtain the same result: 36.
-
- 'XYZ(3,4,3*B)' EVAL would return:
-
- '11+3*(3*B)'. Using COLLECT, the expression would simplify to
- '11+9*B'
-
- You may define the derivative and the inverse of a user-defined
- function. Please see sections 3.5.1 and 3.15 respectively.
-
-
- 3.13.3. Program branch
- ----------------------
-
- The Program Branch class contains the various branching and looping
- constructs available for structured programming. These structures
- can be nested, i.e. there can be a conditional statement within
- another one, but the entire inner conditional statement must reside
- within the outer one.
-
- The various conditional branching and looping structures make
- decisions based on the evaluation of a test expression. A test
- expression is an expression that returns a flag. A flag is a
- number that is interpreted as "false" or "clear" when it equals 0
- and as "true" or "set" when it equals 1 (or any other non zero
- value). Except for the IFT and IFTE functions, all the functions
- listed in this section can only be used within programs.
-
-
-
- 3.13.4. Decision structures
- ---------------------------
-
- There are two possible decision making structures:
-
- ∙ IF test-clause THEN true-clause END
-
- ∙ IF test-clause THEN true-clause ELSE else-clause END
-
- Each clause may contain any sequence of instructions (even
- nothing). When THEN is executed, the first stack level contains
- the result of the test-clause evaluation, which is used to
- determine whether the program continues its execution after the
- THEN (true result), or after the ELSE (false result). If no ELSE
- is present, execution continues after the END. When executing a
- true-clause, if we encounter an ELSE function, we will jump to the
- corresponding END.
-
-
-
- 3.13.5. Error-trapping structures
- ---------------------------------
-
- There are two possible error-trapping structures:
-
- ∙ IFERR trap-clause THEN error-clause END
-
- ∙ IFERR trap-clause THEN error-clause ELSE normal-clause END
-
- These structures are used to detect any anomalies within the trap-
- clause and immediately branch to an error-clause, or execute the
- normal-clause (if any) when no error occurs.
-
- For example, take a look at this program:
-
- «
- IFERR X Y / 5
- THEN "Division by 0"
- ELSE "Ok!"
- END
- »
-
- Assuming that flag 59 is set, if Y is equal to 0, a division by 0
- occurs and the execution jumps to the error-clause (number 5 is not
- pushed on the stack). The error clause pushes the string "Division
- by 0" on the stack, and ends the program. Otherwise, 5 is pushed
- on the stack, followed by the string "Ok!".
-
-
-
- 3.13.6. Definite loop structures
- --------------------------------
-
- There are 4 possible definite loop structures:
-
- ∙ start finish START loop-clause NEXT
-
- ∙ start finish START loop-clause step STEP
-
- ∙ start finish FOR name loop-clause NEXT
-
- ∙ start finish FOR name loop-clause step STEP
-
- These structures define loops where the loop-clause is executed a
- number of times determined by start, finish and step. FOR creates
- a local variable called name, which will be active for the duration
- of the loop. The START function can be used when there is no need
- to refer to a variable within the loop-clause. step indicates the
- increment to apply to the variable (explicit or implicit) before
- repeating the loop or exiting the loop. Here are some examples:
-
- «
- 1 4
- FOR A A
- NEXT
- »
-
- This program pushes numbers 1 through 4 on the stack.
-
- «
- 1 4
- FOR A A 2 + .2
- STEP
- »
-
- This program pushes A+2 on the stack, incrementing A by .2 after
- each loop. The loop ends when A reaches 4.
-
-
-
- «
- 1 4
- START SIN
- NEXT
- »
-
- This program executes SIN four times.
-
-
-
- 3.13.7. Indefinite loop structures
- ----------------------------------
-
- There are 2 possible indefinite loop structures:
-
- ∙ DO loop-clause UNTIL test-clause END
-
- ∙ WHILE test-clause REPEAT loop-clause END
-
- The first loop structure causes the loop-clause to be executed at
- least once since the test-clause is at the end of the loop, and
- repeats the loop-clause as long as the test-clause remains true
- (non-zero).
-
- The second loop structure causes the loop-clause to be repeated
- until the test-clause is false (zero). If the test-clause is false
- on the first pass, the loop-clause is never executed.
-
- Here are examples of these loop structures:
-
- «
- { } { 1 1 } 3 ROLL SWAP
- DO GETI 4 ROLL SWAP + 3 ROLLD
- UNTIL 46 SFS?
- END DROP2
- »
-
- This program takes a matrix as an argument and returns its elements
- in a list. The condition (46 SFS?) determines when to exit the
- loop as flag 46 is set when the last element has been retrieved
- with the GETI command.
-
-
- «
- WHILE DUP 10 <
- REPEAT 1 +
- END
- »
-
- This program adds 1 to a real number as long as it has not reached
- 10.
-
-
-
- 3.13.8. Program Test
- --------------------
-
- Functions found in the Program Test class are used to test several
- possible conditions. The result of a test is a number, called a
- flag. A flag only has two possible values: true or false. In
- Solutions, zero is used for the false result, and non-zero (usually
- 1) for the true result. There are two sets of flags you can use:
- the system flags and the user flags. There are 64 of each. The
- system flags are reserved for special functions affecting the
- operation of Solutions. You can modify these flags to suit your
- needs, but you should check in appendix A when using a flag
- directly, so that you know exactly what you are doing. User flags
- are fully accessible to the user, and you may do what you want with
- these flags. You may copy the state of the system or user flags to
- the stack using the RCLSF and RCLUF functions respectively. The
- state of the flags are given to you as a binary number. Functions
- STOSF and STOUF use a binary number to set the state of the system
- or user flags respectively.
-
-
-
- 3.14. Real
- ----------
-
- A real number is the most simple object type, since it just
- consists of a number as we know it. But there are some
- restrictions to the real numbers handled by Solutions. The domain
- of real numbers is not infinite. They range from
- -9.999999999999999E4899 to 9.999999999999999E4899, and the smallest
- value is +/-9.999999999999999E-4899.
-
- The format of a real number is as follows:
-
- (sign) mantissa E (sign) exponent
-
- and
-
- 1 <= mantissa <= 10
-
- 0 <= exponent <= 4899
-
- where the mantissa may have up to 16 significant digits, and the
- exponent may have up to 4 digits. Of course, you can enter and
- display numbers in other formats than the scientific format. You
- may enter numbers by typing them as they appear on the stack in any
- format.
-
- Functions found in the Real class are: NEG, FACT, RAND, RDZ, MAXR,
- MINR, ABS, SIGN, MANT, XPON, IP, FP, FLOOR, CEIL, RND, MAX, MIN,
- MOD, %T and %CH.
-
-
-
- 3.15. Solve
- -----------
-
- The functions found in the Solve class can be seen as extensions to
- the Algebra functions, as applied to the solving of equations.
-
- ISOL will help you solve equations symbolically. This may be more
- useful since you will often need to have mathematical results
- instead of numerical results.
-
- The results of the symbolic solver (ISOL) are dependant on flag 34,
- which determines if the principal value (flag set) or the general
- solution (flag cleared) is returned. When in general solution
- mode, the result may contain one or more variables named 'sx' and
- 'nx', where x represents an integer greater than 0. The variable
- 'sx' is used when Solutions wants to express a conditional sign or
- +/-. And the variable 'nx' is used when Solutions wants to express
- any unsigned integer. For example, if you type 'X^2+4' 'X' ISOL,
- the result is 's1*(0,4)/2' which means +/-4i/2.
-
- And if you type 'SIN(X)=1' 'X' ISOL, the result is
- '1.570796326794897*(-1)^n1+(*Pi*)*n1' which means you can assign
- any positive integer to n1 to solve the equation.
-
- When the inverse of a function or a user-defined function is not
- available, partial inversion is done, and is noted by inv. For
- example, if you want to isolate X in the equation 'IP(X)=5', you
- get the result 'invIP(5)'. The name following inv is the function
- name that has been partially inverted. You can use this feature to
- implement the inverse of any new function you create and store it
- in your library. For example, to fully define the (fictive)
- inverse of the IP function, you would define the following
- function:
-
- « -> a 'a+1' » 'invIP' STO
-
- You may now isolate X in 'IP(x)=5', which would give 6.
-
- The functions in the Solve class are: STEQ, RCEQ, ISOL and ROOT.
-
-
-
- 3.16. Stack
- -----------
-
- Functions found in the Stack class are general functions that are
- used for stack manipulation.
-
- Functions available in the Stack class are: DUP, SWAP, OVER, DUP2,
- DROP2, ROT, ->LIST, ROLL, ROLLD, PICK, DROP, DUPN, DROPN, DEPTH and
- LIST->.
-
-
-
- 3.17. Statistics
- ----------------
-
- Functions found in the Statistics class can be used to compute
- several statistical functions. Statistical data is stored in a
- matrix in the user menu, and is named '(*sigma*)DAT'. Each column
- of the (*sigma*)DAT matrix represents a set of samples. The data
- is usually entered with the (*sigma*)+ function. This function
- accepts real numbers, vectors or matrices as input. A real number
- is entered as a single sample. A vector is entered as related
- coordinate values. And a matrix is entered as several related
- coordinate values. The first sample entered defines the number of
- columns you will have to use in all subsequent entries.
-
- Some functions work on two different columns, and thus require the
- variable (*sigma*)PAR, which is a list of 4 elements, where
-
- 1st and 2nd: columns used by multivariate statistical functions.
- The default is 1 and 2.
-
- 3rd: a
-
- 4th: b
-
- 5th: type of regression: NULF, LINF, EXPF, LOGF or POWF.
-
-
-
- a and b are calculated depending on the type of regression. The
- four curves used are:
-
- linear fit (LINF): y = ax + b
-
- exponential fit (EXPF): y = a e^(bx)
-
- logarithmic fit (LOGF): y = a + b ln x
-
- power fit (POWF): y = a x^b (a > 0)
-
- NULF means that you have not yet executed one of the regression
- functions.
-
-
-
- You can also store an entire data matrix using STO(*sigma*), or
- delete the last sample entered using (*sigma*)-.
-
- For more information on statistics, you should read a good book on
- the subject.
-
- Functions available in the Statistics class are: (*sigma*)+,
- (*sigma*)-, N(*sigma*), CL(*sigma*), STO(*sigma*), RCL(*sigma*),
- TOT, MEAN, SDEV, VAR, MAX(*sigma*), MIN(*sigma*), COL(*sigma*),
- CORR, COV, LINFIT, EXPFIT, LOGFIT, POWFIT, BESTFIT and PREDV.
-
-
-
- 3.18. Store
- -----------
-
- Items found in the Store class are related to the storage of
- objects in memory, providing some facilities and shortcuts. The
- two functions STO and RCL can also be found in the menu under Edit.
-
- Functions available in the Store class are: STO+, STO-, STO*, STO/,
- SNEG and SINV.
-
-
-
- 3.19. Strings
- -------------
-
- A string is a sequence of characters delimited by double quotes
- ("). A string may contain any character. You can edit any string,
- but be careful not to include a double quote within a string,
- because when you return the string to the stack, Solutions tries to
- match double quotes by pair. If you want to add a double quote
- within a string, you must use the instructions 33 CHR +. The
- logical operators (AND, OR, XOR, NOT) can also be applied to
- strings.
-
- Functions available in the String class are: ->STR, STR->, CHR,
- NUM, SUB and SIZE.
-
-
-
- 3.20. Trigonometry
- ------------------
-
- The Trigonometry class contains trigonometric functions, conversion
- functions between degrees and radians and conversion functions
- between hours-minutes-seconds format and real number format.
-
- Functions available in the Trigonometry class are: SIN, ASIN, COS,
- ACOS, TAN, ATAN, R->C, C->R, ARG, ->HMS, HMS->, HMS+, HMS-, D->R
- and R->D.
-
-
-
- HMS format
- ----------
-
- The HMS format is used to represent a unit of time in terms of
- hours, minutes, seconds and fractions of a second or angles in
- degrees, arc minutes, arc seconds and fractions of an arc second.
- The format is h.MMSSs where
-
- h has zero or more digits representing the number of hours.
-
- MM are two digits representing the number of minutes
-
- SS are two digits representing the number of seconds
-
- s is zero or more digits representing the decimal fractional part
- of seconds.
-
-
-
- Here are some examples of numbers in HMS format.
-
- 1 hour, 23 minutes, 45 seconds ==> 1.2345 5
- hours, 3 minutes, 0 second and 34/100 seconds ==> 5.030034 42
- minutes ==> .42
-
-
- There are two functions (->HMS and HMS->) that convert HMS format
- into decimal numbers. For example 30 minutes (.30 in HMS format)
- is converted by HMS-> to .5 .
-