5

Chapter 5

Basic Data Types


If you lose the spirit of repetition, your practice will become quite difficult

—Shunryu Suzuki, Zen Mind, Beginner’s Mind
Zen Mind, Beginners Mind

Figures

Maxima for three sizes of integers
Figure 1.
Complex math
Figure 2.
Better complex math
Figure 3.
More complex math
Figure 4.

Example Programs

There is one example program for chapter 5: download chapter5.zip.

To determine your floating-point hardware’s performance on Windows machines, download machar.zip.  (The archive contains the source file in C.)

Download a program to print out pi (courtesy of Jaap Spies, j.spies@hccnet.nl), pipoem.zip. There are lots of others floating around, but this one is particularly nice.

Exercises

Find out how to measure the speed of light yourself using chocolate and a microwave oven  http://www.ph.unimelb.edu.au/~mbailes/P140/lecture22/index.htm.

Read what Duncan Steel has to say about the use of Julian Calendar years in astronomical measurement at  steel.html. Buy his book:

Marking Time

Visit Simon Cassidy’s Web site at  http://www.hermetic.ch/cal_stud/cassidy/.

For some introductory material on imaginary, complex, rational and irrational numbers, see http://www.math.toronto.edu/mathnet/answers/imaginary.html, and related topics on the same site.

For more advanced material on complex numbers, read Paul J. Nahin’s delightful book, An Imaginary Tale.

An Imaginary Tale

For a discussion of Mayan calendrical math, see http://www.foretec.com/python/workshops/1998-11/proceedings.html, which, among other things, discusses negative numbers and the Mayans’ view of them.

For a discussion of positional number systems, such as the base 32768 system used to implement Python’s long integers, take a look at Donald Knuth’s The Art of Computer Programming, Volume 2, Seminumerical Algorithms.

Art of Computer Programming, Volume 2

In an earlier chapter, I described a number of floating-point “gotchas,” things you need to watch out for, especially when dividing floating-point numbers.  It would probably be useful to review the gotchas; see Hour 3, “Basic Arithmetic with Python.”


Valid HTML 4.01 Transitional