There’s no excuse for any authors to be satisfied with less than perfection in their diagrams – for simple diagrams at least. Software, both commercial and open-source, can now produce diagrams of extraordinarily high quality. But I keep coming across published books where the excellence of the exposition is let down by the poor quality of the diagrams. In one book (which I will not name), a graph claiming to be a sine curve seemed to be made up of half ellipses. As a pretty figure it was quite attractive, but as a “sine curve” it was atrocious. Since when did a sine curve allow a vertical tangent?

Lately I’ve been reading some books and articles about elliptic curves and their application to public-key cryptography. And again, some books, excellent in every other way, get sloppy with their diagrams. I have one book where the numbers and labels on the figures are in such a big ugly font as to ruin the graphs, and in another book one of the figures, purporting to be of an elliptic curve , is not even symmetrical about the -axis.

One of the best graph drawing software (for 2-dimensional graphs, although there are extensions to 3-dimensions) is the PStricks package of . This allows for plotting, of the placement of all sorts of curves, lines, arrows, and text on a figure, all nicely integrated into the environment. Now, elliptic curves, being defined implicitly, are not particularly well suited to being plotted as graphs of the form . But implicit plotting, as provided by every mathematical software I know, is clumsy and memory intensive. Generally implicit plotting of, say, works by creating the three dimensional structure , and then plotting the plane .

However, an elliptic curve can be easily plotted by considering the intervals for which is positive, and graphing and . Using PStricks, I produced the following diagram illustrating addition on an elliptic curve:

This diagram was created with the following code:

\begin{pspicture}(-2,3)(4,4) \psline(-2,0)(4,0) \psline(.5,-3)(.5,3) \psplot[linecolor=blue,linewidth=2pt]{-1.4142}{0}% {x dup mul 2 sub x mul sqrt} \psplot[linecolor=blue,linewidth=2pt]{1.41422}{2.4}% {x dup mul 2 sub x mul sqrt} \psplot[linecolor=blue,linewidth=2pt]{-1.4142}{0}% {x dup mul 2 sub x mul sqrt neg} \psplot[linecolor=blue,linewidth=2pt]{1.41422}{2.4}% {x dup mul 2 sub x mul sqrt neg} \psline[linecolor=red,linestyle=dashed,linewidth=2pt](-1,-1)(2,2) \psline[linecolor=red,linestyle=dashed,linewidth=2pt](2,2)(2,-2) \qdisk(-1,-1){1mm} \qdisk(0,0){1mm} \qdisk(2,2){1mm} \qdisk(2,-2){1mm} \rput(-1,-1.2){\large $P$} \rput(.2,-.2){\large $Q$} \rput[l](2.2,-2){\large $R=P+Q$} \end{pspicture}

I cheated slightly here: the elliptic curve used was which has the nice property that on the curve ; that is, all the coordinates are integers. The plot shown simply shifts the -axis a bit. The problem is learning PStricks, and for plotting, as you see, learning some PostScript, which uses a stack system. Thus

x dup mul 2 sub x mul sqrt

has the following meaning:

- Take a value x.
- Duplicate it
- Multiply the last two values
- Subtract 2 from the result
- Multiply by x
- Take the square root

At the cost of a little work, superb diagrams can be produced.

Read about PostScript mathematics at http://www.ugrad.math.ubc.ca/Flat/math-ref.html and about pstricks at http://tug.org/PSTricks/

Filed under: Maths teaching, Software | 2 Comments »