MathGraphics does not run without System Software 6.0 or higher! And it must be copied by a program that supports extended files, e.g. the Finder.
This program can be used to draw graphs of functions of the type f(x) or x(t)/y(t) and to draw paired values from text files. MathGraphics uses the standard IIGS graphical interface.
The computed graphs are QuickDraw pictures which can be imported into DTP programs like AppleWorks GS, manipulated and printed at any resolution. MathGraphics saves the function, the drawing area etc. as a resource together with the drawing.
You can also use a HP-GL compatible plotter to display the function.
This program is SHAREWARE, so everyone can copy and try it. If you like it and want to use it after a two weeks trial period, send $15 (or a roughly corresponding amount in your country's currency) to the address above. You will get the newest version of MathGraphics and you will be able to get updates at a small charge. I also welcome your comments!
Let me know if you have a FPE or NumberCruncher coprocessor card, so I can send you a version of MathGraphics which uses these cards directly and operates much faster.
Updates since version 1.8:
2.0 - parameter functions (x(t), y(t))
- logarithmic drawing area
- finding roots and extremes of functions
- drawing function strings
- dottet lines for grid and function values
- animated cursor (courtesy of Wilfried - Hi, Wilfried!)
- a few of minor changes
2.1 - removed bug concerning e^x
- textcursor
2.2 - every window has its own settings, functions, etc.
- choosable font
- GS/OS╩class 1 calls
- requires System 6.0 or higher
- rearranged menus
- input file for the drawing of paired values has to be a
formatted text file
- MathGraphics uses a new, more complete format for storing
settings in the picture files
2.2.1 - thermometer bar for ROM 03 GS (Showing the drawing process on the
screen caused the picture to disappear partially.)
- addressed inkompatibilities with printer drivers from Vitesse
- first click inside a drawing after loading it from disk gives correct
results now
- 'Print' menu item shortcut is command-P
- Print Record is saved in the preferences file
- loading of documents via the MessageCenter (double-click on a
dokument) works (again)
- clipboard can be shown (with System 6.0.1)
- a few cosmetic changes
Manual
Mouse Handling
Inside the content area of an active window the cursor becomes a cross. If you click on a point inside the active window, an alarm box will be displayed, showing you the function value and the derivatives at this point.
If you hold the mouse button and drag the mouse, a rectangle will be drawn that lets you define an area which will be displayed in a dialog box when you release the mouse button. This dialog gives you the choice to use this area as the drawing area by pressing 'Drawing Area', or to find the function root or an extreme by pressing 'Function Root' or 'Extreme', respectivly. To find a root, the function graph must cut the x-axis inside the area. In order to find an extreme, this must also lay inside the selected area. The program is able to distinguish between a minimum and a maximum. The extreme can then be drawn if you like.
The two buttons 'Function Root' and 'Extreme' are disabled when you use the parameter option (described below).
If you click on a point inside the window while holding down the option key, a dialog appears, which lets you choose between drawing one of the function strings or any text you like at this point.
Apple Menu
About MathGraphics...
This command displays a dialog box with information about MathGraphics (version number, build-in functions etc.).
(Desk Accessories)
Desk Accessories are supported by MathGraphics.
File Menu
New
Open...
Close
Close All
The 'New' command creates a new, empty window. There can be up to four windows open at once.
With 'Open' you can load a document of type $C1 (a QuickDraw picture or an unpacked bitmap) created by MathGraphics or another program. It will be displayed in a new window. A QuickDraw picture is a recording of QuickDraw drawing commands that will be played back when you want to see or print it. It can be resized and uses the maximum resolution of the device it is displayed on. So you get a better looking result when you print it as if it was a bitmap.
Files created by MathGraphics contain information about the function, drawing area and more in the resource fork. If no such information is found, the standard preferences will be used.
The 'Close' command closes the active window, 'Close All' closes all windows (you guessed it!). If you have made any changes to the document you're closeing, you get the chance to change your mind and leave it open, save it or discard the changes.
QuickDraw Picture
Bitmap
You can change the kind of graphic that will be saved with this command. The active option has a check mark in front of its name. 'QuickDraw Picture'╩should be preferred, but the 'Bitmap'╩option is useful for importing MathGraphics drawings into GraphicWriter III v1.0, for example.
Save
Save As...
The 'Save' command puts a copy of the active document on disk. If it hasn't been named already, you have to name it in the Standard File dialog. 'Save As' lets you change the name and path of the document.
The active preferences will be saved in the resource fork. The file is still compatible with all graphic or DTP programs that can load $C1 files, but you will loose this information if you load a file into such a program and save it again under the same name.
Page Setup...
This command displays the page setup dialog of the currently active printer. To alter the active printer you have to use the control panel.
Print...
The 'Print' command prints a copy of the current document according to your specifications. Since QuickDraw pictures are used, MathGraphics can print the graphic at any resolution.
Quit
Quit lets you exit MathGraphics and return to the launching program, e.g. the Finder. The current content of the clipboard will be saved on disk.
Edit Menu
Undo
Cut
Copy
Paste
Clear
If the active window is a MathGraphics window, the commands do the following: 'Undo' reverses the last drawing activity. You can undo all the drawings you made (e.g. overlaying function graphs) until the window is empty. 'Clear' does that all at once. With 'Cut', 'Copy' and 'Paste' you can move the whole graphic into the clipboard and back. The clipboard will be saved if you exit MathGraphics, so you can use its contents in another program.
If the active window belongs to a NDA, the meanings of the Edit menu commands depend on this NDA.
Preferences...
With this dialog you can control the appearance of numbers in dialogs and as labels of the coordinate system. You can choose between float and fixed format (e.g. 1.234e+5 or 25.00) and enter the number of decimal places you like.
If 'Show Drawing Process' is active, you can watch the functions as they are drawn. If it is inactive, a thermometer bar is shown that displays the progress of calculating and drawing. This latter option should be choosen by users with a ROM 03, where pictures seem to disappear partly after the complete drawing otherwise.
Pressing 'Save'╩lets you replace the standard preferences of MathGraphics by the settings of the frontmost window and the current printing options. They are saved at '@:MathGr.prefs', where '@' is the prefix of the folder containing MathGraphics, or if you started it from a server, of the user folder.
Choose Font...
You can change the font of the active window with the standard Choose Font dialog here.
Show Clipboard...
The current content of the clipboard is shown in a window, wether it is text, graphic or sound. This menu item is only active with System 6.0.1.
Graphics Menu
Enter Function(s)...
You can enter function strings with a lenght up to 255 characters. Upper or lower case makes no difference, spaces are allowed. The string can be edited like normal text, and you can cut, copy and paste it with control-x, -c, -v.
The function will be evaluated useing the common mathematical rules (braces first, then * /, then + - etc.). The available functions are listed in the 'About' dialog:
abs(x) - positive value
int(x) - round to nearest integer
frac(x) - remainder of truncate to integer
sqr(x) - square
sqrt(x) - square root
sin(x) - sine
cos(x) - cosine
tan(x) - tangent
arctan(x) - arctangent
exp(x) - base-e or natural exponential
ln(x) - base-e or natural logarithm
sinh(x) - sine hyperbolicus
cosh(x) - cosine hyperbolicus
tanh(x) - tangent hyperbolicus
The arguments for the trigonometric functions and the result of arctan are expressed in radians.
You can use four definable (a, b, c, d) and two predefined constants (pi = 3.14159..., e = 2.71828...). If the program finds an error in the string, it beeps.
The appropriate dialog is choosen automatically, depending on whether f(x) or x(t), y(t) is used. If the 'Paired Values'╩option is active, this command is not available.
Draw...
'Draw...' displays a dialog that depends on the type of function choosen (f(x), x(t)/y(t) or Paired Values).
Drawing of a function:
You can enter the values of the constants you can use in the function string. This is useful if you want to display the influence of a constant in the function by drawing it several times with a different value.
Three radio buttons are provided to choose from displaying the function(s), its (their) first (slope) or second derivative(s). If you draw x(t) and y(t), both functions will be derivated if you choose f'(x) or f''(x).
The 'polar' option lets you draw the function as r(phi), that means x corresponds to the angle and f(x) to the radius. It is deactivated when you use logarithmic scaling or parameter functions.
Choosing a low accuracy gives a quick overview of the function graph, a higher is recommended for best printing results. If you select OK, the graph will be drawn. You can stop it at any time by pressing Open-Apple-period.
Displaying a Data File:
Although MathGraphics is able to draw a lot of trigonometric functions that can be combined to long and complex function terms, you may want to display a graph of a function that is not analytically describable (e.g. solutions of differential equations solved numerically) or other data. You can solve problems with your own programs and let MathGraphics draw it.
MathGraphics suspects a text file with data set of two or more components. You can choose which component of the set contains the
x or the y values.
Maybe you have a solution of a movement equation. You save the time, place, velocity and accelleration of a state in a set with four elements. Then you you can take the time for for the x value and display the other elements against it, display accelleration against velocity or whatever you like. If the values are radius and angle, select Polar Coordinates Transformation in this dialog.
MathGraphics has to know about the number of components. Otherwise it
cannot use the correct step lenght and will draw funny looking pictures.
To select the data file, press the corresponding button and use the Standard File dialog. MathGraphics scans the file for extrem values and suggests a drawing area. This is useful for the first graph you draw. But if you want to compare functions, you should leave the area as it is after the first graph.
A data file has to have the following form:╩First the number of data sets, then the components of the sets, seperated by spaces, colons, tabs or returns. Everything after a '/' in a line will be ignored. MathGraphics uses the 'Number Of Components' setting in the dialog to assign each number to the correct set and component.
Here is an example for such a file:
/ Data for MathGraphics
/
3 / number of data sets
/
0, 100, 20 / time, place, velocity
0.2, 110, 23
0.4, 90, 25
/
/ End
Pascal example (just the important code snippets) for producing a data file:
In this dialog you can enter an x value whose function value will be computed. This value can be included into the drawing. MathGraphics draws lines from this point to the axes.
This menu item is deactivated when you use parameter functions.
Drawing Area...
The drawing area refers to the window boundary. The values you enter take effect for the function and the data file drawing. The seperate values for the drawing interval on the x axis allow for drawing interceptional defined functions. The values must lay inside the drawing area, unless polar or parameter function options are activated. In this case the interval is treated like a angle or 't' interval and can be choosen as desired.
You can accieve equal units for both axes with the buttons '1:1', '2:1' and '1:2'. They compute the upper boundary of the choosen axis according to the other. For the screen and printing with "normal" option one should use the '1:1' button, for printing with 'condensed' option the '2:1' and '1:2' buttons.
Logarithmic scaling is choosen with the radio buttons 'xlog', 'ylog' or 'xylog'. One or both axes will be divided logarithmic (base 10) and the minimum has to be bigger or equal to one.
Axes & Grid...
With this dialog you can specify the coordinate axes or grid you want to draw. The axes can be drawn through the point (0,0) or at the left and bottom boundary of the window (if (0,0) isn't inside the drawing area). The distance between two ticks on the axes is selectable. The ticks can be labeled. If you want more ticks between labeled ticks you can draw the axes a second time with a smaller distance. The distances for the grid lines are entered the same way. You should draw the grid first and in a different color than the axes.
The font can be choosen with the 'Choose Font...' command from the 'Edit' menu. When drawing on the plotter the standard (resident) font of it will be used.
The axes can be drawn with or without arrowheads.
f(x)
x(t), y(t)
Paired Values
You can choose between the given possiblities to describe a function or paired values with these menu items. With 'f(x)' the function value is evaluated depending on the point of the x-axis, with 'x(t), y(t)' both the horizontal and vertical values depend on the parameter t and the functions you choose for them. In this case the values for t are determined by the drawing interval from the drawing area dialog. 'Paired Values'╩switches to the correct dialog to draw data of a text file with the 'Draw...'╩command.
320x100
640x200
These commands let you select the drawing size. The smaller one is good for importing the graphic into a text document, since there is less data to display by the word processor program, and if you scale it to fit for a special purpose after it has been drawn, you'll have to settle with lower quality.
If you switch between the drawing size and the window already contains a
graphic, it will be scaled. Reducing it in size will make most of the (black) lines disappear because the pensize is scaled also.
Color Menu
This menu lets you choose between 16 dithered colors to draw with. The chosen color applies to all the following drawing operations.
Plotter Menu
Activate... / Deactivate
MathGraphics supports HP-GL (Hewlett-Packard Graphic Language) compatible plotters. If the plotter is not being used at the moment, you will see a dialog that allows you to select the slot it is connected to and to activate it. It will get initialised and scaled, and the drawing operations will be performed on screen and plotter simultaniously.
The Deactivate item simply turns drawing on the plotter off.
Commands...
If you select this menu item, a dialog pops up to let you send commands to the plotter. You can use all HP-GL commands, but there is no syntax check. If you use LB to draw a string on the plotter, MathGraphics appends an EOT character automatically. The other commands will be terminated with ';'. This is requested by HP-GL.
The popup menu makes it easy to select a pen for the plotter. Changes in the Color menu have no effect on the plotter pen.
Windows Menu
Clean up
(file names)
This menu is provided to ease the window handling. Clean up puts the windows in a neat order so you can see all title bars, and selecting one of the file names takes you directly to the corresponding window. The active window has a check mark in front of its name.
Double Click on Documents
Besides starting MathGraphics by clicking on the program symbol, you can start it by selecting a PICT or Bitmap file from the Finder and execute the Print or Open commands. You can open up to four files simultaniously. If the files should be printed there is no such limit since MathGraphics closes all files after they have been printed and before it loads the next one.
To use this feature you have to copy the MathGraphics icons to your startup disk and set the pathname to the folder containing MathGraphics. For example, if MathGraphics is in the 'math.programs' folder on your hard disk 'HD', you have to enter
/HD/math.programs/MathGraphics
This can be done with an icon editor (search for 'Edit Attributes' or 'Edit Extended parameters' in the menus). The file type of a MathGraphics document is $C1, the aux type $0000 for a bitmap file (super hires screen) and $0001 for a QuickDraw PICT file. You can also easily view and print files of these types created by other programs with MathGraphics.
Have fun with MathGraphics and tell me what features you'd like to see!