Chapter 12. How GrafEq Works

The general GrafEq environment is that relations are entered in algebraic windows, and plotted in view windows. Then relations and views can be prepared for printing in page windows.

GrafEq also has many features of interest to the sophisticated user, including its relation parser, plotting technique, and memory management.

Hint: | Useful and interesting hints and tips relevant to the immediate topic are offered throughout this GrafEq manual. Most chapters are also concluded with general hints and tips for the chapter topic. Hints are observations that often helps understanding; Tips are possible actions that often helps efficiency or effectiveness. They might simply be interesting side notes too.

The Algebraic Relation Parser
GrafEq’s algebraic relation parser understands conventional mathematics notation, which helps make the program intuitive to those familiar with such notation, and encourages students to learn the standard notation. Some characteristics are explained as follows:

- A relation can contain one or more constraints. Each constraint must be a valid relation. The graph of a relation given by multiple constraints is the intersection of the graphs given by the constraints taken individually. This interpretation can be further understood by opening a structural relation window.
- A relation can be an equation, an inequality, a set description, or a conditional or piecewise definition.
- A relation can be explicit or implicit: explicit if one of its variables is isolated on one side of the relation definition, implicit if neither of its variables is isolated.
- Conditional or piecewise descriptions are entered as follows: y<{x if x2+y2>=5, sinx if (-1<x<2p), -5 if x∈{8, 18, 28, 38} }
- Relations may be given using set notation, as follows: a<{b,c}, which is interpreted as the union of a<b and a<c. GrafEq does not use a type-system, so that x={1,2} is the same as x∈{1,2}.
- Relation definitions must be in a valid form: for example; braces, brackets, and parentheses must be properly closed.

Tip: | Older versions of GrafEq perform little symbolic manipulation, and plotting is primarily numeric. Natural pre-processing of expressions such as replacing “x3 - x3” with a simple “0” might enhance efficiency significantly. Starting with version 2.04, GrafEq does simple pre-processing, so that it will recognize (and perform) simple replacements that improve graphing speed without changing the graph of the relation. Rewriting and simplifying relations must be done very carefully! For example, “>=!” should not be re-written as “<” because they are not equivalent in all cases. Figure 12.1 shows the graphs of “y >=! Arccosx” and “y < Arccosx” as plotted by GrafEq; they are not equal because Arccosx is undefined for x>1 and x<-1:
Graph of y >=! Arccosx | Graph of y < Arccosx
Figure 12.1: Graphs plotted by GrafEq shows that “>=!” and “<” are not the same

The Plotting Technique - Successive Refinement
GrafEq’s graphing engine uses a unique plotting technique called successive refinement, which ensures that irregular graphs are plotted correctly. Details are explained as follows:

1. A view region is divided into rectangular sub-regions.
2. Each sub-region is examined:
   - if GrafEq can prove that the sub-region does not contain any solutions that satisfy any of the active relations, the sub-region does not form part of the final graph, and is never looked at again;
   - if GrafEq can prove that all points within the entire sub-region does satisfy an active relation, the entire sub-region forms part of the final graph, and is never looked at again;
   - if the sub-region lies within a single pixel and GrafEq can prove that a point within the sub-region does satisfy an active relation, the sub-region forms part of the final graph, and is never looked at again;
   - if GrafEq cannot prove one of the above three propositions, the sub-region is further examined:
     - if the sub-region cannot be further subdivided
       - because it has become so small that the current number system cannot represent the required numbers, then GrafEq will state that “precision is exhausted”,
       - because it has become too small relative to the size of a pixel, then GrafEq will state that “subdivisions are exhausted”;
     - otherwise, the sub-region will be further subdivided, and each smaller sub-region will be examined just like its predecessor, as explained above.

   Hint: | A graph is drawn using the following rules: pixels that form part of the final graph have the (possibly blended) colours of the relevant relations; pixels that do not form part of the final graph have the colour of the view region’s background; and pixels that are not yet determined have the (possibly blended) colours of the relevant relations, or if the Show Work option, in the information view buddy, is selected, the colour of the work area.

