Table of Contents: Preface
1 A first look at Delphi, pp. 1-7
1.1 Introduction
1.2 Linear Search
1.3 Steps
1.4 Simple text .le input
1.5 Exercises
2 CrossNumber, pp. 9-18
2.1 Description of the problem
2.2 Directions for the game
2.3 Preliminary discussion
2.4 Rank of coe˘ cient matrix
2.5 Excel model for CrossNumber
2.5.1 Some naive pseudocode
2.6 Integer programming
2.7 Development of the algorithm
2.8 Development of user interface (UI)
2.9 Delphi code and UI
2.10 Tomography
2.11 Exercises
3 Two word games, pp. 19-27
3.1 Bags
3.2 Bag unit
3.3 Word game
3.3.1 Outline of solution algorithm
3.3.2 Delphi solution
3.4 Jumble word game
3.5 Outline of solution
3.5.1 Delphi code and solution output
3.5.2 Conclusion and sumary
3.6 Exercises
4 Ramanujan numbers, pp. 29-40
4.1 Srinivasa Ramanujan
4.2 Our problem
4.2.1 Brief analysis of problem
4.3 Solution approaches
4.3.1 1st solution. unsorted array symbol table
4.3.2 2nd solution. binary tree symbol table
4.3.3 3rd solution. hash table symbol table
4.3.4 Code for tree and hashtable methods
4.4 Some brief performance comparisons
4.4.1 Build times
4.4.2 Traversal (dump) times
4.5 Conclusion and summary
4.5.1 Extension of the program to output the (x; y) values
4.6 Exercises
5 How large is a factorial? , pp. 41-47
5.1 Delphi functions to compute n!
5.2 Recursion vs iteration
5.3 Asymptotic estimation of n!
5.4 Delphi code to compare n! with S (n)
5.5 How many zeroes are on the end of n!?
5.6 Algorithm
5.7 Delphi code for z(n)
5.8 Exercises
6 Aspects of Keno modelling, pp. 49-59
6.1 What is Keno?
6.2 Keno probabilities
6.3 Approaches to computation of p(k; r)
6.3.1 Method 1: direct from de.nition; using iteration for the factorials
6.3.2 Method 2: using recursion for the factorials
6.3.3 Method 3: using recurrence relations, implemented iteratively, using array
6.3.4 Method 4: using logarithms
6.4 Keno bonus (multiplier)
6.4.1 Subset sum problem
6.4.2 Recurrence for Fk q (x)
6.4.3 Delphi program for the number of ways of obtaining sum s on any Keno draw, where 210 _ s _ 1410
6.4.4 Delphi code for the subset sum problem
6.5 Exercises
7 Finite state automata, pp. 61-74
7.1 Introduction
7.2 State diagram
7.3 States
7.3.1 Start state
7.3.2 Accept states
7.3.3 Example: A Simple FSA for identifiers
7.4 The transition table
7.5 Extended transition table
7.6 A Roman numeral recognizer
7.7 Example: A basic Roman numeral recognizer
7.8 Languages
7.8.1 EBNF example
7.9 FSA to recognize Delphi identifiers
7.10 A formal procedure for constructing automata
7.11 An informal heuristic to build an FSA
7.11.1 Checks
7.11.2 Example of method in action
7.12 Implementing FSA in Delphi
7.13 Summary
7.14 Exercises
8 Computing sequences and series by recurrence, pp. 75-94
8.1 Background
8.2 Computation of _
8.2.1 The Wallis product
8.2.2 Machin-like sums of arctangents
8.2.3 Ramanujan.s sum
8.3 Bernoulli numbers
8.3.1 Mutual recursion
8.4 Catalan numbers
8.4.1 Applications of Catalan numbers
8.4.2 Direct formula for Catalan numbers
8.4.3 Asymptotics
8.4.4 Delphi code to compute Catalan numbers
8.5 Exercises
9 Simultaneous linear algebraic equations, pp. 95-122
9.1 Linear models
9.1.1 Direct methods
9.1.2 Indirect methods
9.1.3 Matrices & vectors
9.1.4 Augmented matrix
9.1.5 Elementary row operations
9.2 Gauss-Jordan elimination
9.2.1 Elementary row operations
9.2.2 Partial description of Gauss-Jordan procedure
9.2.3 Further steps of Gauss-Jordan
9.2.4 Numerical solution of Ax = b
9.2.5 Implementation issues
9.2.6 Delphi routines for LU factorization and back-substitution
9.2.7 Gauss-Seidel iteration
9.2.8 Delphi routines for Gauss-Seidel iteration
9.3 Exercises
10 Arithmetic expression parsing, pp. 123-137
10.1 Assignment statements
10.2 Arithmetic expressions
10.3 Language translators
10.4 Syntax errors
10.4.1 Semantic errors
10.4.2 Languages, BNF and EBNF
10.4.3 Grammars
10.4.4 BNF
10.4.5 EBNF
10.5 Top-down recursive descent parsing of AEs
10.6 Design of our parser
10.6.1 AE grammar
10.7 Delphi code
10.8 Exercises
11 Number theory & encryption, pp. 139-160
11.1 Modular arithmetic
11.1.1 Congruences
11.1.2 Multiplication tables
11.1.3 Inverse modulo m
11.1.4 Simultaneous Congruences
11.1.5 Excel method
11.1.6 Excel method applied to woman and eggs example
11.1.7 Delphi program to solve simultaneous congruences
11.1.8 Delphi code
11.2 The RSA public-key cryptosystem
11.2.1 Brief summary of RSA theory
11.3 Example
11.3.1 Secrecy and authenticity
11.4 Delphi code
11.5 Partitions of integers
11.5.1 Additive number theory
11.5.2 What is a partition?
11.6 Delphi code
11.7 Exercises
12 Chaos graphics, pp. 161-171
12.1 Equations
12.2 Complex numbers z = x + iy
12.3 Terminology
12.4 What are the rules for complex arithmetic?
12.4.1 Equality of complex numbers
12.4.2 Addition, subtraction
12.4.3 Conjugate
12.4.4 Modulus
12.4.5 Multiplication
12.4.6 Division
12.5 Solving quadratic equations
12.6 Applications of complex numbers
12.7 Euler.s formula
12.8 Solving equations in general
12.8.1 Complex Newton.s method: geometry and convergence
12.9 Complex numbers & chaos
12.10Delphi code
12.10.1 Complex numbers module
12.10.2 Chaos module
12.11Delphi Output
12.12Exercises
13 Sudoku, pp. 173-179
13.1 Rules of the game
13.2 Design of the program
13.3 Delphi code
13.4 Exercises
Index |