100% found this document useful (2 votes)
8 views

Introduction to Computation and Programming Using Python Revised and Expanded Edition John V. Guttag instant download

The document is a promotional listing for various ebooks, including 'Introduction to Computation and Programming Using Python' by John V. Guttag, which is available for download. It includes links to other programming and psychology-related books, highlighting their content and availability in different formats. The document also contains a detailed table of contents for Guttag's book, covering fundamental programming concepts and techniques using Python.

Uploaded by

phemyjilaji
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
8 views

Introduction to Computation and Programming Using Python Revised and Expanded Edition John V. Guttag instant download

The document is a promotional listing for various ebooks, including 'Introduction to Computation and Programming Using Python' by John V. Guttag, which is available for download. It includes links to other programming and psychology-related books, highlighting their content and availability in different formats. The document also contains a detailed table of contents for Guttag's book, covering fundamental programming concepts and techniques using Python.

Uploaded by

phemyjilaji
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Introduction to Computation and Programming

Using Python Revised and Expanded Edition John


V. Guttag pdf download

https://ebookname.com/product/introduction-to-computation-and-
programming-using-python-revised-and-expanded-edition-john-v-
guttag/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Programming in Python 3 A Complete Introduction to the


Python Language 2nd Edition Summerfield

https://ebookname.com/product/programming-in-python-3-a-complete-
introduction-to-the-python-language-2nd-edition-summerfield/

Intimate Matters Third Revised and Expanded Edition


John D’Emilio

https://ebookname.com/product/intimate-matters-third-revised-and-
expanded-edition-john-demilio/

Beginning Python Using Python 2 6 and Python 3 1 Wrox


Programmer to Programmer James Payne

https://ebookname.com/product/beginning-python-using-
python-2-6-and-python-3-1-wrox-programmer-to-programmer-james-
payne/

The Lace Makers of Narsapur 2012 ed. Edition Maria Mies

https://ebookname.com/product/the-lace-makers-of-
narsapur-2012-ed-edition-maria-mies/
Practice Notes Residential Tenancies 4th Edition Colbey

https://ebookname.com/product/practice-notes-residential-
tenancies-4th-edition-colbey/

Handmade Baskets Susie Vaughan

https://ebookname.com/product/handmade-baskets-susie-vaughan/

water on the moon 2010th Edition Helen Buckingham

https://ebookname.com/product/water-on-the-moon-2010th-edition-
helen-buckingham/

Gene Regulation Methods and Protocols 1st Edition Minou


Bina (Auth.)

https://ebookname.com/product/gene-regulation-methods-and-
protocols-1st-edition-minou-bina-auth/

ASP NET AJAX in Action 1st Edition Alessandro Gallo

https://ebookname.com/product/asp-net-ajax-in-action-1st-edition-
alessandro-gallo/
Handbook of Psychology volume 4 Experimental Psychology
2nd Edition Weiner

https://ebookname.com/product/handbook-of-psychology-
volume-4-experimental-psychology-2nd-edition-weiner/
Introduction to
Computation and
Programming Using Python
Introduction to
Computation and
Programming Using Python

Revised and Expanded Edition

John V. Guttag

The MIT Press


Cambridge, Massachusetts
London, England
©  2013  Massachusetts Institute of Technology  

All  rights  reserved.  No  part  of  this  book  may  be  reproduced  in  any  form  by  any  
electronic  or  mechanical  means  (including  photocopying,  recording,  or  information  
storage  and  retrieval)  without  permission  in  writing  from  the  publisher.  

MIT  Press  books  may  be  purchased  at  special  quantity  discounts  for  business  or  
sales  promotional  use.  For  information,  please  email  
[email protected]  or  write  to  Special  Sales  Department,  The  MIT  
Press,  55  Hayward  Street,  Cambridge,  MA  02142.  

Printed  and  bound  in  the  United  States  of  America.  

Library  of  Congress  Cataloging-­‐in-­‐Publication  Data  


 
Guttag,  John.  

Introduction  to  computation  and  programming  using  Python  /  John  V.  Guttag.  —  
Revised  and  expanded  edition.  

  pages   cm  

Includes  index.  

ISBN  978-­‐0-­‐262-­‐52500-­‐8  (pbk.  :  alk.  paper)    

1.    Python  (Computer  program  language)   2.    Computer  programming.   I.  Title.    

QA76.73.P48G88   2013  

005.13'3—dc23  

10   9   8   7   6   5   4   3   2   1  
To my family:

Olga
David
Andrea
Michael
Mark
Addie
CONTENTS

PREFACE .......................................................................................................xiii  
ACKNOWLEDGMENTS..................................................................................... xv  
1   GETTING STARTED .................................................................................... 1  
2   INTRODUCTION TO PYTHON ...................................................................... 7  
2.1   The Basic Elements of Python ............................................................... 8  
2.1.1   Objects, Expressions, and Numerical Types .................................... 9  
2.1.2   Variables and Assignment ............................................................ 11  
2.1.3   IDLE ............................................................................................ 13  
2.2   Branching Programs ........................................................................... 14  
2.3   Strings and Input ............................................................................... 16  
2.3.1   Input ............................................................................................ 18  
2.4   Iteration .............................................................................................. 18  
3   SOME SIMPLE NUMERICAL PROGRAMS .................................................. 21  
3.1   Exhaustive Enumeration .................................................................... 21  
3.2   For Loops............................................................................................ 23  
3.3   Approximate Solutions and Bisection Search ...................................... 25  
3.4   A Few Words About Using Floats ........................................................ 29  
3.5   Newton-Raphson ................................................................................ 32  
4   FUNCTIONS, SCOPING, and ABSTRACTION ............................................. 34  
4.1   Functions and Scoping ....................................................................... 35  
4.1.1   Function Definitions ..................................................................... 35  
4.1.2   Keyword Arguments and Default Values ....................................... 36  
4.1.3   Scoping ........................................................................................ 37  

4.2   Specifications ..................................................................................... 41  


4.3   Recursion ........................................................................................... 44  
4.3.1   Fibonacci Numbers ...................................................................... 45  
4.3.2   Palindromes ................................................................................. 48  

4.4   Global Variables ................................................................................. 50  


4.5   Modules .............................................................................................. 51  
4.6   Files ................................................................................................... 53  
viii

5 STRUCTURED TYPES, MUTABILITY, AND HIGHER-ORDER FUNCTIONS .. 56


5.1 Tuples ................................................................................................ 56
5.1.1 Sequences and Multiple Assignment............................................. 57

5.2 Lists and Mutability ............................................................................ 58


5.2.1 Cloning ........................................................................................ 63
5.2.2 List Comprehension ..................................................................... 63
5.3 Functions as Objects .......................................................................... 64

5.4 Strings, Tuples, and Lists ................................................................... 66


5.5 Dictionaries ........................................................................................ 67
6 TESTING AND DEBUGGING...................................................................... 70
6.1 Testing................................................................................................ 70
6.1.1 Black-Box Testing ........................................................................ 71
6.1.2 Glass-Box Testing ........................................................................ 73
6.1.3 Conducting Tests ......................................................................... 74
6.2 Debugging .......................................................................................... 76
6.2.1 Learning to Debug ........................................................................ 78
6.2.2 Designing the Experiment ............................................................ 79
6.2.3 When the Going Gets Tough ......................................................... 81
6.2.4 And When You Have Found “The” Bug .......................................... 82
7 EXCEPTIONS AND ASSERTIONS .............................................................. 84
7.1 Handling Exceptions ........................................................................... 84
7.2 Exceptions as a Control Flow Mechanism ........................................... 87
7.3 Assertions ........................................................................................... 90
8 CLASSES AND OBJECT-ORIENTED PROGRAMMING ............................... 91
8.1 Abstract Data Types and Classes ........................................................ 91
8.1.1 Designing Programs Using Abstract Data Types ............................ 96
8.1.2 Using Classes to Keep Track of Students and Faculty ................... 96
8.2 Inheritance ......................................................................................... 99
8.2.1 Multiple Levels of Inheritance ..................................................... 101
8.2.2 The Substitution Principle .......................................................... 102
8.3 Encapsulation and Information Hiding .............................................. 103
8.3.1 Generators ................................................................................. 106
8.4 Mortgages, an Extended Example ..................................................... 108
ix

9   A SIMPLISTIC INTRODUCTION TO ALGORITHMIC COMPLEXITY ............ 113  


9.1   Thinking About Computational Complexity ....................................... 113  
9.2   Asymptotic Notation .......................................................................... 116  

9.3   Some Important Complexity Classes ................................................. 118  


9.3.1   Constant Complexity .................................................................. 118  
9.3.2   Logarithmic Complexity .............................................................. 118  
9.3.3   Linear Complexity ...................................................................... 119  

9.3.4   Log-Linear Complexity ................................................................ 120  


9.3.5   Polynomial Complexity ............................................................... 120  
9.3.6   Exponential Complexity .............................................................. 121  
9.3.7   Comparisons of Complexity Classes............................................ 123  
10   SOME SIMPLE ALGORITHMS AND DATA STRUCTURES ......................... 125  
10.1   Search Algorithms .......................................................................... 126  
10.1.1   Linear Search and Using Indirection to Access Elements .......... 126  
10.1.2   Binary Search and Exploiting Assumptions .............................. 128  
10.2   Sorting Algorithms .......................................................................... 131  
10.2.1   Merge Sort................................................................................ 132  
10.2.2   Exploiting Functions as Parameters.......................................... 135  
10.2.3   Sorting in Python ..................................................................... 136  
10.3   Hash Tables .................................................................................... 137  
11   PLOTTING AND MORE ABOUT CLASSES ................................................ 141  
11.1   Plotting Using PyLab ....................................................................... 141  
11.2   Plotting Mortgages, an Extended Example ....................................... 146  
12   STOCHASTIC PROGRAMS, PROBABILITY, AND STATISTICS ................... 152  
12.1   Stochastic Programs ....................................................................... 153  
12.2   Inferential Statistics and Simulation ............................................... 155  
12.3   Distributions .................................................................................. 166  
12.3.1   Normal Distributions and Confidence Levels ............................. 168  
12.3.2   Uniform Distributions .............................................................. 170  
12.3.3   Exponential and Geometric Distributions ................................. 171  
12.3.4   Benford’s Distribution .............................................................. 173  
12.4   How Often Does the Better Team Win? ............................................ 174  
12.5   Hashing and Collisions ................................................................... 177  
x