Hint: | GrafEq can correctly plot irregular graphs such as singularities and narrowly spiked curves. Figure 12.2 shows three stages in the plotting of “x(x+1)2+y(y+1)2=0”:
Figure 12.2: GrafEq plotting a relation with a singularity, in successive refinement

Tip: | Graphing can be sped up if relations can be described as inequalities naturally. Inequalities are typically done more efficiently than equations.

Hint: | GrafEq displays a “signature” at point-discontinuities. Consider the relation y=(x-1)(x+1)/(x-1). Its graph can be anticipated to be the line y=x+1 less the point (1,2). However, when the relation is fed to a computer, while graphers using common sampling plotting techniques would likely miss the issue of the point discontinuity altogether, even GrafEq with its robust graphing engine cannot omit any pixels for the point (1,2), because the pixel containing (1,2) also contain many solutions in the real number continuum that satisfy the relation. In such cases, rather than just graphing the solid line y=x+1, GrafEq will often make the anomaly apparent, by displaying a signature at the point-discontinuity, as shown in figure 12.3:
Figure 12.3: Graph with point discontinuity signature at x=1 Starting with version 2.04, GrafEq has an improved graphing engine which may not display discontinuity signatures (older versions may not either; the signature is a side-effect of the graphing process). Future versions will have added features, which will allow users to see undefined portions of a graph.

Tip: | To achieve high precision, the view scope can be enlarged by setting large bounds from the create view dialog box. High precision is useful for printing very thin accurate curves via a high resolution printer. In general, a 600 to 2,450 dpi printer will generate good results with uniform ticks.

Memory and Speed
GrafEq provides a memory monitor to display information on memory usage. When the memory monitor shows that memory resources are becoming inadequate, the following actions might help:

- Quit any screen savers and applications that are opened but currently non-essential.
- Close any windows that are currently non-essential.
- Turn off the “Keep this view after zooming” option in the Zoom View Buddy.
- Turn off graph ticks wherever possible and appropriate.
- Set view windows and view scopes as small as possible.
- Keep the number of active plotting views to a minimum, just one if possible.
- If plotting additional relations in a view window, set other relations to inactive.
- Set all colours or patterns to solid black wherever appropriate.

More memory usage information is also provided in the Information View Buddy, including:

- the memory being used by each view and each relation;
- the time spent exclusively for graphing versus the total time elapsed, because the computer also spends time in re-drawing windows, and monitoring external events such as mouse clicks, key presses.

Actions that relieve memory inadequacy generally help graph plotting speed too, while the following steps mainly enhances the latter.

- preprocess the relation, such as replacing “x2-x*x” with “0”;
- use same colour output instead of black and white patterns;
- use solid black instead of patterns or colours during plotting - patterns and colours can be reset after plotting is completed.

Tip: | Any computationally intensive program will run more efficiently on a fast machine with generous memory resources. For specific information on how a computer system manages memory, refer to documentations for its hardware, operating system and other softwares installed. With respect to GrafEq: If computer time is restricted, such as access to machines is limited to one-hour time slots, GrafEq can still be used effectively to plot complicated graphs at high resolutions. At the end of a session, select halt graphing from the File menu, and save the graph in full format. The full graph can be opened at a later time and graphing can resume from where it left off previously. If disk resources is too scarce for saving a full graph, a graph of interest can usually still be saved in the skeleton format. The skeleton graph can be opened at a later time, although the plotting process must then re-start from scratch.

Further Reading
For more information on how the graphing process works, see:

Jeffrey Allen Tupper. Graphing Equations with Generalized Interval Arithmetic.
M.Sc. Thesis, Department of Computer Science, University of Toronto, January 1996.
http://www.dgp.toronto.edu/people/mooncake/msc.html

Navigation Options |
jump up to the | Table of Contents
go back to | Preferences
review | How GrafEq Works
continue on to | Easy Buttons
send us email