19.07.2014 Views

Contents - Student subdomain for University of Bath

Contents - Student subdomain for University of Bath

Contents - Student subdomain for University of Bath

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

14 CHAPTER 1. INTRODUCTION<br />

Definition 1 A number n, or more generally any algebraic object, is said to be<br />

transcendental over a ring R if there is no non-zero polynomial p with coefficients<br />

in R such that p(n) = 0.<br />

With this definition, we can say that e π√ 163 is transcendental over the integers.<br />

We will see throughout this book (<strong>for</strong> an early example, see page 47) that<br />

innocent-seeming problems can give rise to numbers far greater than one would<br />

expect. Hence there is a requirement to deal with numbers larger, or to greater<br />

precision, than is provided by the hardware manufacturers whose chips underlie<br />

our computers. Practically every computer algebra system, there<strong>for</strong>e, has<br />

a package <strong>for</strong> manipulating arbitrary-sized integers (so-called bignums) or real<br />

numbers (bigfloats). These arbitrary-sized objects, and the fact that mathematical<br />

objects in general are unpredictably sized, means that computer algebra<br />

systems generally need sophistucated memory management, generally garbage<br />

collection (see [JHM11] <strong>for</strong> a general discussion <strong>of</strong> this topic).<br />

But the fact that the systems can deal with large numbers does not mean<br />

that we should let numbers increase without doing anything. If we have two<br />

numbers with n digits, adding them requires a time proportional to n, or in<br />

more <strong>for</strong>mal language (see section 1.4) a time O(n). Multiplying them 4 requires<br />

a time O(n 2 ). Calculating a g.c.d., which is fundamental in the calculation <strong>of</strong><br />

rational numbers, requires O(n 3 ), or O(n 2 ) with a bit <strong>of</strong> care 5 . This implies that<br />

if the numbers become 10 times longer, the time is multiplied by 10, or by 100,<br />

or by 1000. So it is always worth reducing the size <strong>of</strong> these integers. We will<br />

see later (an early example is on page 113) that much ingenuity has been wellspent<br />

in devising algorithms to compute “obvious” quantities by “non-obvious”<br />

ways which avoid, or reduce, the use <strong>of</strong> large numbers. The phrase intermediate<br />

expression swell is used to denote the phenomenon where intermediate quantites<br />

are much larger than the input to, or outputs from, a calculation.<br />

Notation 1 We write algorithms in an Algol-like notation, with the Rutishauser<br />

symbol := to indicate assignment, and = (as opposed to C’s ==) to indicate the<br />

equality predicate. We use indentation to indicate grouping 6 , rather than clutter<br />

the text with begin . . . end. Comments are introduced by the # character,<br />

running to the end <strong>of</strong> the line.<br />

4 In principle, O(n log n log log n) is enough [AHU74, Chapter 8], but no computer algebra<br />

system routinely uses this, <strong>for</strong> it is more like 20n log n log log n. However, most systems will<br />

use ‘Karatsuba arithmetic’ (see [KO63, and section B.3]), which takes O(n log 2 3 ≈ n 1.585 ),<br />

once the numbers reach an appropriate length, <strong>of</strong>ten 16 words [SGV94].<br />

5 In principle, O(n log 2 n log log n) [AHU74, Chapter 8], but again no system uses it routinely,<br />

but this combined with Karatsuba gives O(n log 2 3 log n) (section B.3.6), and this is<br />

commonly used.<br />

6 An idea which was tried in Axiom [JS92], but which turns out to be better in books than<br />

in real life.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!