• No results found

The data type of real numbers is the foundation upon which geometry, and the measurement and modelling of physical processes, is built. We will study these in depth later.

3.5.1

Measurements and Real Numbers

In making a measurement there is a ruler, scale or gauge that is based on a chosen unit and a fixed subdivision of the unit, for example: feet and inches, grams and milligram, hours and minutes, etc. Measurements are then approximated up to the nearest sub-unit. The numbers that record such measurements are the rational numbers. For example, 3 minutes 59 seconds is 239/60 seconds.

In ancient Greek mathematics, it was known that certain basic measurements could not be represented exactly by rational numbers. By Pythagoras’ Theorem, the hypotenuse of a right-angled triangle whose other two sides each measure 1 unit has a length of √2 units. (See Figure 3.1.) But √2 is not a rational number and so this hypotenuse cannot be measured

C

A 1 B

1 √

2

Figure 3.1: A right-angled triangle with hypotenuse of length √2.

exactly. An argument demonstrating that √2 is not a rational number appears in Aristotle (Prior Analytics, Book 1 §23). Here is a detailed version:

Theorem √2 is not a rational number.

Proof We use the method ofreductio ad absurdum, or, as it is also known, proof by contradic- tion.

Suppose that √2 was a rational number. This means that there exists some p, q ∈Z, such that q6= 0 and

³p q

´2

= 2. (∗)

By dividing out all the common factors ofpandqwe can assume, without any loss of generality, that pq is a rational number in its lowest form, i.e., there is no integer, other than 1 or 1, that divides bothp and q.

Now simplifying Equation ()

p2 = 2q2. (∗∗)

Thus, we know that p2 is an even number, and this implies that p is an even number. If p is even, then there exists some r >0 such that

3.5. ALGEBRAS OF REAL NUMBERS 71

Substituting in Equation (∗∗), we get

(2r)2 = 2q2 4r2 = 2q2 2r2 =q2.

Thus, q2 is also an even number, and this implies q is an even number.

We have deduced that both p and q are even and divisible by 2. This contradicts the fact that p and q have no common divisor, and the assumption that pand q exist. 2

The real numbers are designed to allow a numerical quantity to be assigned to every point on an infinite line or continuum. Thus, a real number is used to measure and calculate exactly the sizes of any continuous line segments or quantities. There are a number of standard ways of defining the reals, all of which are based on the idea that

real numbers can be approximated to any degree of accuracy by rational numbers.

To define a real number we think of an infinite process of approximation that allows us to find a rational number as close to the exact quantity as desired. As we will see, in Chapter 9, these constructions or implementation methods for the real numbers (such as Cauchy sequences, Dedekind cuts or infinite decimals) can be proved to be equivalent.

The real numbers, like the natural numbers, are one of the truly fundamental data types. But unlike a natural number, a real number is an infinite datum and may not be representable exactly in computations. The approximations to real numbers used in computers must have finite representations or codings. In practice, there are gaps and separations between adjacent pairs of the real numbers that are represented. In fixed-point representations, the separation may be the same between all numbers whereas in floating-point representations the separation may vary and depend on the size of the adjacent values. Calculations with real numbers on a computer must take account of these approximations and unusual properties that they exhibit. We will discuss the nature of real numbers in greater depth in Chapter 9. For the moment we are interested in making algebras of real numbers.

3.5.2

Algebras of Real Numbers

There are many interesting and useful algebraic operations on the set R of real numbers. Consider some of the functions that are associated with the set R of real numbers.

+ : R×RR −:RR .:R×RR −1 :RR:RR | | :RR exp :R×RR log :R×RR sin :RR cos :RR tan :RR

Some simple algebras of real numbers can be obtained by selecting various subsets of func- tions and combining them with R. For example:

(R; 0,1;x+y, x.y,x) (R; 0,1;x+y, x.y,x, x−1) (R; 0,1;x+y, x.y,−x, x−1,x,|x|)

We may add the Booleans and some basic tests to these algebras, for example =: R×RB

<: R×RB

Collecting all these functions, and some famous constants, we may display an algebra thus: algebra Reals carriers R,B constants 0,1, π, e: →R tt,ff : B operations + : R×RR −: RR ×: R×RR −1 : RR exp : R×RR log : R×RR √: RR | |: RR sin : RR cos : RR tan : RR =: R×RB <: R×RB and : B×BB not : BB

Many more functions could be added, of course, but there is much to say about the opera- tions included in the algebra above.

Several are operations which do not return a value on all real number arguments −1,log,,tan;

they are partial functions rather than total functions. So this example is a partial algebra. Division −1 : R R is not defined on the argument x = 0. It can be defined as a total function by defining division on the set

R− {0} of non-zero real numbers:

−1 : (R