home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-30 | 49.3 KB | 1,516 lines |
-
-
-
-
-
-
-
-
-
- MATHTOOL
-
- AN INTERACTIVE
- MATHEMATICAL TOOL
-
- USER'S GUIDE
- VERSION 2.03
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (C) COPYRIGHT 1990 - ALL RIGHTS RESERVED
- by
- MARTIN J. MAHER
- MJM ENGINEERING
- P.O. BOX 2027
- HAWTHORNE, CA 90251
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TABLE OF CONTENTS
- -----------------
-
-
- 1 INTRODUCTION .............................................. 1
- 1.1 Description ........................................... 1
- 1.2 History ............................................... 1
- 1.3 Interface ............................................. 2
- 1.3.1 Menus ........................................... 2
- 1.3.2 Pick List ....................................... 3
- 1.3.3 Message Windows ................................. 3
- 1.3.4 Query Boxes ..................................... 3
- 1.3.5 Help ............................................ 4
- 2 MENU TREE ................................................. 5
- 3 MAIN MENU ................................................. 6
- 3.1 Files ................................................. 6
- 3.2 Define ................................................ 6
- 3.3 Eval .................................................. 6
- 3.4 differenTiate ......................................... 6
- 3.5 Integrate ............................................. 6
- 3.6 Solve ................................................. 6
- 3.7 Graph ................................................. 6
- 4 FILES MENU ................................................ 7
- 4.1 Load .................................................. 7
- 4.2 Write ................................................. 7
- 4.3 Directory ............................................. 7
- 4.4 Quit .................................................. 7
- 5 DEFINE MENU ............................................... 8
- 5.1 New ................................................... 8
- 5.2 Edit .................................................. 8
- 5.3 Delete ................................................ 8
- 5.4 Clear ................................................. 8
- 6 EVAL MENU ................................................. 9
- 6.1 Single ................................................ 9
- 6.2 Range ................................................. 9
- 7 DIFFERENTIATE ............................................. 10
- 8 INTEGRATE ................................................. 11
- 9 SOLVE ..................................................... 12
- 10 GRAPH MENU ................................................ 13
- 10.1 Single ............................................... 13
- 10.2 Multiple ............................................. 13
- 10.3 Types ................................................ 14
- 10.4 Scaling .............................................. 14
- 10.5 Data File ............................................ 14
- 11 DEFINING A FUNCTION ....................................... 15
- 11.1 Form ................................................. 15
- 11.2 Operators ............................................ 15
- 11.3 Math functions ....................................... 15
- 11.4 Sets of functions .................................... 16
- 11.5 Difficulties ......................................... 16
- 12 EXAMPLES ................................................... 18
- 13 LEGALITIES ................................................. 19
- 14 PRODUCT INFO ............................................... 20
- 15 ORDER FORM ................................................. 22
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1 INTRODUCTION
-
-
- 1.1 Description
-
- MathTool is a program for learning and doing math. Anyone
- studying or using subjects such as algebra, analytic geometry,
- calculus, physics, or engineering will find MathTool to be very
- useful. Using Mathtool you can define functions using normal
- mathematical notation, then investigate them in various ways. It
- is well known that human beings learn best visually. With
- MathTool math becomes visual and this is a great aid to
- understanding.
-
- Using MathTool you can define any well-behaved
- mathematical function of a single variable. (For a detailed
- description of what makes a function well-behaved, see section
- 11.5, Difficulties.) MathTool is designed to be easy to use,
- using menus, context-sensitive help, and clear prompts at
- every step. Once you have defined a function, MathTool gives
- you the following capabilities:
-
- 1) Evaluate the function for any value or set of values of the
- independent variable.
- 2) Numerically integrate the function.
- 3) Evaluate the derivative of the function for a given value of
- the independent variable.
- 4) Find solutions of the function over some range of the
- independent variable.
- 5) Plot one or more functions.
-
- MathTool is written in Turbo Pascal 5.5. MathTool requires
- a minimum of 256k of memory. MathTool will use your math
- coprocessor if you have one. The number of functions you can
- define is limited only by memory. Testing shows that even very
- complicated functions rarely require more than about 50k of
- memory, so you should never have problems with insufficient
- memory. The plotting requires graphics capability. Plots can be
- printed on an IBM graphics printer or compatible. MathTool
- supports all common PC graphics standards - CGA, EGA, VGA, and
- Hercules.
-
-
- 1.2 History
-
- MathTool fills a need that I first perceived several years
- ago. At the time I was a student in engineering school. Often
- when I was reading some text or other, I would come across a
- complicated mathematical function or formula. Normally the
- author of the text would describe the function and some of its
- properties. Sometimes he might include a plot illustrating these
- properties. At this point I usually thought that seeing more
- plots of the function would make things much clearer, and the
- more complicated the function the more I would feel this way.
- This left me with three alternatives: look in other texts in the
- hope that I might find more information; plot it myself by hand,
- a job only a masochist could enjoy; forget about it. Naturally,
- alternative three was my usual choice.
-
- MathTool User's Guide - Page 1
-
-
-
-
-
-
- Eventually, I became the owner of a Compaq Deskpro and a
- copy of Turbo Pascal. I started writing a program that would
- plot any function that I could type in. My purpose, at first,
- was to learn programming in general and Turbo Pascal in
- particular. Then I started adding some other things, like
- integration and derivatives. The idea gradually grew that this
- might make a good shareware program. That eventually led to
- version 1.0 of MathTool. Later, when the program got to version
- 1.11, I renamed it MTool. Now, for version 2.0, I am going
- back to its original name.
-
- MathTool 1.0 was powerful enough that I wished I would
- have had it when I was in engineering school. It certainly would
- have added a fourth and most attractive alternative to the list
- above. In MathTool 2.0 I have taken the basic features of the
- original program and expanded their functionality in numerous
- ways. Before you could only enter one function at a time. Now
- you can have an unlimited number of functions with names of your
- own choosing. Log-log and semi-log plots have been added.
- Perhaps most importantly, the program sports a much improved user
- interface, with context-sensitive help, menus, and file support
- so that complex function definitions can be saved for future use.
-
-
- 1.3 Interface
-
- The MathTool interface should be familiar to anyone with
- even a modest amount of experience with MS-DOS software. The
- primary interface consists of a menu system that uses the
- highly popular moving light-bar menus. Query boxes are used to
- get the answers to questions. A pick list of the currently
- defined functions is available for choosing a function. Pressing
- the <F1> key at any time bring context-sensitive help.
-
-
- 1.3.1 Menus
-
- The highest level of the MathTool interface consists of a
- set of menus. The main menu is horizontal and appears across the
- top of the screen. Secondary menus are vertical and appear as
- appropriate.
-
- All of the menus work in the same basic fashion. When the
- menu appears one of the menu items is highlighted by a light bar.
- This light bar is a different color on color monitors or inverse
- video on monochrome monitors. The user has two methods of making
- a selection. First, he can move the light bar using the arrow
- keys, left and right arrows for horizontal menus, up and down
- arrows for vertical menus. If the light bar is at one of the
- extremes of the menu and he pushes the arrow key that would take
- him beyond that extreme, the light bar moves to the other extreme.
- For example, if the light bar is on the top item on a vertical
- menu and the user presses the up-arrow key, the light bar will
- move to the bottom item on the menu. Once the light bar is on
- the proper menu item, the user can select it by pressing the
- <RETURN> key.
-
-
-
- MathTool User's Guide - Page 2
-
-
-
-
-
-
- The second method is even simpler. Each menu item will have
- one character that is capitalized. Usually, but not always, this
- will be the first character. The user can make his selection
- simply by pressing the key that is capitalized, for example "f"
- for Files or "c" for sCaling.
-
-
- 1.3.2 Pick List
-
- A pick list is a dynamic menu. The pick list in MathTool
- contains a listing of all the currently defined functions.
- Choosing a function from the pick list is done by moving the
- light bar to highlight your choice, then pressing <RETURN>. The
- alternative method of typing a capitalized letter does not work
- for the pick list.
-
-
- 1.3.3 Message Windows
-
- Message Windows are used throughout MathTool to display
- results and messages. A Message Window is a window on the screen
- which may have a frame around it. The frame usually appears as
- either a single or double line. If you have a color monitor, the
- Message Window will appear in a different color than the
- background.
-
- Each Message Window has a specified size. Sometimes the
- message is too long to fit in the window. When this happens you
- will see the word "More" on either the top of the frame, the
- bottom of the frame, or both. This indicates that more of the
- message is available by scrolling up or down. You can scroll the
- Message Window one line at a time using the UpArrow and DownArrow
- keys, or one "screen" at a time using the PgUp and PgDn keys.
- You can jump directly to the top or bottom of the message using
- the Home and End keys.
-
-
- 1.3.4 Query Boxes
-
- A query box is a window that prompts the user for one or
- more replies. An example is the Solve Query Box where the user
- is asked for the function he wishes to solve and for the lower
- and upper bounds of the search range.
-
- A query box presents each query in the form of a prompt
- followed by a blank field. You enter your reply in this field.
- After you have typed your reply you move to the next item in the
- query box by typing <RETURN>. Once you have left a query you
- cannot return to it. You can, however, at any point during the
- query box operation, exit by pressing the <ESC> key. Any entries
- you have made will have no effect.
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 3
-
-
-
-
-
-
- While you are entering a response to a query you can use the
- following editing keys:
-
- Left arrow: Move left one space
- Right arrow: Move right one space
- Home: Move to beginning of entry
- End: Move to end of entry
- Backspace: Delete character left of the cursor
- Escape: Exit
- F1: Help
- F3: Pick List (where supported)
- F10: Restore original string without exiting
- Ctrl-Backspace: Delete entire string
-
-
- 1.3.5 Help
-
- Context sensitive help is available at all times in
- MathTool. Press F1 for help.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 4
-
-
-
-
-
-
- 2. MENU TREE
-
-
-
-
-
- Main Menu
- |
- |
- +---------------------------------------------------------+
- | | | | | | |
- Files Define Evaluate differenTiate Integrate Solve Graph
- Menu Menu Menu Query Query Query Menu
- | | | Box Box Box |
- | | | |
- | | +--- Single eval |
- | | | |
- | | +- Range eval |
- | +---- New Single ---|
- | | |
- | |--- Edit Multiple ---|
- | | |
- | |--- Delete Types---------------------|
- | | Menu |
- | +--- Clear | |
- | |- Linear |
- |--- Load | |
- | |- lOg-log |
- |--- Write | |
- | +- Semilog |
- |--- Directory |
- | sCaling ---------------|
- +--- Quit Menu |
- | |
- |-- Autoscale |
- | |
- +-- User defined |
- |
- |
- data File -----+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 5
-
-
-
-
-
-
-
- 3. MAIN MENU
-
-
- There are seven menu choices on the Main Menu. Some lead to
- other menus and some lead to query boxes. These choices are
- described in the following sections.
-
- 3.1 Files
-
- The Files command on the Main Menu causes the Files Menu to
- be displayed. The Files Menu contains commands for reading and
- writing files, for displaying a directory listing, and for
- quitting the program. The Files Menu is discussed in section 4.
-
- 3.2 Define
-
- The Define selection on the Main Menu causes the Define Menu
- to be displayed. The Define Menu contains commands for defining
- functions, editing existing function definitions, and undefining
- functions. The Define Menu is discussed in section 5.
-
- 3.3 Eval
-
- The Eval command on the Main Menu causes the Eval Menu to be
- displayed. The Eval Menu contains commands for evaluating
- functions either at a single point or over a range of points.
- The Eval Menu is discussed in section 6.
-
- 3.4 differenTiate
-
- The differenTiate selection on the Main Menu causes the
- Differentiate Query Box to appear. This query box asks a set of
- questions related to the numeric differentiation of a function.
- The Differentiate Query Box is discussed in section 7.
-
- 3.5 Integrate
-
- The Integrate command on the Main Menu causes the Integrate
- Query Box to appear. This query box asks a set of questions
- related to the numeric integration of a function. The Integrate
- Query Box is described in section 8.
-
- 3.6 Solve
-
- The Solve selection on the Main Menu causes the Solve Query
- Box to be displayed. This query box contains a set of questions
- related to finding solutions of a function. The Solve Query Box
- is described in section 9.
-
- 3.7 Graph
-
- The Graph selection on the Main Menu causes the Graph Menu to
- be displayed. The Graph Menu contains a set of selections
- related to plotting a function or functions. The Graph Menu is
- described in section 10.
-
-
-
-
- MathTool User's Guide - Page 6
-
-
-
-
-
-
- 4. FILES MENU
-
-
- 4.1 Load
-
- The Load selection allows you to load a file of function
- definitions into MathTool. When you make this choice, the
- program displays the Files Query Box. This query box asks only
- for the name of the file that you wish to load. This file must
- be an ASCII file. It can be created using the Write selection
- from the Files Menu after defining your functions, or by any
- editor which writes ASCII files. You can add comments since
- anything on a line after an exclamation point is a comment.
-
- A directory path before the name of the file is optional.
- If you enter just a filename, the program looks for the file in
- the directory from which you started MathTool. If you wish to
- load a file in a different directory you must include the path.
- The path specifier may be either an absolute path such as
- (C:\MATH\DEF\FILENAME.DAT) or a relative path such as
- (..\DEF\FILENAME.DAT). If the program cannot find the file, it
- issues an error message.
-
-
- 4.2 Write
-
- The Write selection causes MathTool to write all the current
- function definitions to an ASCII file. After you make this
- selection MathTool will display a query box which asks you for
- the name of the file. The default directory is the current
- directory, that is, the directory from which you started
- MathTool. You can write the file to another directory by
- preceding the filename with a path specifier. Once you have
- saved a definitions file you can load it during future MathTool
- sessions.
-
-
- 4.3 Directory
-
- The Directory selection allows you to view a directory
- listing. After you make this selection MathTool displays a query
- box which asks you to enter a mask. This mask can include paths
- and wild cards. The default, chosen by simply pressing <RETURN>,
- is a complete listing of the current directory, the directory
- from which you started MathTool.
-
-
- 4.4 Quit
-
- Choose Quit when you wish to exit from MathTool and return
- to the DOS prompt.
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 7
-
-
-
-
-
-
- 5. DEFINE MENU
-
- 5.1 New
-
- Choose New when you wish to define a new function. After
- you make this choice a Definition Query Box will appear. This
- query box has only one question. The prompt is "Function:".
- You should type in the complete definition of your function, for
- example, f(x) = cos(10*x) - sin(7*x). When you press <RETURN>,
- MathTool will read and parse your definition. You can now use
- MathTool to investigate the function.
-
- If the definition you enter is one that MathTool cannot parse,
- a Correction Window will appear. The Correction Window contains
- a message describing why MathTool could not parse the function
- and a line on which you can edit it. The function as you defined
- it will appear on the line. You can edit using the same editing
- keys described in section 1.3.4 on Query Boxes. As an example
- of how this might work, say you wished to enter the function
- "f(x) = x - 1", but you made a typo and typed "f(x) = x -- 1"
- instead. The correction box would have the message that MathTool
- cannot parse a function that has two operators in a row and ask
- you to edit your function. Once you complete the editing and
- press <RETURN>, MathTool will parse the corrected function.
-
- 5.2 Edit
-
- The Edit selection allows you to change the definition of
- an already defined function. When you make this choice a
- Definition Query Box appears. The first entry in this box
- asks you for the old function. You can specify the function
- by typing its name, f(x), or by typing its complete definition,
- f(x) = x - 1, or by pressing <F3> to use the Pick List.
-
- The second entry asks you for the new function. Type in the
- new definition as described above under New, section 5.1. After
- you complete this step the function will have its new definition.
- This can be very useful when you are trying to determine the effect
- of varying some parameter in a more complicated function. Define
- the parameter as a constant function then use the constant in the
- more complicated function. It is then very easy to change the
- value of the parameter.
-
- 5.3 Delete
-
- This selection allows you to delete a function definition.
- The Definition Query Box, like the one for New, only asks for
- one entry, the function you wish to delete. You can specify
- this function using either its name, f(x), its definition,
- f(x) = x - 1, or by pressing <F3> to use the Pick List.
-
- 5.4 Clear
-
- Choose Clear when you want to delete all of the defined
- functions. After you execute this command you will have an empty
- function list as if you had just started the program.
-
-
-
- MathTool User's Guide - Page 8
-
-
-
-
-
-
- 6. EVAL MENU
-
-
- 6.1 Single
-
- This command allows you to evaluate a function at a single
- point. When you choose this command an Evaluate Query Box
- appears. First it asks you for a function. You can specify the
- function in one of three ways: type its name, type its entire
- definition, or press <F3> to use the Pick List. The second
- question is the value of the independent variable at which you
- wish to evaluate the function. Enter the numerical value. Next
- MathTool will display two windows. The upper window will contain
- the complete definition of the function you chose, including
- subfunctions. If the function definition is so large that the
- window must go into scolling mode, then the second window will not
- appear until after you exit the first window by pressing either
- <ESC> or <RETURN>. The lower window will contain the value of the
- function for the specified value of the independent variable.
-
-
- 6.2 Range
-
- This selection allows you to evaluate a function over some
- range of values. After you choose this command MathTool will
- display an Evaluate Query Box. The first entry asks you to
- specify the function you wish to evaluate. You can do this in
- one of three ways: type its name, type its entire definition, or
- press <F3> to use the Pick List. The second and third entries
- ask for lower and upper bounds of the range over which you wish
- to evaluate the function. The fourth entry asks for the number
- of divisions within the range you wish. An example may make this
- more clear. Say your function was f(x) = x^2, the lower bound 0,
- the upper bound 10, and the number of divisions 10. The program
- will display the following eleven values:
-
- f(0) = 0.0000 f(1) = 1.0000
- f(2) = 4.0000 f(3) = 9.0000
- f(4) = 16.0000 f(5) = 25.0000
- f(6) = 36.0000 f(7) = 49.0000
- f(8) = 64.0000 f(9) = 81.0000
- f(10) = 100.0000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 9
-
-
-
-
-
-
-
- 7. DIFFERENTIATE
-
-
- Choosing the differenTiate Main Menu command allows you to
- numerically evaluate the derivative of a function. After you
- choose this command, MathTool displays the Differentiation Query
- Box. The first entry in this query box asks you to specify which
- function you wish. You can do this in any of the standard three
- ways: type the function's name, type the function's entire
- definition, or press <F3> to use the Pick List. The second entry
- in the query box asks for the value of the independent variable
- at which you wish to evaluate the derivative. Enter a numerical
- value here.
-
- Shortly MathTool will display two windows. The upper window
- will contain a complete definition of your chosen function. The
- lower window will contain the value of the derivative.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 10
-
-
-
-
-
-
-
- 8. INTEGRATE
-
-
- The Main Menu Integrate command allows you to numerically
- evaluate the integral of a function. When you choose this
- command, MathTool displays the Integrate Query Box. The first
- question asks you to identify which function you wish to
- integrate. You can do this in any of the standard three ways:
- type the function's name, type the function's entire definition,
- or press <F3> to use the Pick List. The second and third
- questions ask for the upper and lower limits of the integral.
- The fourth question asks for the number of integration steps to
- use in evaluating the integral.
-
- A warning is in order about this fourth step. MathTool uses
- Simpson's Rule to do numerical integration. Simpson's Rule,
- described in any introductory college calculus text, requires the
- number of divisions of the range of the integral to be even. If
- you enter an odd number, MathTool will issue an error message.
-
- After you finish answering the queries, MathTool again
- displays two windows. The upper window contains the complete
- definition of the function you chose. The lower window contains
- the value of the integral.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 11
-
-
-
-
-
-
-
- 9. SOLVE
-
-
-
-
-
- The Solve command on the Main Menu allows you to find the
- roots of a function. When you choose this command, MathTool
- displays the Solve Query Box. The first entry asks you to
- identify which function you wish to integrate. You can do this
- in any of the standard ways: type the function's name, type the
- function's entire definition, or press <F3> to use the Pick List.
- MathTool uses an algorithm that searches for roots within a range
- of values of the independent variable. The second and third
- entries ask you to define the lower and upper limits of this
- search range.
-
- After you finish the query box, MathTool once again displays
- two windows. The upper window contains the complete definition
- of the function you specified, including subfunctions. Since
- finding roots can take some time, MathTool first displays a
- message that it is working in the lower window. After it has
- finished its search, Mathtool displays the roots it found in the
- lower window. Each root is displayed in the form "f(a) = b"
- where f(x) is the specified function, a is the value of the
- independent variable, and b is the value of the function.
- Usually b will have a value on the order of 1E-8 or less.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 12
-
-
-
-
-
-
-
- 10. GRAPH MENU
-
-
- 10.1 Single
-
- Make this selection from the Graph Menu when you wish to
- plot a function. The Graph Query Box will appear. This query
- box will ask you either four or six questions, depending on the
- type of scaling in effect. First it asks you to specify your
- function. You do this using any of the three standard methods -
- type the function's name, type the function's complete
- definition, or press <F3> to use the Pick List. The second and
- third entries are the lower and upper values of the independent
- variable. The fourth entry is the number of points to be
- evaluated. The number of points you should choose depends on
- several things. More points equals more processing equals more
- time. However, more points also means finer resolution of the
- plot. Generally speaking, the more complicated your function,
- the more points you need to plot. A straight line only needs two
- points to display all the information. Second and third order
- polynomials need fifty to one hundred points. Very complicated
- functions such as complex trigonometric functions will need 200
- or more points. Going above about 600 points will buy you
- nothing, however, since the graphics window only has about 600
- pixels in the horizontal dimension.
-
- If the scaling is AutoScale, then you will be finished with
- the query box after answering these four questions. If it is
- User-Specified, then you will be asked to specify the lower and
- upper bounds for the vertical dimension in the plot window.
-
- Once you've completed the query box the processing for your
- plot begins. While this is happening MathTool displays a message
- telling you that it is working. As soon as it finishes it
- displays the plot. While the plot is displayed you may print it
- by pressing the letter "p", either lower or upper case. I
- developed and tested the printing function using a Star Micronics
- SG-10 dot matrix printer. This printer is an IBM Graphics
- Printer clone, so printing should work on any printer which
- emulates the IBM. After printing finishes you are returned to
- the main menu. Pressing any key other than "p" also returns you
- to the main menu.
-
-
- 10.2 Multiple
-
- Make this selection from the Graphics Menu when you wish to
- plot more than one function on the same graph. After you make
- this choice a series of Graphics Query Boxes will appear. The
- first asks you how many functions you wish to plot. MathTool
- allows as many as five.
-
- The rest of the series consists of one query box for each
- function. Each of these will be identical to the one described
- above in the discussion of the Single menu choice. If the
- scaling mode is user-specified you will be asked to specify the
-
-
- MathTool User's Guide - Page 13
-
-
-
-
-
-
-
- lower and upper bounds of the vertical axis in the first query
- box. You only need to specify these values once so these
- questions will not appear in the later query boxes. After you
- finish each query box, MathTool does the processing for that
- function and then displays the next query box.
-
- When all the processing is done, MathTool displays the plot.
- If you have a color graphics system, each curve will be in a
- different color. The plot header will have the main definition
- for each curve, but subfunction definitions will not be
- displayed. Once again, you can print the plot by pressing "p";
- pressing any other key returns you to the main menu.
-
-
- 10.3 Types
-
- MathTool supports three types of plots: linear, log-log,
- and semilog. You use this menu to determine what type of plot
- MathTool will use. After you make your choice, MathTool returns
- you to the Graph Menu.
-
-
- 10.4 Scaling
-
- MathTool supports two kinds of scaling, AutoScale and User-
- Specified. In autoscaling mode, MathTool finds the maximum and
- minimum values of your function over the range to be plotted.
- These two values then become the maximum and minimum values on
- the vertical axis and thus determine the vertical scaling. In
- user-specified mode, you directly control the scaling of the
- vertical axis by specifying the maximum and minimum values.
-
-
- 10.5 Data File
-
- Choose the data File selection on the Graphics menu when you
- wish to plot the contents of a data file. The sample file
- data.dat included on the MathTool distribution disk shows the
- format a MathTool data file must have. Comments can be included
- on any line after an exclamation point. Data must be tab
- delimited. The program reads the file and plots the data. Only
- linear plots are available in this mode and no header will be
- displayed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 14
-
-
-
-
-
-
-
- 11. DEFINING A FUNCTION
-
-
- 11.1 Form
-
- MathTool allows you to define virtually any function of a
- single variable. The independent variable and the function name
- can each be as long as ten characters each. So you can have a
- function like
-
- "f(x) = cos(x)"
-
- or one like
-
- "pressure(depth) = AtmPressure + rho*g*depth".
-
- This function gives the pressure in a liquid, where AtmPressure
- is the atmospheric pressure, rho is the liquid's density, g is
- the gravitational acceleration, and depth is the depth below the
- surface. It is defined in the file Pressure.dat on the MathTool
- distribution disk.
-
- Two warnings are necessary. First, if you define a function
- or a variable whose name is longer than ten characters, MathTool
- is guaranteed to act erratically. Second, MathTool will become
- very confused if you define two functions with the same name.
- For a detailed discussion of potential traps and pitfalls in
- function definition, see Difficulties, section 11.5.
-
-
- 11.2 Operators
-
- The following operators can be used in MathTool function
- definitions.
-
- OPERATION OPERATOR EXAMPLE
-
- Addition + 2 + 2 = 4
- Subtraction - 3 - 2 = 1
- Multiplication * 3 * 2 = 6
- Division / 4 / 2 = 2
- Power ^ 2 ^ 3 = 8
-
-
-
- 11.3 Math functions
-
- MathTool provides an extensive library of mathematical
- functions that you can use in your functions. These are
- listed below with their syntax.
-
- FUNCTION EXAMPLE
-
- Absolute value abs(x)
- Exponential exp(x)
- Cosine cos(x)
- Sine sin(x)
-
- MathTool User's Guide - Page 15
-
-
-
-
-
-
-
- Tangent tan(x)
- Inverse cosine acos(x)
- Inverse sine asin(x)
- Inverse tangent atan(x)
- Factorial fac(x)
- Hyperbolic sine sinh(x)
- Hyperbolic cosine cosh(x)
- Hyperbolic tangent tanh(x)
- Inverse hyperbolic sine asinh(x)
- Inverse hyperbolic cosine acosh(x)
- Inverse hyperbolic tangent atanh(x)
- Logarithm, base 10 log(x)
- Natural logarithm ln(x)
-
- Please note that all angles are in radians.
-
-
- 11.4 Sets of functions
-
- One of the strengths of MathTool is that you define
- interrelated sets of functions. A good example of this is
- provided in the file Sqwave.dat on the distribution disk. This
- file contains a Fourier series approximation of a square wave.
- You can see this very clearly if you load the file and plot it
- over the range -5 to 5 with 200 points. This example shows
- how you can build very complicated functions in a piecewise
- fashion.
-
-
- 11.5 Difficulties
-
- In the introduction I mentioned that MathTool can handle
- virtually any well-behaved function of a single variable. A
- definition of what constitutes a well-behaved function for
- MathTool is difficult, although certainly any function that fits
- the calculus definition of a continuous function would qualify as
- well-behaved.
-
- Functions that are not continuous can cause problems.
- Generally speaking, there are three ways that a function can fail
- to be continuous. All three can potentially cause problems for
- MathTool, especially in the graphics area.
-
- First, it may happen that a function does not exist at some
- point. One example might be a rational function at a point where
- the denominator becomes zero. If MathTool attempts to evaluate
- the function at this point, it will issue an error message.
- However, you may ask for a plot of this function over a range
- that includes such a point but, because of your choice of
- end points and number of divisions, MathTool will not attempt
- to evaluate the function at that point. A plot will appear, but
- the fact that the function does not exist at some point will not
- be apparent. You would only become aware of this discontinuity
- if MathTool tried to evaluate the function at the actual point
- of discontinuity and issued a division by zero error message.
-
-
-
- MathTool User's Guide - Page 16
-
-
-
-
-
-
-
- As an aside, you may at some point wish to investigate a
- function that has one or more discontinuities. The discussion
- above points out a strategy you can use with these types of
- functions. Just be sure to define your endpoints and number of
- subdivisions so as to avoid the discontinuity.
-
- Second, consider the function
-
- f(x) = sin(x)/x , x <> 0
- f(x) = 0, x = 0
- Note: The symbol "<>" is notation for inequality.
-
- Discontinuous functions of this nature cannot be defined in
- MathTool. Only one of the two parts, say the first, could be
- defined. Then f(x) = sin(x)/x becomes the type of function
- discussed above - it has a discontinuity at x = 0. To see how
- this can cause problems, run MathTool and define f(x) = sin(x)/x.
- Try to evaluate it first at x = 0.0 and then at x = 1.0e-8. When
- x = 0 you hit the discontinuity and MathTool gives you the wrong
- answer. When x = 1.0e-8, no problems. For a graphic
- demonstration of this problem, plot this function from -30 to
- 30 twice - the first time with 200 points, the second time with
- 201 points.
-
- Third, and most troublesome to MathTool, are functions that
- are not defined at some point, but do have limits that vary
- depending on the direction of approach to the point. An example
- of this type of function is tan(x). As x approaches pi/2 from
- below, tan(x) goes to infinity. As x approaches pi/2 from above,
- tan(x) goes to negative infinity. If you plot tan(x) from x = 1
- to x = 2, you will see a nearly vertical line at x = pi/2
- because MathTool connects the points on either side of pi/2.
-
- The upshot of all this is, if you are dealing with non-
- continuous functions, be careful. If you get plots that seem
- strange, check your function to see if it is one of these types.
-
- Some other potential problems bear mentioning as well. When
- you are plotting functions in log-log or semilog modes, you
- should make sure to avoid zero or negative numbers since their
- logarithms are undefined. If you define a function or formula
- that represents a physical relationship such as the formula in
- Pressure.dat, you should be careful to use consistent units.
- This is entirely up to you because MathTool knows nothing about
- units.
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 17
-
-
-
-
-
-
-
- 12. EXAMPLES
-
-
- MathTool comes with several files that contain sets of
- functions ranging from very simple to very complicated. Each
- file is described below.
-
- Abc.dat contains a simple straight line and illustrates how
- to define and use constant functions.
-
- Cosines.dat contains one of my favorite test functions. I
- used this file extensively while I was developing MathTool to
- check out the graphics and solving capabilities. This file shows
- how to build a complicated function from simpler functions. If
- you want to duplicate one of my tests, try solving
-
- f(x) = cos(8*x) + cos(9*x)
-
- over the range 0.0 to 4.0. See how long it takes MathTool to
- find the eleven(!) roots in this range.
-
- Poly.dat contains a set of arbitrary polynomials. This
- example also shows how to build very complex functions from
- simpler ones.
-
- Exp.dat contains two main functions. The function f(x) is
- the Taylor series approximation for exp(x). This Taylor series
- can be made to approximate exp(x) to any degree of closeness by
- adding more terms to the series. The second function, g(x), is
- the difference between the Taylor series approximation and the
- actual exponential. Playing around with functions like this will
- quickly give you a good idea of how useful a learning tool
- MathTool can be.
-
- Pressure.dat contains the formula for determining the
- pressure in a liquid at some distance below the surface,
- where rho is the density of the liquid, AtmPress is the
- atmospheric pressure at the surface, g is the acceleration of
- gravity, and depth is the distance.
-
- Data.dat contains a sample data file that can be plotted
- using the "data File" option on the Graphics Menu. This file
- shows how a data file needs to be formatted for MathTool to read
- it.
-
- Sqwave.dat is the most ambitious of the examples included
- with MathTool. This example is the Fourier Series approximation
- of a square wave. Fourier was a nineteenth century French
- mathematician. He proved that any periodic function can be
- expressed as the sum of an infinite series of sinusoidal
- functions. The square wave approximation demonstrates this very
- clearly. This is another great example of how useful MathTool
- can be for a student - it's very illuminating to add terms to the
- series one by one and see how quickly the series starts to
- approximate a square wave.
-
-
-
- MathTool User's Guide - Page 18
-
-
-
-
-
-
-
- 13. LEGALITIES
-
-
- MathTool is shareware, also known as user-supported software.
- The diskette with the program and the user's guide can be freely
- copied and shared. The idea of shareware is that if the user finds
- the program worthwhile then he can, at his own discretion, support
- the author by sending him a contribution.
-
- MathTool is NOT a public domain program. It is copyright
- (c) 1990 by Martin J. Maher, and the author reserves all rights.
- In particular, he reserves the right to distribute MathTool,
- associated libraries, and all source code and documentation for
- profit. There is no guarantee that MathTool will work correctly
- in all situations, and in no event will the author be liable for
- any damages arising from the use or misuse of MathTool.
-
- User groups, bulletin boards, clubs, and shareware distributors
- are authorized to distribute MathTool under the following conditions:
-
- 1. No charge is made for the software or the documentation.
- A nominal fee may be charged to cover copying and
- distribution costs.
-
- 2. Recipients are to be notified of the shareware concept
- and should be encouraged to support it.
-
- 3. The program and documentation are not to be modified in
- any way.
-
- 4. The source code for MathTool is available for purchase
- by registered users. They may alter it for their own
- use but may not distribute it for profit.
-
-
- Turbo Pascal is a trademark of Borland International, Inc.
- Compaq and Compaq Deskpro are trademarks of Compaq Computer Corp.
- MS-DOS is a trademark of Microsoft, Inc. IBM, PC-DOS, CGA, EGA, and
- VGA are trademarks of International Business Machines, Inc. Hercules
- is a trademark of Hercules Computer Technologies, Inc.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 19
-
-
-
-
-
-
-
- 14. PRODUCT INFO
-
-
- As stated above in the Legalities section, MathTool is
- shareware. I hope that you find MathTool to be a useful and
- even enjoyable piece of software. If you do, I hope that you will
- register your copy. I've devoted a lot of time and effort
- to developing MathTool, and, quite frankly, I would like to get
- paid. Ok, fair enough, you say, but what's in it for me? When
- you register you will receive the latest version of MathTool, if it
- is different than the version you register. When future upgrades
- are released they will be available to you at reduced prices. My
- policy with version two has been to offer a free upgrade to every
- registered user of version one. While I cannot promise that this
- policy will apply in the future, I can promise that your savings
- will be considerable. Finally, a modest amount of technical
- support is available for registered users. I can be reached either
- by U.S. mail or on CompuServe as 72040,2404. I will try to answer
- your questions or help if you have problems.
-
- There's one other thing I would like you to do if you like
- this program - make copies and give them to your friends and
- associates. Not only are you allowed to do this with shareware,
- but I encourage you strongly to do it with mine.
-
- Other products will soon be available from MJM Engineering.
- MathTool incorporates the object-oriented programming technology
- introduced by Borland International in version 5.5 of Turbo
- Pascal. Most of the functionality in MathTool is based on
- objects contained in two extensive libraries, and these two
- libraries will soon be available either in object form, actually TPU
- files, or source-code form. Both will come with programmer's guides
- and example source code. Both libraries should be available in
- early 1991. All MathTool registered users will be informed of
- their release and, as another benefit of registration, will be
- able to purchase the libraries for reduced fees.
-
- Finally, all the source code for MathTool is available.
- This option includes complete source code for the entire program,
- including source code for both libraries and both programming
- guides when they become available.
-
- A handy order form with prices is included on the next page.
- One note - if you register MathTool without using the order form,
- please include a note telling me the version number of your copy
- of the program. This will help me determine if I need to send
- you an updated version.
-
-
-
-
-
-
-
-
-
-
-
- MathTool User's Guide - Page 20
-
-
-
-
-
-
-
- 15. ORDER FORM
-
-
- Name_________________________________________________________
-
- Address______________________________________________________
-
- City/State/Zip_______________________________________________
-
-
- Item Price Quantity Subtotal
-
- MathTool registration 20.00 ___ ______
- Version 2.03
-
- Interface object library* 20.00 ___ ______
- with source 40.00 ___ ______
-
- Function object library* 20.00 ___ ______
- with source 40.00 ___ ______
- Note: requires interface library
-
- Both libraries* 35.00 ___ ______
- with source 70.00 ___ ______
-
- MathTool registration with
- complete source code for
- MathTool and both libraries 80.00 ___ ______
-
- TOTAL ______
-
- * Libraries available first quarter 1991.
-
- Shipping and handling and any applicable sales taxes are
- included in the these prices. If you are ordering from outside
- the United States, please send your funds as a money order
- drawn in U.S. dollars. Thank you for your support.
-
- Mail to:
-
- Martin J. Maher
- MJM Engineering
- P.O. Box 2027
- Hawthorne, CA. 90251
-
- How did you learn about MathTool, how did you get your copy?
-
- ________________________________________________________________
-
- ________________________________________________________________
-
-
- Comments or suggestions
-
- _______________________________________________________________
-
- _______________________________________________________________
-
-
- MathTool User's Guide - Page 21
-