13 RANDOM WALKS AND MORE ABOUT DATA VISUALIZATION ................. 179
13.1 The Drunkard’s Walk ...................................................................... 179
13.2 Biased Random Walks .................................................................... 186

13.3 Treacherous Fields .......................................................................... 191


14 MONTE CARLO SIMULATION .................................................................. 193
14.1 Pascal’s Problem ............................................................................. 194
14.2 Pass or Don’t Pass? ......................................................................... 195

14.3 Using Table Lookup to Improve Performance ................................... 199

14.4 Finding π ........................................................................................ 200


14.5 Some Closing Remarks About Simulation Models ............................ 204
15 UNDERSTANDING EXPERIMENTAL DATA .............................................. 207
15.1 The Behavior of Springs .................................................................. 207
15.1.1 Using Linear Regression to Find a Fit ....................................... 210
15.2 The Behavior of Projectiles .............................................................. 214
15.2.1 Coefficient of Determination ..................................................... 216

15.2.2 Using a Computational Model ................................................... 217


15.3 Fitting Exponentially Distributed Data ............................................ 218
15.4 When Theory Is Missing .................................................................. 221
16 LIES, DAMNED LIES, AND STATISTICS .................................................. 222

16.1 Garbage In Garbage Out (GIGO) ...................................................... 222


16.2 Pictures Can Be Deceiving .............................................................. 223
16.3 Cum Hoc Ergo Propter Hoc ............................................................... 225
16.4 Statistical Measures Don’t Tell the Whole Story ............................... 226

16.5 Sampling Bias................................................................................. 228


16.6 Context Matters .............................................................................. 229
16.7 Beware of Extrapolation .................................................................. 229
16.8 The Texas Sharpshooter Fallacy ...................................................... 230

16.9 Percentages Can Confuse ................................................................ 232


16.10 Just Beware .................................................................................. 233
17 KNAPSACK AND GRAPH OPTIMIZATION PROBLEMS .............................. 234
17.1 Knapsack Problems ........................................................................ 234
17.1.1 Greedy Algorithms .................................................................... 235
17.1.2 An Optimal Solution to the 0/1 Knapsack Problem ................... 238
xi

17.2   Graph Optimization Problems ......................................................... 240  


17.2.1   Some Classic Graph-Theoretic Problems ................................... 244  
17.2.2   The Spread of Disease and Min Cut .......................................... 245  

17.2.3   Shortest Path: Depth-First Search and Breadth-First Search .... 246  
18   DYNAMIC PROGRAMMING ..................................................................... 252  
18.1   Fibonacci Sequences, Revisited ....................................................... 252  
18.2   Dynamic Programming and the 0/1 Knapsack Problem................... 254  

18.3   Dynamic Programming and Divide-and-Conquer ............................. 261  


19   A QUICK LOOK AT MACHINE LEARNING ................................................ 262  
19.1   Feature Vectors .............................................................................. 264  
19.2   Distance Metrics ............................................................................. 266  
19.3   Clustering ....................................................................................... 270  
19.4   Types Example and Cluster............................................................. 272  
19.5   K-means Clustering ........................................................................ 274  
19.6   A Contrived Example ...................................................................... 276  
19.7   A Less Contrived Example ............................................................... 280  
19.8   Wrapping Up................................................................................... 286  
PYTHON 2.7 QUICK REFERENCE ................................................................. 287  
INDEX .......................................................................................................... 289  
PREFACE

This book is based on an MIT course that has been offered twice a year since
2006. The course is aimed at students with little or no prior programming
experience who have desire to understand computational approaches to problem
solving. Each year, a few of the students in the class use the course as a
stepping stone to more advanced computer science courses. But for most of the
students it will be their only computer science course.
Because the course will be the only computer science course for most of the
students, we focus on breadth rather than depth. The goal is to provide
students with a brief introduction to many topics, so that they will have an idea
of what’s possible when the time comes to think about how to use computation
to accomplish a goal. That said, it is not a “computation appreciation” course.
It is a challenging and rigorous course in which the students spend a lot of time
and effort learning to bend the computer to their will.
The main goal of this book is to help you, the reader, become skillful at making
productive use of computational techniques. You should learn to apply
computational modes of thoughts to frame problems and to guide the process of
extracting information from data in a computational manner. The primary
knowledge you will take away from this book is the art of computational problem
solving.
The book is a bit eccentric. Part 1 (Chapters 1-8) is an unconventional
introduction to programming in Python. We braid together four strands of
material:

• The basics of programming,


• The Python programming language,
• Concepts central to understanding computation, and
• Computational problem solving techniques.
We cover most of Python’s features, but the emphasis is on what one can do
with a programming language, not on the language itself. For example, by the
end of Chapter 3 the book has covered only a small fraction of Python, but it has
already introduced the notions of exhaustive enumeration, guess-and-check
algorithms, bisection search, and efficient approximation algorithms. We
introduce features of Python throughout the book. Similarly, we introduce
aspects of programming methods throughout the book. The idea is to help you
learn Python and how to be a good programmer in the context of using
computation to solve interesting problems.
Part 2 (Chapters 9-16) is primarily about using computation to solve problems.
It assumes no knowledge of mathematics beyond high school algebra, but it
does assume that the reader is comfortable with rigorous thinking and not
intimidated by mathematical concepts. It covers some of the usual topics found
in an introductory text, e.g., computational complexity and simple algorithms.
xiv Preface

But the bulk of this part of the book is devoted to topics not found in most
introductory texts: data visualization, probabilistic and statistical thinking,
simulation models, and using computation to understand data.

Part 3 (Chapters 17-19) looks at three slightly advanced topics—optimization


problems, dynamic programming, and clustering.
Part 1 can form the basis of a self-contained course that can be taught in a
quarter or half a semester. Experience suggests that it is quite comfortable to fit
both Parts 1 and 2 of this book into a full-semester course. When the material
in Part 3 is included, the course becomes more demanding than is comfortable
for many students.
The book has two pervasive themes: systematic problem solving and the power
of abstraction. When you have finished this book you should have:

• Learned a language, Python, for expressing computations,


• Learned a systematic approach to organizing, writing and debugging
medium-sized programs,
• Developed an informal understanding of computational complexity,
• Developed some insight into the process of moving from an ambiguous
problem statement to a computational formulation of a method for
solving the problem,
• Learned a useful set of algorithmic and problem reduction techniques,
• Learned how to use randomness and simulations to shed light on
problems that don’t easily succumb to closed-form solutions, and
• Learned how to use computational tools, including simple statistical and
visualization tools, to model and understand data.
Programming is an intrinsically difficult activity. Just as “there is no royal road
to geometry,”1 there is no royal road to programming. It is possible to deceive
students into thinking that they have learned how to program by having them
complete a series of highly constrained “fill in the blank” programming
problems. However, this does not prepare students for figuring out how to
harness computational thinking to solve problems.
If you really want to learn the material, reading the book will not be enough. At
the very least you should try running some of the code in the book. All of the
code in the book can be found at http://mitpress.mit.edu/ICPPRE. Various
versions of the course have been available on MIT’s OpenCourseWare (OCW)
Web site since 2008. The site includes video recordings of lectures and a
complete set of problem sets and exams. Since the fall of 2012, edX and MITx,
have offered an online version of this course. We strongly recommend that you
do the problem sets associated with one of the OCW or edX offerings.

1 This was Euclid’s purported response, circa 300 BC, to King Ptolemy’s request for an

easier way to learn mathematics.


ACKNOWLEDGMENTS

This book grew out of a set of lecture notes that I prepared while teaching an
undergraduate course at MIT. The course, and therefore this book, benefited
from suggestions from faculty colleagues (especially Eric Grimson, Srinivas
Devadas, and Fredo Durand), teaching assistants, and the students who took
the course.
The process of transforming my lecture notes into a book proved far more
onerous than I had expected. Fortunately, this misguided optimism lasted long
enough to keep me from giving up. The encouragement of colleagues and family
also helped keep me going.

Eric Grimson, Chris Terman, and David Guttag provided vital help. Eric, who is
MIT’s Chancellor, managed to find the time to read almost the entire book with
great care. He found numerous errors (including an embarrassing, to me,
number of technical errors) and pointed out places where necessary
explanations were missing. Chris also read parts of the manuscript and
discovered errors. He also helped me battle Microsoft Word, which we
eventually persuaded to do most of what we wanted. David overcame his
aversion to computer science, and proofread multiple chapters.

Preliminary versions of this book were used in the MIT course 6.00 and the MITx
course 6.00x. A number of students in these courses pointed out errors. One
6.00x student, J.C. Cabrejas, was particularly helpful. He found a large number
of typos, and more than a few technical errors.

Like all successful professors, I owe a great deal to my graduate students. The
photo on the back cover of this book depicts me supporting some of my current
students. In the lab, however, it is they who support me. In addition to doing
great research (and letting me take some of the credit for it), Guha
Balakrishnan, Joel Brooks, Ganeshapillai Gartheeban, Jen Gong, Yun Liu,
Anima Singh, Jenna Wiens, and Amy Zhao all provided useful comments on this
manuscript.
I owe a special debt of gratitude to Julie Sussman, P.P.A. Until I started working
with Julie, I had no idea how much difference an editor could make. I had
worked with capable copy editors on previous books, and thought that was what
I needed for this book. I was wrong. I needed a collaborator who could read the
book with the eyes of a student, and tell me what needed to be done, what
should be done, and what could be done if I had the time and energy to do it.
Julie buried me in “suggestions” that were too good to ignore. Her combined
command of both the English language and programming is quite remarkable.
Finally, thanks to my wife, Olga, for pushing me to finish and for pitching in at
critical times.
1 GETTING STARTED

