# Sketchpad’s Internal Mathematics

Navigation: Appendix > Advanced Topics > # Sketchpad’s Internal Mathematics |

Sketchpad’s internal mathematics determine how the program computes and represents numbers, geometric figures, functions, and other mathematical quantities. This in turn determines how these objects appear graphically, numerically, or symbolically.

At the numeric level, Sketchpad represents point coordinates and other quantities using 64-bit floating-point arithmetic. This standard representation for scientific computation allows your computer to represent a value with 14 to 16 significant digits of decimal precision over a wide range of magnitudes (roughly, as large as ±10300 and as small as ±10–300). While this is very precise, it is not exact in a mathematical sense. (For example, π cannot be represented exactly with only 15 significant digits.) Sketchpad uses tuned algorithms to attempt to represent numbers as close to their exact value as possible, and to minimize the inevitable error introduced by calculating with only a finite number of significant digits. Nonetheless, you may witness numerical error effects in the least significant digits of numbers in sketches involving a lot of internal calculation. Regrettably, no computer or computer program can represent every number exactly: there are an infinite number of numbers, of course, and — at least today! — computers have only a finite amount of memory. Thus, while Sketchpad’s numeric calculations are generally reliable and can serve as the basis of a convincing argument or conjecture, a Sketchpad result should never be mistaken for constituting a mathematical proof.

Don’t confuse the displayed precision of a value with its internal precision or accuracy. When you display a value (such as a measurement), it appears only to the number of decimal places you choose in the Preferences or Properties dialog box. Internally, that number is represented to much greater precision, as described here.

At the graphical level, Sketchpad transforms its internal numeric representations into the shapes and positions that appear in your sketch window. For objects such as circles, points, and segments, the resulting images are as accurate as can be displayed on your computer screen. (When you print to a printer with higher resolution than your screen, you’ll see the images are even more accurate than their on-screen representations.)

However, for plotted functions and loci, Sketchpad displays only a visual approximation of the curve’s ideal mathematical shape. Primarily to maintain responsiveness when you’re dragging objects, Sketchpad employs the same technique to plot these objects as a person might use if plotting them by hand: it evaluates the ideal curve at a number of different positions (called samples), then plots the curve by interpolating between these known samples. The samples themselves are very accurate, but the interpolations may or may not be, depending on the ideal shape of the mathematical object. In the Properties dialog box for loci and functions, the Plot panel gives you control over how many samples Sketchpad uses to plot a function or a locus, as well as whether it displays that plot only as the (discrete) collection of accurate samples or by including the (continuous) interpolations between samples. If you consistently prefer a higher number of samples than Sketchpad uses by default, you can increase the default on the Sampling Preferences panel. Also, while Sketchpad uses approximate interpolations for display purposes, it never relies on them for mathematical purposes. Thus, if you construct a point on a function plot or on a locus (or use the Calculator to evaluate a function at given values), that point’s coordinates (or function’s values) are always based on the exact curve or function and not on its visual approximation.

Finally, at the symbolic level, Sketchpad performs simple computer algebra to differentiate functions when you use the Number | Define Derivative Function command. While these computed derivatives are generally reliable for graphing and evaluation purposes, they may not be exact. In particular, when differentiating intricate functions, Sketchpad may fail to simplify the result fully, introducing point discontinuities in the derivative; and Sketchpad does not compute domain restrictions on the derivative function. Use Define Derivative Function to compute the slope of a function at an arbitrary point for graphing purposes or for mathematical constructions, but be sure to verify the result before using it as the basis of a mathematical proof.