C++ for Mathematicians: An Introduction for Students and Professionals, 1st Edition (Paperback) book cover

C++ for Mathematicians

An Introduction for Students and Professionals, 1st Edition

By Edward Scheinerman

CRC Press

520 pages | 22 B/W Illus.

Purchasing Options:$ = USD
Paperback: 9781584885849
pub: 2006-06-06
SAVE ~$14.69
Hardback: 9781138413276
pub: 2018-07-31
SAVE ~$29.25
eBook (VitalSource) : 9780429147531
pub: 2006-06-06
from $46.98

FREE Standard Shipping!


For problems that require extensive computation, a C++ program can race through billions of examples faster than most other computing choices. C++ enables mathematicians of virtually any discipline to create programs to meet their needs quickly, and is available on most computer systems at no cost. C++ for Mathematicians: An Introduction for Students and Professionals accentuates C++ concepts that are most valuable for pure and applied mathematical research.

This is the first book available on C++ programming that is written specifically for a mathematical audience; it omits the language’s more obscure features in favor of the aspects of greatest utility for mathematical work. The author explains how to use C++ to formulate conjectures, create images and diagrams, verify proofs, build mathematical structures, and explore myriad examples. Emphasizing the essential role of practice as part of the learning process, the book is ideally designed for undergraduate coursework as well as self-study. Each chapter provides many problems and solutions which complement the text and enable you to learn quickly how to apply them to your own problems. An accompanying CD ROM provides all numbered programs so that readers can easily use or adapt the code as needed.

Presenting clear explanations and examples from the world of mathematics that develop concepts from the ground up, C++ for Mathematicians can be used again and again as a resource for applying C++ to problems that range from the basic to the complex.


“For a mathematician like myself, Scheinerman’s new book is ideal. It concentrates on the portion of C++ that will be most useful to a mathematician. While developing the necessary tools and syntax of C++, the book presents example programs relevant to interesting and somewhat sophisticated mathematical problems. The reader can proceed as far as he/she wants. Even just reading the first few chapters of the book and writing some programs using the constructs introduced, there is sufficient [material] for many purposes within undergraduate mathematics … The strength of this book is the intermingling of interesting mathematics with the ideas and syntax of the C++ language. … The writing is very fluent and does not bog down in endless detail as so many programming books do … In summary, I recommend this book highly to frustrated mathematicians wishing to learn C++ programming. You will really enjoy the well-chosen examples and the light touch in the exposition.”

—Jeffrey Nunemacher, MAA Reviews

Table of Contents

List of Programs

List of Figures



The Basics

What is C++?

Hello C++


The Integer Types

The Real Number Types

The bool and char Types 

Checking the Size and Capacity of the Different Types

Standard Operations

Comparisons and Boolean Operations

Complex Numbers

Naming Variables

Greatest Common Divisor

The Problem

A First Approach

Euclid’s Method

Looping With for, while, and do

An Exhaustive Approach to the GCD Problem

Extended GCD, Call by Reference, and Overloading

Random Numbers

Pseudo Random Number Generation

Uniform Random Values

More on Pseudo Random Number Generation

A Monte Carlo Program for the GCD Problem

Normal Random Values


Euler’s Totient

Array Fundamentals

A Procedure to Factor Integers

A Procedure to Calculate Euler’s Totient

The Sieve of Eratosthenes

A Faster Totient

Computing pn for Large n

The Answer


Points in the Plane

Data and Methods

Declaring the Point Class

Data Hiding


Assignment and Conversion


Procedures using Arguments of Type Point


Pythagorean Triples

Generating Pythagorean Triples

Designing a Primitive Pythagorean Triple Class

Implementation of the PTriple Class

Finding and Sorting the Triples



Set Iterators


Adjustable Arrays Via the Vector Class

Ordered Pairs


Lists, Stacks, and Assorted Queues

Modular Arithmetic

Designing the Mod Type

The Code

The Default Modulus: Static Class Variables and Methods

Constructors and Get/Set Methods

Comparison Operators

Arithmetic Operators

Writing Mod Objects to Output Streams

A Main to Demonstrate the Mod Class

The Projective Plane

Introduction to the Projective Plane, RP2

Designing the Classes PPoint and PLine


Protected Class Members

Class and File Organization for PPoint and PLine

The Parent Class PObject

The Classes PPoint and PLine

Discovering and Repairing a Bug

Pappus Revisited


Ulam’s Problem

Designing the Permutation Class

Finding Monotone Subsequences



Procedure Templates

Class Templates

The Polynomial Class Template

The GCD Problem Revisited

Working in Binary


Using Other Packages

Arbitrary Precision Arithmetic: the GMP Package

Linear Algebra

Other Packages

Strings, Input/Output, and Visualization

Character Arrays

The String Class

Command Line Arguments

Reading and Writing Data in Files

String Streams


A Class to Parse Files


Odds and Ends

The switch Statement

Labels and the goto Statement

Exception Handling


Other Ways to Create Types



A. Your C++ Computing Environment

Programming with a Command Window and a Text Editor

Programming with an Integrated Development Environment

General Advice on Debugging

B. Documentation with Doxygen

Doxygen Comments

Using Doxygen

C. C++ Reference

Variables and Types


Control Statements



Standard Functions

D. Answers


*Each Chapter Contains Exercises; Solutions can be found in Appendix D

Subject Categories

BISAC Subject Codes/Headings:
COMPUTERS / Programming Languages / General
MATHEMATICS / Number Systems
MATHEMATICS / Probability & Statistics / General