A computer does two things, and two things only: it performs calculations and it
remembers the results of those calculations. But it does those two things
extremely well. The typical computer that sits on a desk or in a briefcase
performs a billion or so calculations a second. It’s hard to image how truly fast
that is. Think about holding a ball a meter above the floor, and letting it go. By
the time it reaches the floor, your computer could have executed over a billion
instructions. As for memory, a typical computer might have hundreds of
gigabytes of storage. How big is that? If a byte (the number of bits, typically
eight, required to represent one character) weighed one ounce (which it doesn’t),
100 gigabytes would weigh more than 3,000,000 tons. For comparison, that’s
roughly the weight of all the coal produced in a year in the U.S.
For most of human history, computation was limited by the speed of calculation
of the human brain and the ability to record computational results with the
human hand. This meant that only the smallest problems could be attacked
computationally. Even with the speed of modern computers, there are still
problems that are beyond modern computational models (e.g., understanding
climate change), but more and more problems are proving amenable to
computational solution. It is our hope that by the time you finish this book, you
will feel comfortable bringing computational thinking to bear on solving many of
the problems you encounter during your studies, work, and even everyday life.
What do we mean by computational thinking?
All knowledge can be thought of as either declarative or imperative. Declarative
knowledge is composed of statements of fact. For example, “the square root of x
is a number y such that y*y = x.” This is a statement of fact. Unfortunately it
doesn’t tell us how to find a square root.
Imperative knowledge is “how to” knowledge, or recipes for deducing
information. Heron of Alexandria was the first to document a way to compute
the square root of a number.2 His method can be summarized as:

• Start with a guess, g.


• If g*g is close enough to x, stop and say that g is the answer.

• Otherwise create a new guess by averaging g and x/g, i.e., (g + x/g)/2.


• Using this new guess, which we again call g, repeat the process until g*g
is close enough to x.

2 Many believe that Heron was not the inventor of this method, and indeed there is some

evidence that it was well known to the ancient Babylonians.


2 Chapter 1. Getting Started

Consider, for example, finding the square root of 25.


1. Set g to some arbitrary value, e.g., 3.
2. We decide that 3*3 = 9 is not close enough to 25.
3. Set g to (3 + 25/3)/2 = 5.67.3
4. We decide that 5.67*5.67 = 32.15 is still not close enough to 25.
5. Set g to (5.67 + 25/5.67)/2 = 5.04
6. We decide that 5.04*5.04 = 25.4 is close enough, so we stop and declare 5.04
to be an adequate approximation to the square root of 25.
Note that the description of the method is a sequence of simple steps, together
with a flow of control that specifies when each step is to be executed. Such a
description is called an algorithm.4 This algorithm is an example of a guess-
and-check algorithm. It is based on the fact that it is easy to check whether or
not a guess is a good one.
A bit more formally, an algorithm is a finite list of instructions that describe a
computation that when executed on a provided set of inputs will proceed
through a set of well-defined states and eventually produce an output.
An algorithm is a bit like a recipe from a cookbook:
1. Put custard mixture over heat.
2. Stir.
3. Dip spoon in custard.
4. Remove spoon and run finger across back of spoon.
5. If clear path is left, remove custard from heat and let cool.
6. Otherwise repeat.
It includes some tests for deciding when the process is complete, as well as
instructions about the order in which to execute instructions, sometimes
jumping to some instruction based on a test.
So how does one capture this idea of a recipe in a mechanical process? One way
would be to design a machine specifically intended to compute square roots.
Odd as this may sound, the earliest computing machines were, in fact, fixed-
program computers, meaning they were designed to do very specific things, and
were mostly tools to solve a specific mathematical problem, e.g., to compute the
trajectory of an artillery shell. One of the first computers (built in 1941 by
Atanasoff and Berry) solved systems of linear equations, but could do nothing
else. Alan Turing’s bombe machine, developed during World War II, was
designed strictly for the purpose of breaking German Enigma codes. Some very
simple computers still use this approach. For example, a four-function
calculator is a fixed-program computer. It can do basic arithmetic, but it cannot

3 For simplicity, we are rounding results.


4 The word “algorithm” is derived from the name of the Persian mathematician

Muhammad ibn Musa al-Khwarizmi.


Chapter 1. Getting Started 3

be used as a word processor or to run video games. To change the program of


such a machine, one has to replace the circuitry.
The first truly modern computer was the Manchester Mark 1.5 It was
distinguished from its predecessors by the fact that it was a stored-program
computer. Such a computer stores (and manipulates) a sequence of
instructions, and has a set of elements that will execute any instruction in that
sequence. By creating an instruction-set architecture and detailing the
computation as a sequence of instructions (i.e., a program), we make a highly
flexible machine. By treating those instructions in the same way as data, a
stored-program machine can easily change the program, and can do so under
program control. Indeed, the heart of the computer then becomes a program
(called an interpreter) that can execute any legal set of instructions, and thus
can be used to compute anything that one can describe using some basic set of
instructions.
Both the program and the data it manipulates reside in memory. Typically there
is a program counter that points to a particular location in memory, and
computation starts by executing the instruction at that point. Most often, the
interpreter simply goes to the next instruction in the sequence, but not always.
In some cases, it performs a test, and on the basis of that test, execution may
jump to some other point in the sequence of instructions. This is called flow of
control, and is essential to allowing us to write programs that perform complex
tasks.
Returning to the recipe metaphor, given a fixed set of ingredients a good chef
can make an unbounded number of tasty dishes by combining them in different
ways. Similarly, given a small fixed set of primitive elements a good programmer
can produce an unbounded number of useful programs. This is what makes
programming such an amazing endeavor.
To create recipes, or sequences of instructions, we need a programming
language in which to describe these things, a way to give the computer its
marching orders.
In 1936, the British mathematician Alan Turing described a hypothetical
computing device that has come to be called a Universal Turing Machine. The
machine had an unbounded memory in the form of tape on which one could
write zeros and ones, and some very simple primitive instructions for moving,
reading, and writing to the tape. The Church-Turing thesis states that if a
function is computable, a Turing Machine can be programmed to compute it.
The “if” in the Church-Turing thesis is important. Not all problems have
computational solutions. For example, Turing showed that it is impossible to
write a program that given an arbitrary program, call it P, prints true if and only
if P will run forever. This is known as the halting problem.

5 This computer was built at the University of Manchester, and ran its first program in

1949. It implemented ideas previously described by John von Neumann and was
anticipated by the theoretical concept of the Universal Turing Machine described by Alan
Turing in 1936.
4 Chapter 1. Getting Started

The Church-Turing thesis leads directly to the notion of Turing completeness.


A programming language is said to be Turing complete if it can be used to
simulate a universal Turing Machine. All modern programming languages are
Turing complete. As a consequence, anything that can be programmed in one
programming language (e.g., Python) can be programmed in any other
programming language (e.g., Java). Of course, some things may be easier to
program in a particular language, but all languages are fundamentally equal
with respect to computational power.
Fortunately, no programmer has to build programs out of Turing’s primitive
instructions. Instead, modern programming languages offer a larger, more
convenient set of primitives. However, the fundamental idea of programming as
the process of assembling a sequence of operations remains central.
Whatever set of primitives one has, and whatever methods one has for using
them, the best thing and the worst thing about programming are the same: the
computer will do exactly what you tell it to do. This is a good thing because it
means that you can make it do all sorts of fun and useful things. It is a bad
thing because when it doesn’t do what you want it to do, you usually have
nobody to blame but yourself.
There are hundreds of programming languages in the world. There is no best
language (though one could nominate some candidates for worst). Different
languages are better or worse for different kinds of applications. MATLAB, for
example, is an excellent language for manipulating vectors and matrices. C is a
good language for writing the programs that control data networks. PHP is a
good language for building Web sites. And Python is a good general-purpose
language.
Each programming language has a set of primitive constructs, a syntax, a static
semantics, and a semantics. By analogy with a natural language, e.g., English,
the primitive constructs are words, the syntax describes which strings of words
constitute well-formed sentences, the static semantics defines which sentences
are meaningful, and the semantics defines the meaning of those sentences. The
primitive constructs in Python include literals (e.g., the number 3.2 and the
string 'abc') and infix operators (e.g., + and /).
The syntax of a language defines which strings of characters and symbols are
well formed. For example, in English the string “Cat dog boy.” is not a
syntactically valid sentence, because the syntax of English does not accept
sentences of the form <noun> <noun> <noun>. In Python, the sequence of
primitives 3.2 + 3.2 is syntactically well formed, but the sequence 3.2 3.2 is
not.
The static semantics defines which syntactically valid strings have a meaning.
In English, for example, the string “I are big,” is of the form <pronoun> <linking
verb> <adjective>, which is a syntactically acceptable sequence. Nevertheless, it
is not valid English, because the noun “I” is singular and the verb “are” is plural.
This is an example of a static semantic error. In Python, the sequence
3.2/'abc' is syntactically well formed (<literal> <operator> <literal>), but
Chapter 1. Getting Started 5

produces a static semantic error since it is not meaningful to divide a number by


a string of characters.
The semantics of a language associates a meaning with each syntactically
correct string of symbols that has no static semantic errors. In natural
languages, the semantics of a sentence can be ambiguous. For example, the
sentence “I cannot praise this student too highly,” can be either flattering or
damning. Programming languages are designed so that each legal program has
exactly one meaning.
Though syntax errors are the most common kind of error (especially for those
learning a new programming language), they are the least dangerous kind of
error. Every serious programming language does a complete job of detecting
syntactic errors, and will not allow users to execute a program with even one
syntactic error. Furthermore, in most cases the language system gives a
sufficiently clear indication of the location of the error that it is obvious what
needs to be done to fix it.
The situation with respect to static semantic errors is a bit more complex. Some
programming languages, e.g., Java, do a lot of static semantic checking before
allowing a program to be executed. Others, e.g., C and Python (alas), do
relatively less static semantic checking. Python does do a considerable amount
of static semantic checking while running a program. However, it does not
catch all static semantic errors. When these errors are not detected, the
behavior of a program is often unpredictable. We will see examples of this later
in the book.
One doesn’t usually speak of a program as having a semantic error. If a
program has no syntactic errors and no static semantic errors, it has a meaning,
i.e., it has semantics. Of course, that isn’t to say that it has the semantics that
its creator intended it to have. When a program means something other than
what its creator thinks it means, bad things can happen.
What might happen if the program has an error, and behaves in an unintended
way?

• It might crash, i.e., stop running and produce some sort of obvious
indication that it has done so. In a properly designed computing system,
when a program crashes it does not do damage to the overall system. Of
course, some very popular computer systems don’t have this nice
property. Almost everyone who uses a personal computer has run a
program that has managed to make it necessary to restart the whole
computer.

