C++ for Mathematicians - An Introduction for Students and Professionals

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Scheinerman E.

Language: English
Pages: 521

Contents......Page 6
Programs......Page 14
Figures......Page 18
Preface......Page 20
1.1 What is C++?......Page 28
1.2 Hello C++......Page 29
1.3 Exercises......Page 33
2.1 The integer types......Page 36
2.3 The bool and char types......Page 39
2.4 Checking the size and capacity of the different types......Page 40
2.5 Standard operations......Page 43
2.6 Comparisons and Boolean operations......Page 47
2.7 Complex numbers......Page 48
2.8 Naming variables......Page 52
2.9 Exercises......Page 53
3.2 A first approach......Page 56
3.3 Euclid’s method......Page 62
3.4 Looping with for, while, and do......Page 66
3.5 An exhaustive approach to the GCD problem......Page 68
3.6 Extended gcd, call by reference, and overloading......Page 70
3.7 Exercises......Page 74
4.1 Pseudo random number generation......Page 78
4.2 Uniform random values......Page 79
4.3 More on pseudo random number generation......Page 82
4.4 A Monte Carlo program for the GCD problem......Page 85
4.5 Normal random values......Page 86
4.6 Exercises......Page 88
5.1 Euler’s totient......Page 92
5.2 Array fundamentals......Page 94
5.3 A procedure to factor integers......Page 96
5.4 A procedure to calculate Euler’s totient......Page 101
5.5 The Sieve of Eratosthenes: new and delete[]......Page 103
5.6 A faster totient......Page 108
5.7 Computing pn for large n......Page 110
5.8 The answer......Page 112
5.9 Exercises......Page 113
6.1 Data and methods......Page 118
6.2 Declaring the Point class......Page 119
6.3 Data hiding......Page 122
6.4 Constructors......Page 124
6.5 Assignment and conversion......Page 125
6.6 Methods......Page 126
6.7 Procedures using arguments of type Point......Page 128
6.8 Operators......Page 129
6.9 Exercises......Page 137
7.1 Generating Pythagorean triples......Page 140
7.2 Designing a primitive Pythagorean triple class......Page 141
7.3 Implementation of the PTriple class......Page 142
7.4 Finding and sorting the triples......Page 146
7.5 Exercises......Page 150
9.1 Designing the Mod type......Page 182
9.2 The code......Page 183
9.3 The default modulus: Static class variables and methods......Page 188
9.5 Comparison operators......Page 192
9.6 Arithmetic operators......Page 194
9.8 A main to demonstrate the Mod class......Page 197
9.9 Exercises......Page 199
11.1 Ulam’s problem......Page 240
11.2 Designing the Permutation class......Page 242
11.3 Finding monotone subsequences......Page 254
11.4 Exercises......Page 257
12.1 Procedure templates......Page 260
12.2 Class templates......Page 263
12.3 The Polynomial class template......Page 267
12.4 The GCD problem revisited......Page 279
12.5 Working in binary......Page 283
12.6 Exercises......Page 289
13.1 Arbitrary precision arithmetic: The GMP package......Page 294
13.2 Linear algebra......Page 298
13.3 Other packages......Page 311
13.4 Exercises......Page 312
14.1 Character arrays......Page 314
14.2 The string class......Page 316
14.3 Command line arguments......Page 322
14.4 Reading and writing data in files......Page 325
14.5 String streams......Page 332
14.6 Formatting......Page 333
14.7 A class to parse files......Page 336
14.8 Visualization......Page 340
14.9 Exercises......Page 355
15.1 The switch statement......Page 358
15.2 Labels and the goto statement......Page 361
15.3 Exception handling......Page 363
15.4 Friends......Page 369
15.5 Other ways to create types......Page 372
15.6 Pointers......Page 375
15.7 Exercises......Page 383
A.1 Programming with a command window and a text editor......Page 388
A.2 Programming with an integrated development environment......Page 397
A.3 General advice on debugging......Page 403
B.1 Doxygen comments......Page 406
B.2 Using Doxygen......Page 411
C.1 Variables and types......Page 416
C.2 Operations......Page 419
C.3 Control statements......Page 421
C.4 Procedures......Page 423
C.5 Classes......Page 426
C.6 Standard functions......Page 433
Index......Page 512