• Or it might keep running, and running, and running, and never stop. If
one has no idea of approximately how long the program is supposed to
take to do its job, this situation can be hard to recognize.

• Or it might run to completion and produce an answer that might, or


might not, be correct.
6 Chapter 1. Getting Started

Each of these is bad, but the last of them is certainly the worst, When a
program appears to be doing the right thing but isn’t, bad things can follow.
Fortunes can be lost, patients can receive fatal doses of radiation therapy,
airplanes can crash, etc.
Whenever possible, programs should be written in such a way that when they
don’t work properly, it is self-evident. We will discuss how to do this throughout
the book.

Finger Exercise: Computers can be annoyingly literal. If you don’t tell them
exactly what you want them to do, they are likely to do the wrong thing. Try
writing an algorithm for driving between two destinations. Write it the way you
would for a person, and then imagine what would happen if that person
executed the algorithm exactly as written. For example, how many traffic tickets
might they get?
2 INTRODUCTION TO PYTHON

Though each programming language is different (though not as different as their


designers would have us believe), there are some dimensions along which they
can be related.

• Low-level versus high-level refers to whether we program using


instructions and data objects at the level of the machine (e.g., move 64
bits of data from this location to that location) or whether we program
using more abstract operations (e.g., pop up a menu on the screen) that
have been provided by the language designer.
• General versus targeted to an application domain refers to whether
the primitive operations of the programming language are widely
applicable or are fine-tuned to a domain. For example Adobe Flash is
designed to facilitate adding animation and interactivity to Web pages,
but you wouldn’t want to use it build a stock portfolio analysis program.
• Interpreted versus compiled refers to whether the sequence of
instructions written by the programmer, called source code, is executed
directly (by an interpreter) or whether it is first converted (by a compiler)
into a sequence of machine-level primitive operations. (In the early days
of computers, people had to write source code in a language that was
very close to the machine code that could be directly interpreted by the
computer hardware.) There are advantages to both approaches. It is
often easier to debug programs written in languages that are designed to
be interpreted, because the interpreter can produce error messages that
are easy to correlate with the source code. Compiled languages usually
produce programs that run more quickly and use less space.
In this book, we use Python. However, this book is not about Python. It will
certainly help readers learn Python, and that’s a good thing. What is much
more important, however, is that careful readers will learn something about how
to write programs that solve problems. This skill can be transferred to any
programming language.
Python is a general-purpose programming language that can be used effectively
to build almost any kind of program that does not need direct access to the
computer’s hardware. Python is not optimal for programs that have high
reliability constraints (because of its weak static semantic checking) or that are
built and maintained by many people or over a long period of time (again
because of the weak static semantic checking).
However, Python does have several advantages over many other languages. It is
a relatively simple language that is easy to learn. Because Python is designed to
be interpreted, it can provide the kind of runtime feedback that is especially
helpful to novice programmers. There are also a large number of freely available
libraries that interface to Python and provide useful extended functionality.
Several of those are used in this book.
8 Chapter 2. Introduction to Python

Now we are ready to start learning some of the basic elements of Python. These
are common to almost all programming languages in concept, though not
necessarily in detail.

The reader should be forewarned that this book is by no means a comprehensive


introduction to Python. We use Python as a vehicle to present concepts related
to computational problem solving and thinking. The language is presented in
dribs and drabs, as needed for this ulterior purpose. Python features that we
don’t need for that purpose are not presented at all. We feel comfortable about
not covering the entire language because there are excellent online resources
describing almost every aspect of the language. When we teach the course on
which this book is based, we suggest to the students that they rely on these free
online resources for Python reference material.
Python is a living language. Since its introduction by Guido von Rossum in
1990, it has undergone many changes. For the first decade of its life, Python
was a little known and little used language. That changed with the arrival of
Python 2.0 in 2000. In addition to incorporating a number of important
improvements to the language itself, it marked a shift in the evolutionary path of
the language. A large number of people began developing libraries that
interfaced seamlessly with Python, and continuing support and development of
the Python ecosystem became a community-based activity. Python 3.0 was
released at the end of 2008. This version of Python cleaned up many of the
inconsistencies in the design of the various releases of Python 2 (often referred
to as Python 2.x). However, it was not backward compatible. That meant that
most programs written for earlier versions of Python could not be run using
implementations of Python 3.0.
The backward incompatibility presents a problem for this book. In our view,
Python 3.0 is clearly superior to Python 2.x. However, at the time of this
writing, some important Python libraries still do not work with Python 3. We
will, therefore, use Python 2.7 (into which many of the most important features
of Python 3 have been “back ported”) throughout this book.

2.1 The Basic Elements of Python


A Python program, sometimes called a script, is a sequence of definitions and
commands. These definitions are evaluated and the commands are executed by
the Python interpreter in something called the shell. Typically, a new shell is
created whenever execution of a program begins. In most cases, a window is
associated with the shell.
We recommend that you start a Python shell now, and use it to try the examples
contained in the remainder of the chapter. And, for that matter, later in the
book as well.
A command, often called a statement, instructs the interpreter to do
something. For example, the statement print 'Yankees rule!' instructs the
interpreter to output the string Yankees rule! to the window associated with the
shell.
Another Random Document on
Scribd Without Any Related Topics
V
STRENGTHENING THE BONDS OF UNION

The funding of the debt was only one of several parts of the policy
of Hamilton for putting the new government upon a solvent and firm
basis. The session of Congress which began in December, 1790,
witnessed the presentation of his report in favor of a national bank.
This report, like that on the debt, showed careful study of the
subject in its theoretical as well as practical aspects. Hamilton
referred in opening to the successful operation of public banks in
Italy, Germany, Holland, England, and France. He then went on to
point out some of their specific advantages in concentrating capital
and permitting the easy transfer of credit. He declared that such a
bank would afford "greater facility to the government, in obtaining
pecuniary aid, especially in sudden emergencies." It would also
facilitate the payment of taxes, by enabling tax-payers to borrow
from the bank and by the aid which it would give in the transfer of
funds. He did not shrink from declaring that the country would
benefit if foreigners invested in the bank shares, since this would
bring so much additional capital into the United States. Hamilton
then pointed out the vital distinction between government paper
issues and bank paper. He laid down thus the fundamental principle
of a well-regulated bank-note currency:—
"Among other material differences between a paper currency, issued
by the mere authority of government, and one issued by a bank,
payable in coin, is this: That, in the first case, there is no standard to
which an appeal can be made, as to the quantity which will only
satisfy, or which will surcharge the circulation: in the last, that
standard results from the demand. If more should be issued than is
necessary, it will return upon the bank. Its emissions, as elsewhere
intimated, must always be in a compound ratio to the fund and the
demand: whence it is evident, that there is a limitation in the nature
of the thing; while the discretion of the government is the only
measure of the extent of the emissions, by its own authority."
The bank which Hamilton proposed was private in its ownership, but
the United States were to pledge themselves not to authorize any
similar institution during its continuance. The capital of the bank was
not to exceed $10,000,000, for which the President of the United
States might subscribe $2,000,000 on behalf of the government. It
was further provided that three fourths of the amount of each share
might be paid in the public debt instead of gold and silver.
It was the purpose of Hamilton not merely to create a useful
financial institution, in which the government would be able to keep
its deposits, but to weld the monetary system of the country into an
harmonious whole. The result of this, which he foresaw and
intended, was to bind the property-owning classes to the interests of
the new government. The effect was much the same as the creation
of the Bank of England by the loan of its capital to the government,
which bound the moneyed classes firmly to King William, through
the knowledge that the debt and the solvency of the bank depended
on the perpetuation of his government and the exclusion of the
Stuart Pretender. The tendency of Hamilton's project was clearly
seen by Jefferson and other democratic leaders, and did not fail to
arouse their hostility. It was not long before they promptly took sides
against the national bank. Jefferson wrote regarding the meetings of
the cabinet at this time that "Hamilton and myself were daily pitted
in the cabinet like two cocks."
There was something deeper involved, from the standpoint of
Jefferson, than the mere question of bringing the moneyed class to
the side of the government. The latter object was sufficiently
distasteful to him, but the extension of the powers granted by the
Constitution beyond those which were directly enumerated in the
document involved a question of public policy and constitutional law
which afforded the basis for the creation of two great national
parties. The Constitution did not anywhere grant in terms to the
government the power to establish a national bank. Even Hamilton
did not pretend to put his finger on the specific authority for his new
project. He advanced a doctrine which was eagerly embraced by the
party which was growing up around him, but which was as resolutely
opposed by the other party. This was the doctrine of the implied
powers granted to the new government by the Constitution. It is
doubtful whether the Constitution would have been ratified by
Virginia and other states if this doctrine had been set forth and
defended in the state conventions by the friends of the Constitution.
This by no means implies that the policy and doctrine of Hamilton
were not wise and far-sighted. Hamilton had definite aims before
him, and it was his legitimate mission to educate public sentiment up
to the point of accepting those aims and of granting him the means
for carrying them out.
The doctrine of the "implied powers" rested upon the theory that
unless they were directly prohibited by the Constitution, all powers
were granted to the government by implication which were found
necessary and proper for carrying out the powers specifically
granted. Jefferson came to believe, if he did not believe at the
outset, that the government was one of delegated powers which
were strictly limited to those enumerated in the Constitution. The
doctrine of Hamilton, from this point of view, was revolutionary. It
meant the conversion of a government holding limited delegations of
power from the people and the states into a government having
supreme power, capable of taking an infinite variety of measures
whenever Congress, in the exercise of its discretion, believed that
such measures would contribute to the well-being of the Union. The
state governments, coming closer to the people than the federal
government, were most directly threatened by this assumption of
power, and it was as the champions of state rights as well as
democratic ideas that Jefferson and his friends took their ground as
the advocates of the strict construction of the Constitution.
It is not surprising, therefore, that the proposal to create the Bank of
the United States called forth in Congress prolonged and heated
debates. But the policy of Hamilton had been so far successful in
restoring the public credit that he carried the project for the national
bank through both houses, and it was laid before the President for
his approval. Washington had watched with interest the struggle in
the two houses, and was somewhat impressed by the weight of the
argument against the constitutional power of Congress to establish
the bank. The cabinet was divided. Jefferson and Randolph were
against the constitutionality of the bill. Hamilton and Knox were in
favor of it. Washington asked each of them to give him in writing the
reasons for his opinion. He weighed them carefully and then affixed
his signature to the bill (February 25, 1791). The new project
realized all the benefits which Hamilton expected. Washington, in his
tour of the Southern States in the spring of 1791, found the
sentiment for union strengthening and the country recovering from
the prostration of the era of bad money and political uncertainty
which had followed the Revolution. He declared in a letter written
after his return:
"Our public credit stands on that ground, which, three years ago, it
would have been madness to have foretold. The astonishing rapidity
with which the newly instituted bank was filled, gives an unexampled
proof of the resources of our countrymen and their confidence in
public measures. On the first day of opening the subscription, the
whole number of shares (twenty thousand) were taken up in one
hour, and application made for upwards of four thousand shares
more than were granted by the institution, besides many others that
were coming in from various quarters."
How much was likely to be done by a national bank to bind together
the commercial interests of different sections of the country can
hardly be appreciated to-day. At that time there were only four
banks in the country; none of these was ten years old, and their
combined capital was only $1,950,000. The Bank of the United
States was authorized to establish offices of discount and deposit in
all the states and to distribute parts of its capital among eight
branches in the chief cities of the country. It was the drafts of these
branches upon each other, and their means for reducing to a uniform
and reasonable rate the cost of transferring funds, which contributed
to knit all parts of the country together in commercial matters and
so strengthened the bond of political union. The bank did not make
regular reports to the Treasury Department, but its success is
indicated by a special report communicated to Congress by Secretary
Gallatin (January 24, 1811), which showed resources of
$24,183,046. The average annual dividends paid upon the stock up
to March, 1809, were over eight per cent.
So invaluable were the operations of the Bank of the United States
to the public treasury that Jefferson himself when President came to
its support. His support was perhaps never very hearty, and was due
to Albert Gallatin, his Secretary of the Treasury, whose foresight and
ability give him a rank next to Hamilton among the able men who
have presided over the national finances. Gallatin made a strong
report in 1809, recommending that the charter of the bank be
renewed upon its expiration in 1811, with an increase of capital and
wider powers. A new charter was voted in the House, but the bill
was not acted on in the Senate, and before the next session the
opposition of the state bankers had rallied sufficient strength to
defeat the recharter. The second United States Bank was authorized
in 1816, under the administration of Madison and with his approval,
but its career was terminated in 1836, as the result of the political
hostility of President Jackson.
It was not until after the grant of this second charter that the
question of the power of Congress to establish a bank came directly
before the Supreme Court in 1819. At the head of this court sat John
Marshall, who next to Hamilton, perhaps, did more than any other
man to strengthen and extend the powers of the general
government. The jealousy of the state banks had led the State of
Maryland to impose a discriminating tax on the Bank of the United
States. If the right to levy such a tax had been admitted, the Bank
would have been completely at the mercy of the states, and one of
the chief purposes of its creation would have been defeated. In
order to sustain the right of the bank to exemption from taxation, it
was necessary to prove that it was a constitutional instrument of
federal power. Hence the question of the power of Congress to
create such a corporation came directly before the court.
Hamilton found the power to create a bank partly in the preamble to
the Constitution, which declares that the people of the United States
have adopted it in order to "promote the general welfare," but more
particularly in that concluding phrase of the clause defining the
powers of Congress, which declares that that body shall have
authority "to make all laws which shall be necessary and proper for
carrying into execution the foregoing powers, and all other powers
vested by this Constitution in the government of the United States or
in any department or officer thereof." Marshall, in the series of great
decisions by which he strengthened the power of the Union, often
made use of these provisions to justify his reasoning. In one of the
most famous of these decisions (McCulloch vs. Maryland), he
sustained the constitutionality of the bank as an instrument of
federal power and denied the right of the states to levy upon its
property. He declared that the power to tax involved the power to
destroy, and that if the federal government had not the power to
withdraw its creations from discriminating legislation by the states,
the latter might tax the mail or the mints, the papers of the custom-
houses, or the forms of judicial process.
The view of Hamilton regarding the power of the federal government
to create a bank was thus sustained in emphatic terms by the
highest court in the land. It was partly his policy in providing for the
bank and demonstrating its usefulness, with his other measures to
develop the powers of the central government, which made possible
the decisions of Marshall. If the question of the right to incorporate a
bank could have been brought before the court at the beginning,
before the institution had proved its value, and if men like Jefferson
and Madison had been upon the bench, there is at least room for
doubt whether a decision would have been rendered in favor of a
power which is not granted directly to the government by the
Constitution. But by the resolute executive policy of Hamilton and
the broad judicial constructions of Marshall, the functions of the new
government were extended to all those great objects necessary to
create a vigorous and united nation.
The many other measures of Hamilton were directed by the same
singleness of purpose to strengthen the hands of the government
and consolidate the Union. The report on the mint followed the
previous reports of Jefferson in recommending the adoption of the
dollar as the unit of value. Hamilton observed that "upon the whole,
it seems to be most advisable, as has been observed, not to attach
the unit exclusively to either of the metals; because this cannot be
done effectually, without destroying the office and character of one
of them as money, and reducing it to the situation of a mere
merchandise." He believed, however, that care should be taken to
regulate the proportion between the metals with an eye to their
average commercial value. He pointed out the danger of
undervaluing either metal, and the inevitable result, in case of a
difference of ratio in two countries, "if other things were equal, that
the greatest part of the gold would be collected in one, and the
greatest part of the silver in the other."
This discussion of the subject took place at a time when monetary
principles were not very well fixed, when the standard and the state
of the currency had hardly been settled on an orderly basis in any
country, and when the means of transportation for the precious
metals were much slower and less efficient than under modern
conditions, and the cost was much greater. Hamilton endeavored to
find the true commercial relation between gold and silver as a basis
for the coinage values, in the hope that this would not change
sufficiently to upset a bimetallic system founded upon such a basis.
He was not a victim of the delusion that government can arbitrarily
give value by law to money, but declared, "There can hardly be a
better rule in any country for the legal, than the market proportion;
if this can be supposed to have been produced by the free and
steady course of commercial principles."
The report on manufactures and the bill providing for an excise were
parts of the project of Hamilton for building up a vigorous and self-
supporting nation. The report on manufactures was not presented to
Congress until the beginning of the long session at the close of
1791, and was not carried out in legislation. It consisted chiefly of an
argument for the encouragement of young industries in an
undeveloped country. Hamilton strongly favored the diversification of
the industries of the country between agriculture and various forms
of manufacture, because he believed it would contribute to the
solidity of the industrial system and to the financial independence of
the United States. His conception of the best method for promoting
American industries differed materially, however, from more recent
developments of the protective system. He recommended bounties
and premiums in many cases in preference to protectionist customs
duties, in order to avoid the rise in the price of articles to the
consumer which often results from such duties. The customs duties
which he proposed, moreover, ranged only from seven and a half to
fifteen per cent., and the latter rate was to be levied on only a few
articles.
The country was not yet ripe for extensive industrial enterprises. The
manufactures then existing were chiefly for supplying local needs,
the factory system had not been introduced, and the capital had not
been accumulated for the creation of large establishments. The
country needed many foreign manufactured articles to put it upon
the highroad to industrial development, and it was at a much later
period that the manufacturing interests acquired the power which
enabled them to increase the scale of duties. When this time came,
they turned to the arsenal of Hamilton's report for weapons in
support of the policy of diversifying industries; but they used these
weapons in behalf of a scale of duties which was not recommended
by him and they ignored his arguments for premiums and bounties
for the protection of the consumer against excessive prices.
Whether Hamilton would have favored the policy of protection in its
later developments, it is useless to inquire. It is idle to claim for any
thinker of the past that he anticipated all future discoveries and
reasoning in the fields of politics or economics. It is not necessary, in
order to give a statesman a high place in history, to worship blindly
all that he did or said or to make such deeds and words an authority
for later generations. What can be said of Hamilton without
reasonable ground of denial is that he did not recommend in any of
his writings the high scale of duties advocated by some
protectionists in recent years. On the contrary, he urged a scale of
duties which would be treated by the protectionist of to-day as
below even the level of a "tariff for revenue only." That his ideas
were far from extreme is indicated by the project which he drew up
in 1794 for a reciprocity treaty with Great Britain, which proposed to
limit American import duties on the leading textiles and
manufactured articles of metal to ten per cent. of their value. He
even criticised Jefferson's message of 1801 for recommending the
repeal of the internal revenue taxes, upon the ground that the duties
on imports were high and that if any taxes were to be repealed, they
should be those which weighed on commerce and navigation.
A measure which led to more immediate results than the report on
manufactures was the report on the excise. Hamilton found it
necessary, in order to obtain sufficient funds to meet the interest on
the debt and other charges, to recommend an excise tax upon
distilled liquors produced in the United States. The bill passed
Congress in January, 1791, and was soon put in force. Violent
resistance was made in western Pennsylvania, where the
manufacture of whiskey was more extensively carried on than in any
other part of the Union. The federal collector for Washington and
Allegheny was tarred and feathered, and deputy marshals did not
dare serve writs against those guilty of the outrage. Washington's
journey through the South had a good effect in softening the
opposition to the law, which first showed itself in Virginia and North
Carolina; but in Pennsylvania conditions went from bad to worse,
until it became necessary to give the federal government additional
powers for collecting the tax and putting down insurrection. Masked
mobs terrorized those who were inclined to obey the law, and forced
them to publish the injury done to their stills. In order to protect
themselves by embroiling the whole community, some of the
insurgent leaders had the mail stopped, the militia called out on their
side, and threatened to lay Pittsburg in ashes (July, 1794).
The opportunity had come for testing the question whether the
Union was strong enough to put down rebellion by force. It was an
opportunity which Hamilton did not shirk. At his earnest solicitation,
an army was dispatched to the disturbed districts. Washington
showed no hesitation in supporting the authority of the federal
government. He obtained a certificate from a judge of the Supreme
Court, setting forth that the laws of the United States were set at
naught and that the courts were unable to enforce them. He then
issued a proclamation commanding the insurgents to submit to the
laws, and made a requisition for 12,950 militia from Pennsylvania,
Maryland, Virginia, and New Jersey, to move on September 1, 1794,
towards the disaffected districts.
The firmness of Washington put an end to the insurrection. Governor
Mifflin of Pennsylvania, who had hesitated to put down the
disturbances by the strong hand of the state, recovered his courage,
and aided the federal government by proclamations and by his full
quota of troops. Hamilton accompanied the army as it moved
towards the West, and remained with it after Washington turned
back to attend the opening of Congress. The strong display of force
made by the government overawed the insurgents and finally
compelled their submission. Albert Gallatin, although a citizen of the
disaffected section and an opponent of the party in power, exerted
his influence on behalf of order. Negotiations were set on foot
between commissioners of the President, and a committee of
citizens, of which Gallatin was a member. When this committee met
to decide whether they would recommend compliance with the law,
they were surrounded by riflemen who were ready to shoot if their
leaders showed signs of yielding. But they adopted the clever device
of a ballot upon which both yea and nay were written, with the
option of destroying either word. A small majority voted to submit.
Some of the obstinate spirits held out, but as the people fell away
from them, they were arrested and put on trial, and the authority of
the federal government was no longer disputed.
This suppression of the "Whiskey Rebellion," as it was called, was
one of the most important steps in the consolidation of the Union.
Many who had observed the aggressive and comprehensive projects
of Hamilton, and seen them daily binding closer the bonds of union,
did not believe that they would stand the test of armed conflict.
They feared that the power of the government would wither and the
people split into warring factions when men were called upon to
march in arms against their fellow-citizens. The event proved that
the new government had vindicated its right to exist, and that the
sentiment of union was daily gaining a stronger hold upon the hearts
of the people. That this new power had not only built up a cohesive
financial system, but had shown its capacity to put down resistance
to its lawful authority with a strong hand, was largely the work of
Hamilton. It may be said that it was wholly his work, so far as any
great national policy can be projected and carried out by a single
man, independently of the support of his associates in the
government and of the body of public opinion which make possible
the execution of his plans.
The time had come when Hamilton felt that his constructive work
was done. He withdrew from the cabinet (January 31, 1795), and
Oliver Wolcott of Connecticut was appointed his successor. Hamilton
chose the moment for retiring from office with a tact and judgment
unusual with public men. He was moved partly by the desire to
provide for his family upon a more liberal scale than his modest
salary under the government permitted. He was too patriotic,
however, to have abandoned his post until he felt that his
constructive work was complete. It was with conscious satisfaction
that in his report on the public credit at the beginning of 1795 he
was able to marshal the measures already taken towards restoring
order to the national finances and point out their results. The credit
of the country had been raised from the lowest abyss of dishonor to
that of the most enlightened nations of the old world; an adequate
system of taxation had been provided for meeting the public
obligations; the business interests had been knit together in support
of the government by a national bank; a monetary system had been
established; the Treasury had been organized in its various branches
upon a basis which has survived to our day; and finally the strength
of the fabric of the Union and of the financial system had been
subjected to the test of a rebellion which, without serious bloodshed,
but with a strong display of force, had been fully and firmly
subdued.
VI
FOREIGN AFFAIRS AND NEUTRALITY

The comprehensive measures of Hamilton for strengthening the


Union gave a definite character and policy to the Federalist party.
The foundations of this party had been laid by the struggle over the
question whether the Constitution should be accepted by the states;
but the measures of Hamilton were too strong for some of the
friends of the Constitution, and many changes occurred in the
temporary groupings of political leaders before a definite dividing
line was established between the Federalism of Hamilton on the one
side and the Democracy of Jefferson and Madison on the other.
These two eminent Democratic leaders had, indeed, been among the
most earnest supporters of the Constitution. Madison went farther
than Jefferson in the direction of Federalism, and encountered the
distrust of the states-rights element at home; but Jefferson, as has
been already seen, made several reports in the Continental Congress
in favor of declaring the United States a nation, and was the cordial
promoter of those important steps towards union,—the transfer of
the Western territory to Congress and the adoption of a common
monetary system.
The plans of Hamilton in regard to the finances, however, and his
resolute policy of neutrality between France and Great Britain, ran
counter to the views of Jefferson. It is not surprising, therefore, that
the latter found himself pitted against the great Federalist leader
upon nearly every question of importance which came before the
cabinet. The feeling that he had been duped in regard to the
assumption of the state debts found vent in many complaints, which
finally bore fruit in open attacks upon Hamilton, at first made
indirectly through a clerk in the government service, and then
directly in a long letter to Washington. Jefferson gave the post of
translating clerk in the State Department to a Frenchman, Philip
Freneau, who published a journal known as the "National Gazette."
In this journal Freneau began a series of bitter and sometimes well-
directed attacks upon the measures of the administration, and
particularly those of Hamilton. A friend of Jefferson in Virginia,
Colonel Mason, approached Washington in the summer of 1791, and
made a long and severe criticism upon the Treasury measures and
their effect upon the people.
Washington continued to stand above party, and sought to mitigate
the friction between his cabinet officers. Where the judgments of
Hamilton and Jefferson differed on constructive measures, however,
Washington in nearly every case became convinced of the wisdom of
the recommendations of Hamilton. He therefore had the appearance
of leaning to his side, although he often mitigated the sharpness of
the arguments of his vigorous young minister of finance and
endeavored to temper his excess of zeal. After listening to Mason,
Washington felt that the time had come to interpose in the growing
hostility between his cabinet ministers. He submitted a brief
summary to Hamilton of the criticisms which had been made upon
his projects and asked him to submit a statement in reply. The
charges were directed not only against the substance of the financial
measures, but declared that they fostered speculation, corrupted
Congress through the ownership of the public debt by members of
that body, and that Hamilton was laboring secretly to introduce
aristocracy and monarchy.
It was not difficult for Hamilton to brush away most of these
criticisms. This he did in the cool, logical manner of which he was a
master by numbering each objection to his policy and measures and
showing that it was not founded upon solid reasoning or fact.
Hamilton would have done well to have rested his case upon his
letter to Washington, but he was now convinced that Jefferson was
behind the attacks upon him, and he determined to strike back. He
began a series of anonymous communications through the Federalist
organ, "Fenno's Gazette," which showed all his usual vigor and force
of reasoning, but which only intensified the bitterness in the cabinet.
President Washington was deeply disturbed by this open outbreak of
hostilities, and remonstrated by letter with both Hamilton and
Jefferson. Hamilton suspended his attacks, while Jefferson confined
his hostility to less open methods.
When Congress met at the close of 1791, Giles of Virginia, a loud-
spoken, hot-headed member of the House, called for accounts of the
various foreign loans made by the government. An attempt was
made to prove corruption in the management of the Treasury.
Hamilton could not have found a better opportunity for defending
himself, if he had sought it. He was no longer shut up to the
unsatisfactory methods of unsigned communications through
newspapers, but was in a position to speak openly and boldly in
exposition and defense of his measures. Report after report was sent
to Congress, setting forth the operations of the Treasury with a
lucidity and power which silenced the opposition and almost
overwhelmed Madison, who had been forced as a party leader to
accept the responsibility for the attacks. The reports, to any one who
understood the subject, were absolutely convincing of the soundness
and wisdom of Hamilton's measures.
Jefferson, perhaps, had some right to complain of the influence
which Hamilton exerted over that department of the government
which properly belonged under his exclusive jurisdiction. This was
the management of foreign relations. Hamilton had such definite and
well-considered views on foreign policy as well as finance that he
could not forbear presenting them in the cabinet. His superiority in
definiteness of aim and energy no doubt led him to believe that he
was fitted for the functions of prime minister and that he was
justified in exercising them as far as he could. The course of
Washington encouraged him to the extent that the President often
gave the preference to his views over those of Jefferson, but it was
far from the purpose of the President to make any distinction in rank
or in his confidence between his ministers. Hamilton, although an
admirer of the British political system, permitted himself few
prejudices in his theory of the foreign policy of the United States.
Though often charged with British sympathies, he leaned much less
towards Great Britain than Jefferson, through his admiration of the
spirit of the French Revolution, leaned towards France.
The foreign relations of the country began to become acute with the
outbreak of war between England and France in 1793. France had
already abolished royalty, expelled the nobles, sent Louis XVI. to the
scaffold, and was on the eve of the terrible massacres which did so
much to revolt even her best friends outside the country. The news
of war reached the United States early in April, 1793. News came
also that a minister from the French Republic had landed at
Charleston and would soon present his credentials at Philadelphia.
Hamilton sent post haste for Washington, who was at Mount Vernon.
The outbreak of war meant danger to American commerce on the
ocean and the risk of trouble with both powers over the neutrality
laws. The serious question confronting the American government
was whether they should maintain strict neutrality between the
belligerents or should side with France, to whom they were bound
by the treaties made with her when she came to the rescue of the
colonies. When Washington reached Philadelphia, he found both
Jefferson and Hamilton ready with suggestions for meeting the
crisis, but these suggestions differed widely. Jefferson, although not
an advocate of war against England, believed that Congress should
be called together in extra session to deal with the emergency.
A stronger programme was urged upon the President by Hamilton.
He regarded the question of neutrality and the reception of the
French envoy as one for the executive rather than for Congress. He
believed also that these subjects would be safer in the hands of
Washington than midst the passions of a legislative body. He drew
up a statement, embodying a series of questions regarding the
policy of the United States, which was laid by Washington before the
cabinet. The first question was whether a declaration of neutrality
should be issued. This was decided in the affirmative, and the
proclamation was soon issued by Washington. It was decided that
the French minister, Genet, should be received, but that early
occasion should be taken to explain to him that the United States did
not consider themselves bound by the treaties to plunge into war in
behalf of France. While it was admitted by Hamilton that it would not
be the province of the United States under ordinary circumstances to
cavil over the character of the government in France, but would be
their duty to accept the government which existed, nevertheless, the
extraordinary events which had taken place at Paris justified a
certain reserve towards the revolutionary powers.
Entirely apart from the changes in the character of the French
government, it was felt by Hamilton that the time had come to give
an interpretation to the early treaties in harmony with a more
unchallenged independence for the United States, and a more
complete separation from the intrigues of European politics. The
radical character of the Revolution in France, and the action of the
French government itself, gave an excuse for an interpretation of the
treaties which otherwise might not have been found without
blushing. The treaties provided for a defensive alliance with France,
and it was promptly decided by the cabinet that the war of France
against Great Britain was not defensive. Hamilton proposed not only
to revise the treaties, but to resist by the utmost efforts of the
federal government the enlistment of men and the fitting out of
privateers in America in aid of the French. He did not propose, as
some of the friends of France would have desired, that the
proclamation of neutrality should be only a mask for underhanded
aid to that country.
The situation was made as difficult as possible for the government
by the hot temper and indiscretions of the new French minister.
These qualities in him were encouraged by the reception which he
received on the way from Charleston to Philadelphia. He was
everywhere welcomed with such enthusiastic demonstrations of
sympathy for France as tended to make him believe that he was
something more than the diplomatic representative of a foreign
country, and could safely interfere in the politics of the United
States. As he approached Philadelphia (May 16, 1793) he found
Captain Bompard of the French frigate L'Ambuscade ready to fire a
salute of three guns, and men on swift horses posted along the road
to give notice to the citizens of his coming.
Genet had no sooner landed at Charleston than he began to fit out
privateers to prey upon British commerce. The Ambuscade herself,
which brought Genet to Charleston, seized several English merchant
vessels on her way to Philadelphia, and crowned her insolence to the
United States by seizing an English vessel, the Grange, within the
Delaware capes, in the jurisdiction of the United States. The Grange
was restored to her owners, but her seizure was only one of many
flagrant violations of international law which were systematically
carried out by the French, and which were defended and often
planned by Genet. When the Polly was stopped from leaving New
York fitted out for a French privateer, Hauterive, the French consul,
addressed a note to Governor Clinton, telling him it was not in a land
where Frenchmen had spilled their blood that they were to be thus
harassed. When the Little Sarah was fitted out as a privateer in
Philadelphia, Hamilton and Knox urged that a battery be placed on
one of the islands and that the vessel be fired upon if she attempted
to leave the harbor. Jefferson was hoodwinked by assurances from
Genet that the vessel would not sail, and himself indulged in some
glittering talk against the United States joining in "the combination
of kings against France." The vessel at once put to sea, and
Washington was so indignant that Jefferson was almost driven to
resignation.
Hamilton had a more direct interest officially in the demands of
Genet for money which was owed to France. Genet not only asked
for the anticipation of payments soon to mature, but insisted that he
should receive the whole amount of the debt. He threw a bait to
American sentiment by the suggestion that the money would be
spent in the United States for provisions and supplies. Hamilton
treated his rude demands just as he would those of any other
creditor. He was willing to anticipate certain payments when the
Treasury resources justified it, but absolutely refused to do more.
Genet then threatened to pay for what he bought with drafts upon
the Treasury. Hamilton coolly retorted that the drafts would not be
honored. The Frenchman was compelled to consume his wrath, not
exactly in silence, but without result upon the government.
Genet, encouraged by some of the enemies of the administration,
succeeded in working up a strong pro-French sentiment in various
parts of the country. At a dinner in Philadelphia, following his arrival,
songs were sung to France and America, and the red cap of liberty,
which had been forced upon the reluctant head of Louis XVI. in the
great demonstration of the preceding August at the Tuileries, was
passed around the table and successively worn by each of the
American guests. Hamilton, who never had much confidence in pure
democracy, went close to the other extreme in his alarm over these
signs of public opinion. He felt compelled in the summer of 1793 to
publish a series of essays signed "Pacificus," defending the policy of
the administration. These papers, in the language of Mr. Lodge,
"served their purpose of awakening the better part of the community
to the gravity of the situation, and began the work of rallying the
friends of the government to its active support." Genet addressed
such offensive letters to the Department of State, and his conduct
became so intolerable, that the cabinet agreed to send the
correspondence to Paris and ask for his recall. Genet himself
published a letter which revealed his insolence to the public, and
caused a revulsion of sentiment which brought the more sober men
of all parties to the side of Washington. Genet's course was run, and
in February, 1794, his successor came out from France.
Hamilton soon had opportunities for proving that his policy of
neutrality was directed as much against English as against French
aggression. When Great Britain issued the first Orders in Council,
directing the seizure of all vessels loaded with French produce,
Hamilton declared the British order an outrage, and urged the
fortification of the seaports and the raising of troops. He exerted
himself, however, to restrain popular passion and preserve peace. He
suggested to Washington that a special mission be sent to London to
treat with the British government. The idea was cordially accepted
by Washington. He desired to send Hamilton, but the Virginia party,
headed by Madison and Monroe, strongly opposed the appointment.
They were embittered by recent party conflicts, and regarded
Hamilton as too friendly to British interests. Chief Justice John Jay of
New York was then recommended by Hamilton for the mission.
Opposition was made even to Jay, but the nomination was confirmed
(April 19, 1794), and Hamilton himself drew the outline of the
instructions with which Jay sailed from New York.
The conflict over the treaty which Jay brought back in the following
winter was one of the most bitter ever waged in American politics.
The contracting parties to the treaty—the United States and Great
Britain—looked at the situation from widely different points of view.
Jay secured the promise of the withdrawal of the British troops from
the frontier posts and an agreement to compensate Americans for
losses through British privateering. The last was an important
concession, because it covertly admitted the British position in
regard to privateering to be in conflict with international law. Some
important commercial concessions were also made by Great Britain,
which were regarded at London as purely gratuitous. But the treaty
failed to secure any compensation for the claims of American citizens
for negroes and other property carried away by the British troops,
and American vessels were forbidden carrying to Europe from
English ports or even from the United States coffee and the other
chief colonial products. Among the latter was named cotton, which
was then just becoming a large element in the production of the
South.
Hamilton himself is said to have characterized the treaty as "an old
woman's treaty," when he first read it, but it soon became evident
that it must be accepted substantially as presented, if war was to be
avoided. Washington called the Senate in extra session in June,
1795, and after two weeks' debate in secret session the treaty was
ratified by exactly the necessary two thirds vote,—twenty to ten. It
was not until the adjournment of the Senate that the contents of the
document reached the public through Senator Mason of Virginia. The
news was followed by town meetings all over the country
demanding that President Washington refuse to exchange
ratifications. So intense was the feeling that a vessel suspected of
being a British privateer was seized and burned at Boston, a great
meeting in Faneuil Hall ordered a committee to take a protest to
Philadelphia, and Hamilton himself was stoned and refused a hearing
at a meeting in New York. But Washington remained calm. Hamilton,
as the responsible leader of the party, took up the cudgels for
ratification. He submitted an elaborate argument to the cabinet (July
9, 1795), and with an amendment which the Senate recommended
and Great Britain accepted, the treaty went into operation.
VII
HAMILTON AS A PARTY LEADER

The ratification of the Jay treaty did much to shake the power of the
Federalists, and for a moment seemed to threaten their ruin. It was
divisions in their own ranks, however, which contributed as much to
this event as any real blunders in public policy. Hamilton was not at
his best in conciliating those who differed from him, and he did not
encounter a more yielding or tactful associate in John Adams.
Hamilton had gone out of his way with little reason at the first
presidential election, in 1788, to secure votes against Adams. His
avowed object was to insure the election of Washington by
preventing a tie vote between Washington and Adams. The original
Constitution authorized each elector to vote for two persons for
President and Vice-President, without designating the office for
which either was voted for. This led to complications which were
corrected by an amendment after the election of 1800. In the case
of the first election, however, few sane men doubted that
Washington would have the majority of the votes, and the only
effect of the intrigue of Hamilton was to reduce the vote for Adams
to a point which almost caused his defeat. Hamilton supported
Adams in the second election, in 1792, and the relations between
the two men were reasonably cordial.
When Washington retired from the presidency, in 1797, the
commanding men in the Federalist party were Hamilton, John Jay,
Thomas Pinckney, and John Adams. Hamilton was the controlling
mind in the consultations of the leaders rather than the sort of man
who appealed to the people. He was not seriously thought of by
himself or others as a candidate for President. Jay was barred by the
odium attaching to the treaty with Great Britain. The choice was
therefore reduced to Pinckney and Adams. Most of the leaders were
for Adams, who was superior to Pinckney in Revolutionary services
and ability. It was determined that the Federalist electors should
vote for both Adams and Pinckney, with the purpose of choosing the
former for President and the latter for Vice-President. Hamilton on
this occasion urged that all the Federalist electors should vote for
both Adams and Pinckney. If each had received an equal number of
votes, the choice would have been thrown into the House and
Adams would probably have been elected. Hamilton erred in letting
it be known that he was indifferent whether the outcome was
favorable to Adams or Pinckney, especially when there was a strong
suspicion that he was really for Pinckney. Party discipline had not
then reached its modern development, and votes were thrown away
by Federalist electors,—in the North to prevent a majority for
Pinckney over Adams and in the South to prevent the same chance
in favor of Adams.
The result of these jealousies was that Adams barely escaped
defeat. He was chosen by a plurality of three, but Pinckney was
beaten, and Jefferson, having the next highest vote, was elected
Vice-President. Adams became firmly convinced that Hamilton was
his personal enemy and would stop at nothing to injure him. That
Hamilton was recognized by all the party leaders as the master mind
and the guiding spirit of the party made no difference to a man of
the hot temper and resolute spirit of John Adams. Tact and
conciliation were as far removed from his nature as from that of any
American public man. The indifference of Hamilton whether he was
beaten by Pinckney, in connection with Hamilton's intrigue in 1788,
had convinced Adams that Hamilton did not feel proper respect for
him, and that he was seeking to dictate the policy of the
administration and to thwart and degrade him. Adams resented any
sort of suggestion or consultation, and took delight in disregarding
the suggestions of Hamilton, while the latter struck back through
several members of the cabinet, who were more in sympathy with
him than with the President.
The country having escaped the danger of immediate war with
England by the Jay treaty, was soon threatened with war with
France. Monroe had been recalled as American Minister at Paris and
Charles Pinckney, who was sent in his place, had been refused a
reception. Some of the Federalists were so incensed against France
that they were eager for war. Hamilton was opposed to war if it
could be avoided, but was in favor of a resolute policy. Adams,
although as far as possible from sympathy with France, believed
every reasonable effort should be made to preserve peace. It was
decided, with the approval of both Adams and Hamilton, to send a
commission of three to Paris, to negotiate. Over the appointment of
this commission new differences broke out between Hamilton and
the President. Hamilton favored the appointment of a Northern and
a Southern Federalist and of a Democrat of the highest standing, like
Madison or even Jefferson. Adams was at first disposed to make
these appointments, but finally took both the Federalists from the
South,—Pinckney of South Carolina and John Marshall of Virginia,—
and selected as the third member a Democrat of comparatively
minor standing, Gerry of Massachusetts.
The commissioners accomplished little good at Paris. They were
insulted and browbeaten and told that only bribery would secure
what they desired. When their treatment became known in the
United States, in the spring of 1798, there was a popular outburst
which restored the Federalists to power in Congress in the following
autumn, with a larger majority than ever before since party divisions
became fixed. Enthusiastic addresses poured in upon President
Adams, war vessels were fitted out by private subscription, and bills
were carried at once for a provisional army, for fortifications, and for
the increase of the navy. Even under this stress of excitement,
however, Hamilton opposed alliance with Great Britain, and
persuaded Pickering, the Secretary of State, to abandon the
advocacy of it.
It was over the organization of the new army that the hostility of
Adams to Hamilton became open and bitter. Washington was
selected as commander-in-chief, but only consented to serve upon
the condition that he should have the choice of the officers who
were to rank next him, and should not be called upon to take an
active part until the army took the field. He recommended to the
President that rank in the Revolutionary army be disregarded and
that the three major-generals to be appointed should be Hamilton,
Charles Pinckney, and Knox. This gave the practical command and
the work of the organization to Hamilton. Adams sent the names to
the Senate, in the order suggested by Washington, and they were
promptly confirmed. When he came to signing the commissions,
however, he took the ground that Knox was the senior officer on
account of his rank during the Revolution. Hamilton would not
consent to this arrangement, and all the Federalist leaders, including
members of the cabinet, remonstrated with the President against it.
One of the saddest results of the quarrel was the alienation from
Hamilton of Knox, who had been a friend of many years and when
Secretary of War in Washington's first cabinet had stood loyally by
Hamilton against Jefferson in the controversy over the financial
projects.
Adams at first seemed to grow more stubborn with the protests
which were made against his action. The leaders finally turned to
Washington. The latter informed the President that if the original
agreement as to the rank of the officers was not kept, he should
resign. Adams, with all his stubbornness and bravery, did not dare
defy the country by forcing Washington from the service. He gave
way, and appointed Hamilton to the first place, but the good feeling
which might have been promoted if he had done so at first was
replaced on both sides by bitterness which was never softened.
Hamilton, as the practical head of the army, showed the same
abounding energy and capacity for organization which he had shown
at the head of the Treasury. He drafted a plan for the fortification of
New York harbor, made an apportionment of officers and men
among the states, and drew up projects for the organization of the
new army, dealing with the questions of pay, uniforms, rations,
promotions, police in garrisons and camps, and the many other
branches of the service. All these projects received the cordial
approval of Washington. When Congress met, Hamilton was ready
with a bill putting the army upon a basis which would permit its
increase or diminution in future without changing the form of the
organization. In the spring of 1799 he was providing for the defense
of the frontiers and planning the invasion of Louisiana and the
Floridas.
The projects of these invasions of Spanish territory justify a
reference to the continental policy of Hamilton. He was among the
first to maintain that the United States should have complete control
of the valley of the Mississippi, and even during his short term in the
Congress of the Confederation the last resolution which he
presented declared the "navigation of the Mississippi to be a clear
and essential right and to be supported as such." It was left for
Jefferson, Hamilton's great opponent, to carry out his conception of
the acquisition of the Mississippi valley by the purchase of Louisiana.
The admirers of Hamilton credit him with a still wider vision of the
future power of the United States, which was eventually to bear fruit
in the Monroe doctrine and in the celebrated declaration of Secretary
Olney in 1895, that "to-day the United States is practically sovereign
on this continent, and its fiat is law upon the subjects to which it
confines its interposition." Hamilton wrote in "The Federalist," before
the adoption of the Constitution, that "our situation invites and our
situation prompts us to aim at an ascendant in American affairs."
The firm attitude of the United States towards France had its effect
at Paris. Talleyrand sent an intimation indirectly to President Adams
that the French government would be glad to receive an American
envoy. Again the impetuosity of Adams divided his party and
intensified his quarrel with the leaders who stood around Hamilton.
The name of Vans Murray was sent to the Senate by the President
for Minister to France, without even consulting the cabinet. Many
doubted the wisdom of snapping up so promptly the offer made by
Talleyrand, and more were incensed at the President's method of
doing it. There was at first a strong disposition among the Federalist
leaders to defeat the nomination in the Senate. Hamilton, however,
checked the indignation of his friends and suggested a way out of
the difficulty by appointing a strong commission.
The downfall of the Federal party and the retirement of Hamilton
from the active control of national policy were at hand. The passage
of the alien and sedition laws, arrogating to the federal government
intolerable powers of interference with the rights of the press and of
free speech, was one of the causes contributing to the revulsion of
feeling in favor of the party of Jefferson. Hamilton opposed the first
drafts of these laws as cruel, violent, and tyrannical, but he did not
disapprove their final form. The Federalists carried the congressional
elections of 1798, under the impulse of the feeling against France,
but began to lose ground soon after. As the presidential election of
1800 approached, a desperate struggle was made to hold New York
for Federalism as the only hope of defeating Jefferson and reëlecting
Adams. The New York election went against the administration, and
Hamilton pleaded in vain with Governor Jay to defeat the will of the
people by calling the old legislature together and giving the choice of
presidential electors to the congressional districts. It was perhaps
the most discreditable proposal which ever came from Hamilton, and
was promptly rejected by Jay.
Hamilton's motive was a sincere fear that the country would go to
ruin and the Constitution be endangered by the triumph of the
political school of Jefferson. This might have been the case if it had
been the first election under the Constitution, but Hamilton himself
had builded better than he knew. The financial projects, the national
bank, the suppression of the "Whiskey Insurrection," and the other
measures taken under Washington and Adams had built up a Federal
Union, whose strength could not be seriously shaken by the transfer
of power from one party to another.
With the shadow of defeat hanging over them, the course of the
Federalist leaders seemed to justify the maxim, "Whom the gods
destroy they first make mad." With the utmost need for harmony
and unity, quarrels broke out which would have wrecked the party
even if there had been otherwise some prospect of its success.
Adams drove McHenry and Pickering from his cabinet because they
had betrayed his secrets to Hamilton, and denounced Hamilton and
his friends as a British faction. Hamilton asked in writing for a denial
or explanation of the charge, but was treated with contemptuous
silence. As the presidential election approached, Hamilton scarcely
concealed his preference for Pinckney, who was again to be voted
for by the electors along with Adams. Hamilton had been so badly
treated by the President that he announced his purpose to prepare a
pamphlet, exposing the failings of Adams and vindicating his own
position.
His best friends stood aghast at the project and labored with him to
abandon it. Hamilton persevered, however, in the preparation of the
pamphlet. He denounced Adams as a man of disgusting egotism,
intense jealousy, and ungovernable temper, and reviewed in a
scathing manner his entire public career, and especially the recent
dismissal of the secretaries who were friendly to Hamilton. After all
this criticism, Hamilton wound up with the lame conclusion that the
electors should vote equally for Adams and Pinckney, in order to
preserve Federal ascendency. He yielded to the protests of his
friends so far as to keep the circulation of the pamphlet within a
small circle, but it was hardly off the press before a copy was in the
hands of Aaron Burr, the Democratic leader in New York, and was
used with effect against the Federalist President.
The downfall of Federalism came with the presidential election of
1800. Jefferson and Burr were the Democratic candidates for
President and Vice-President. Each was voted for by all the
Democratic electors, giving them an equal number of votes and a
majority of the electoral college. This threw the election into the
House of Representatives, which was Federalist but was compelled
by the provisions of the Constitution to decide between the two
leading candidates, Jefferson and Burr. Some of the Federalists were
ready to stoop to any means for striking at Jefferson, the great
representative of Democratic ideals. If the Federalists in Congress
could have effected a combination with the Democrats from states
where Burr was influential, they might have been able to elect Burr
President instead of Jefferson. But the Democrats, even from New
York, voted for Jefferson, and it was evident that he must be chosen
or there would be no election. Feeling in the country ran high, and
there were threats of violence if the election of Jefferson should be
defeated by intrigue.
Hamilton behaved on this occasion with the high sense of public
duty which marked most of his acts. Familiar as he was with the
unscrupulous methods and doubtful character of Burr in New York
politics, he felt that it would be criminal to put him in office. He had
little reason to love Jefferson, who had filled the ears of Washington
with slurs against himself, but he felt that the election belonged to
Jefferson and that his defeat by a political intrigue would be a
greater menace than his election to the system established by the
Constitution. With Bayard of Delaware, the Federalist leader in the
House, Hamilton threw himself strongly into the contest against Burr.
His advice was not at first followed. The House ballotted from the
eleventh to the sixteenth of February without reaching a choice. A
caucus of the Federalists was then held; it appeared that Jefferson
had given some assurances of a conservative policy in office, the
views of Hamilton and Bayard prevailed, and on February 17, 1801,
the Federalist members from several states withheld their votes, and
Jefferson was elected.
The retirement of the Federalists from power substantially ended the
public services of Hamilton. He continued to watch public events
with interest during the remaining five years of his life, and to be
regarded as the leader of the Federalist party, but the party had
shrunk to a corporal's guard in Congress and the long reign of the
Democratic party had begun, which was to be interrupted during
only two presidential terms until the election of Lincoln in 1860.
Hamilton, therefore, at the age of forty-three, had completed his
constructive work and ceased to influence public affairs except by
his writings and speeches. It might almost be said that this work
was done with the close of the administration of Washington in
1797, and that his great fame would have shone with brighter lustre
if he had not lived to take part in the later differences and quarrels
of the Adams administration. His life was not without service,
however, under Adams, since his influence over members of the
cabinet several times restrained rash policies, and between the
conflicting passions of the champions of France and of the friends of
Great Britain, kept the ship of state steady upon a safe course.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like