Introduction to Computation and Programming Using Python, Third Edition John V. Guttagpdf download
Introduction to Computation and Programming Using Python, Third Edition John V. Guttagpdf download
https://ebookmass.com/product/introduction-to-computation-and-
programming-using-python-third-edition-john-v-guttag/
https://ebookmass.com/product/engineering-computation-an-introduction-
using-matlab-and-exce-2nd-edition-musto/
https://ebookmass.com/product/introduction-to-computing-and-
programming-in-python-global-edition-mark-j-guzdial/
https://ebookmass.com/product/introduction-to-computing-and-problem-
solving-using-python-1st-edition-e-balaguruswamy/
https://ebookmass.com/product/python-programming-using-problem-
solving-approach-1st-edition-reema-thareja/
Advanced Guide to Python 3 Programming, 2nd 2nd Edition
John Hunt
https://ebookmass.com/product/advanced-guide-to-
python-3-programming-2nd-2nd-edition-john-hunt/
https://ebookmass.com/product/introduction-to-responsible-ai-
implement-ethical-ai-using-python-1st-edition-manure/
https://ebookmass.com/product/programming-the-raspberry-pi-third-
edition-getting-started-with-python-simon-monk/
https://ebookmass.com/product/introduction-to-computing-using-python-
an-application-development-focus-2nd-edition-ebook-pdf-version/
https://ebookmass.com/product/solutions-manual-to-introduction-to-
robotics-mechanics-and-control-third-edition-john-j-craig/
Introduction to Computation
and Programming Using
Python
John V. Guttag
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.
This book was set in Minion Pro by New Best-set Typesetters Ltd.
10 9 8 7 6 5 4 3 2 1
d_r0
To my family:
Olga
David
Andrea
Michael
Mark
Addie
Pierce
CONTENTS
PREFACE
ACKNOWLEDGMENTS
1: GETTING STARTED
2: INTRODUCTION TO PYTHON
3: SOME SIMPLE NUMERICAL PROGRAMS
4: FUNCTIONS, SCOPING, AND ABSTRACTION
5: STRUCTURED TYPES AND MUTABILITY
6: RECURSION AND GLOBAL VARIABLES
7: MODULES AND FILES
8: TESTING AND DEBUGGING
9: EXCEPTIONS AND ASSERTIONS
10: CLASSES AND OBJECT-ORIENTED PROGRAMMING
11: A SIMPLISTIC INTRODUCTION TO ALGORITHMIC
COMPLEXITY
12: SOME SIMPLE ALGORITHMS AND DATA STRUCTURES
13: PLOTTING AND MORE ABOUT CLASSES
14: KNAPSACK AND GRAPH OPTIMIZATION PROBLEMS
15: DYNAMIC PROGRAMMING
16: RANDOM WALKS AND MORE ABOUT DATA
VISUALIZATION
17: STOCHASTIC PROGRAMS, PROBABILITY, AND
DISTRIBUTIONS
18: MONTE CARLO SIMULATION
19: SAMPLING AND CONFIDENCE
20: UNDERSTANDING EXPERIMENTAL DATA
21: RANDOMIZED TRIALS AND HYPOTHESIS CHECKING
22: LIES, DAMNED LIES, AND STATISTICS
23: EXPLORING DATA WITH PANDAS
24: A QUICK LOOK AT MACHINE LEARNING
25: CLUSTERING
26: CLASSIFICATION METHODS
PYTHON 3.8 QUICK REFERENCE
INDEX
List of figures
Chapter 1
Figure 1-1 Flowchart of getting dinner
Chapter 2
Figure 2-1 Anaconda startup window
Figure 2-2 Spyder window
Figure 2-3 Operators on types int and float
Figure 2-4 Binding of variables to objects
Figure 2-5 Flowchart for conditional statement
Figure 2-6 Flowchart for iteration
Figure 2-7 Squaring an integer, the hard way
Figure 2-8 Hand simulation of a small program
Figure 2-9 Using a for statement
Chapter 3
Figure 3-1 Using exhaustive enumeration to find the cube root
Figure 3-2 Using exhaustive enumeration to test primality
Figure 3-3 A more efficient primality test
Figure 3-4 Approximating the square root using exhaustive
enumeration
Figure 3-5 Using bisection search to approximate square root
Figure 3-6 Using bisection search to estimate log base 2
Figure 3-7 Implementation of Newton–Raphson method
Chapter 4
Figure 4-1 Using bisection search to approximate square root
of x
Figure 4-2 Summing a square root and a cube root
Figure 4-3 A function for finding roots
Figure 4-4 Code to test find_root
Figure 4-5 Nested scopes
Figure 4-6 Stack frames
Figure 4-7 A function definition with a specification
Figure 4-8 Splitting find_root into multiple functions
Figure 4-9 Generalizing bisection_solve
Figure 4-10 Using bisection_solve to approximate logs
Chapter 5
Figure 5-1 Two lists
Figure 5-2 Two lists that appear to have the same value, but
don't
Figure 5-3 Demonstration of mutability
Figure 5-4 Common methods associated with lists
Figure 5-5 Applying a function to elements of a list
Figure 5-6 Common operations on sequence types
Figure 5-7 Comparison of sequence types
Figure 5-8 Some methods on strings
Figure 5-9 Translating text (badly)
Figure 5-10 Some common operations on dicts
Chapter 6
Figure 6-1 Iterative and recursive implementations of factorial
Figure 6-2 Growth in population of female rabbits
Figure 6-3 Recursive implementation of Fibonacci sequence
Figure 6-4 Palindrome testing
Figure 6-5 Code to visualize palindrome testing
Figure 6-6 Using a global variable
Chapter 7
Figure 7-1 Some code related to circles and spheres
Figure 7-2 Common functions for accessing files
Chapter 8
Figure 8-1 Testing boundary conditions
Figure 8-2 Not the first bug
Figure 8-3 Program with bugs
Chapter 9
Figure 9-1 Using exceptions for control flow
Figure 9-2 Control flow without a try-except
Figure 9-3 Get grades
Chapter 10
Figure 10-1 Class Int_set
Figure 10-2 Using magic methods
Figure 10-3 Class Person
Figure 10-4 Class MIT_person
Figure 10-5 Two kinds of students
Figure 10-6 Class Grades
Figure 10-7 Generating a grade report
Figure 10-8 Information hiding in classes
Figure 10-9 New version of get_students
Figure 10-10 Mortgage base class
Figure 10-11 Mortgage subclasses
Chapter 11
Figure 11-1 Using exhaustive enumeration to approximate
square root
Figure 11-2 Using bisection search to approximate square root
Figure 11-3 Asymptotic complexity
Figure 11-4 Implementation of subset test
Figure 11-5 Implementation of list intersection
Figure 11-6 Generating the power set
Figure 11-7 Constant, logarithmic, and linear growth
Figure 11-8 Linear, log-linear, and quadratic growth
Figure 11-9 Quadratic and exponential growth
Chapter 12
Figure 12-1 Implementing lists
Figure 12-2 Linear search of a sorted list
Figure 12-3 Recursive binary search
Figure 12-4 Selection sort
Figure 12-5 Merge sort
Figure 12-6 Sorting a list of names
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Figure 12-7 Implementing dictionaries using hashing
Chapter 13
Figure 13-1 A simple plot
Figure 13-2 Contents of Figure-Jane.png (left) and Figure-
Addie.png (right)
Figure 13-3 Produce plots showing compound growth
Figure 13-4 Plots showing compound growth
Figure 13-5 Another plot of compound growth
Figure 13-6 Strange-looking plot
Figure 13-7 Class Mortgage with plotting methods
Figure 13-8 Subclasses of Mortgage
Figure 13-9 Compare mortgages
Figure 13-10 Generate mortgage plots
Figure 13-11 Monthly payments of different kinds of mortgages
Figure 13-12 Cost over time of different kinds of mortgages
Figure 13-13 Balance remaining and net cost for different kinds
of mortgages
Figure 13-14 Simulation of spread of an infectious disease
Figure 13-15 Function to plot history of infection
Figure 13-16 Produce plot with a single set of parameters
Figure 13-17 Static plot of number of infections
Figure 13-18 Interactive plot with initial slider values
Figure 13-19 Interactive plot with changed slider values
Chapter 14
Figure 14-1 Table of items
Figure 14-2 Class Item
Figure 14-3 Implementation of a greedy algorithm
Figure 14-4 Using a greedy algorithm to choose items
Figure 14-5 Brute-force optimal solution to the 0/1 knapsack
problem
Figure 14-6 The bridges of Königsberg (left) and Euler's
simplified map (right)
Figure 14-7 Nodes and edges
Figure 14-8 Classes Graph and Digraph
Figure 14-9 Depth-first-search shortest-path algorithm
Figure 14-10 Test depth-first-search code
Figure 14-11 Breadth-first-search shortest path algorithm
Chapter 15
Figure 15-1 Tree of calls for recursive Fibonacci
Figure 15-2 Implementing Fibonacci using a memo
Figure 15-3 Table of items with values and weights
Figure 15-4 Decision tree for knapsack problem
Figure 15-5 Using a decision tree to solve a knapsack problem
Figure 15-6 Testing the decision tree-based implementation
Figure 15-7 Dynamic programming solution to knapsack
problem
Figure 15-8 Performance of dynamic programming solution
Chapter 16
Figure 16-1 An unusual farmer
Figure 16-2 Location and Field classes
Figure 16-3 Classes defining Drunks
Figure 16-4 The drunkard's walk (with a bug)
Figure 16-5 Distance from starting point versus steps taken
Figure 16-6 Subclasses of Drunk base class
Figure 16-7 Iterating over styles
Figure 16-8 Plotting the walks of different drunks
Figure 16-9 Mean distance for different kinds of drunks
Figure 16-10 Plotting final locations
Figure 16-11 Where the drunk stops
Figure 16-12 Tracing walks
Figure 16-13 Trajectory of walks
Figure 16-14 Fields with strange properties
Figure 16-15 A strange walk
Chapter 17
Figure 17-1 Roll die
Figure 17-2 Flipping a coin
Figure 17-3 Regression to the mean
Figure 17-4 Illustration of regression to mean
Figure 17-5 Plotting the results of coin flips
Figure 17-6 The law of large numbers at work
Figure 17-7 The law of large numbers at work
Figure 17-8 Variance and standard deviation
Figure 17-9 Helper function for coin-flipping simulation
Figure 17-10 Coin-flipping simulation
Figure 17-11 Convergence of heads/tails ratios
Figure 17-12 Absolute differences
Figure 17-13 Mean and standard deviation of heads - tails
Figure 17-14 Coefficient of variation
Figure 17-15 Final version of flip_plot
Figure 17-16 Coefficient of variation of heads/tails and
abs(heads – tails)
Figure 17-17 A large number of trials
Figure 17-18 Income distribution in Australia
Figure 17-19 Code and the histogram it generates
Figure 17-20 Plot histograms of coin flips
Figure 17-21 Histograms of coin flips
Figure 17-22 PDF for random.random
Figure 17-23 PDF for Gaussian distribution
Figure 17-24 A normal distribution
Figure 17-25 Plot of absolute value of x
Figure 17-26 Checking the empirical rule
Figure 17-27 Produce plot with error bars
Figure 17-28 Estimates with error bars
Figure 17-29 Exponential clearance of molecules
Figure 17-30 Exponential decay
Figure 17-31 Plotting exponential decay with a logarithmic axis
Figure 17-33 A geometric distribution
Figure 17-32 Producing a geometric distribution
Figure 17-34 Simulating a hash table
Figure 17-35 World Series simulation
Figure 17-36 Probability of winning a 7-game series
Chapter 18
Figure 18-1 Checking Pascal's analysis
Figure 18-2 Craps_game class
Figure 18-3 Simulating a craps game
Figure 18-4 Using table lookup to improve performance
Figure 18-5 Unit circle inscribed in a square
Figure 18-6 Estimating π
Chapter 19
Figure 19-1 The first few lines in bm_results2012.csv
Figure 19-2 Read data and produce plot of Boston Marathon
Figure 19-3 Boston Marathon finishing times
Figure 19-4 Sampling finishing times
Figure 19-5 Analyzing a small sample
Figure 19-6 Effect of variance on estimate of mean
Figure 19-7 Compute and plot sample means
Figure 19-8 Sample means
Figure 19-9 Estimating the mean of a continuous die
Figure 19-10 An illustration of the CLT
Figure 19-11 Produce plot with error bars
Figure 19-12 Estimates of finishing times with error bars
Figure 19-13 Standard error of the mean
Figure 19-14 Sample standard deviation vs. population
standard deviation
Figure 19-15 Sample standard deviations
Figure 19-16 Estimating the population mean 10,000 times
Chapter 20
Figure 20-1 A classic experiment
Figure 20-2 Extracting the data from a file
Figure 20-3 Plotting the data
Figure 20-4 Displacement of spring
Figure 20-5 Fitting a curve to data
Figure 20-6 Measured points and linear model
Figure 20-7 Linear and cubic fits
Figure 20-8 Using the model to make a prediction
Figure 20-9 A model up to the elastic limit
Figure 20-10 Data from projectile experiment
Figure 20-11 Plotting the trajectory of a projectile
Figure 20-12 Plot of trajectory
Figure 20-13 Computing R2
Figure 20-14 Computing the horizontal speed of a projectile
Figure 20-15 Fitting a polynomial curve to an exponential
distribution
Figure 20-16 Fitting an exponential
Figure 20-17 An exponential on a semilog plot
Figure 20-18 Using polyfit to fit an exponential
Figure 20-19 A fit for an exponential function
Chapter 21
Figure 21-1 Finishing times for cyclists
Figure 21-2 January 2020 temperature difference from the
1981-2010 average145
Figure 21-3 Plotting a t-distribution
Figure 21-4 Visualizing the t-statistic
Figure 21-5 Compute and print t-statistic and p-value
Figure 21-6 Code for generating racing examples
Figure 21-7 Probability of p-values
Figure 21-8 Lyndsay's simulation of games
Figure 21-9 Correct simulation of games
Figure 21-10 Impact of sample size on p-value
Figure 21-11 Comparing mean finishing times for selected
countries
Figure 21-12 Checking multiple hypotheses
Figure 21-13 Has the sun exploded?
Chapter 22
Figure 22-1 Housing prices in the U.S. Midwest
Figure 22-2 Plotting housing prices
Figure 22-3 A different view of housing prices
Figure 22-4 Housing prices relative to $200,000
Figure 22-5 Comparing number of Instagram followers
Figure 22-6 Do Mexican lemons save lives?
Figure 22-7 Statistics for Anscombe's quartet
Figure 22-8 Data for Anscombe's quartet
Figure 22-9 Welfare vs. full-time jobs
Figure 22-10 Sea ice in the Arctic
Figure 22-11 Growth of Internet usage in U.S.
Figure 22-12 Professor puzzles over students' chalk-throwing
accuracy
Figure 22-13 Probability of 48 anorexics being born in June
Figure 22-14 Probability of 48 anorexics being born in some
month
Chapter 23
Figure 23-1 A sample Pandas DataFrame bound to the variable
wwc
Figure 23-2 An example CSV file
Figure 23-3 Building a dictionary mapping years to
temperature data
Figure 23-4 Building a DataFrame organized around years
Figure 23-5 Produce plots relating year to temperature
measurements
Figure 23-6 Mean and minimum annual temperatures
Figure 23-7 Rolling average minimum temperatures
Figure 23-8 Average temperatures for select cities
Figure 23-9 Variation in temperature extremes
Figure 23-10 Global consumption of fossil fuels
Chapter 24
Figure 24-1 Two sets of names
Figure 24-2 Associating a feature vector with each name
Figure 24-3 Feature vector/label pairs for presidents
Figure 24-4 Name, features, and labels for assorted animals
Figure 24-5 Visualizing distance metrics
Figure 24-6 Minkowski distance
Figure 24-7 Class Animal
Figure 24-8 Build table of distances between pairs of animals
Figure 24-9 Distances between three animals
Figure 24-10 Distances between four animals
Figure 24-11 Distances using a different feature representation
Chapter 25
Figure 25-1 Height, weight, and shirt color
Figure 25-2 Class Example
Figure 25-3 Class Cluster
Figure 25-4 K-means clustering
Figure 25-5 Finding the best k-means clustering
Figure 25-6 A test of k-means
Figure 25-7 Examples from two distributions
Figure 25-8 Lines printed by a call to contrived_test(1, 2, True)
Figure 25-9 Generating points from three distributions
Figure 25-10 Points from three overlapping Gaussians
Figure 25-11 Mammal dentition in dentalFormulas.csv
Figure 25-12 Read and process CSV file
Figure 25-13 Scaling attributes
Figure 25-14 Start of CSV file classifying mammals by diet
Figure 25-15 Relating clustering to labels
Chapter 26
Figure 26-1 Plots of voter preferences
Figure 26-2 Confusion matrices
Figure 26-3 A more complex model
Figure 26-4 Functions for evaluating classifiers
Figure 26-5 First few lines of bm_results2012.csv
Figure 26-6 Build examples and divide data into training and
test sets
Figure 26-7 Finding the k-nearest neighbors
Figure 26-8 Prevalence-based classifier
Figure 26-9 Searching for a good k
Figure 26-10 Choosing a value for k
Figure 26-11 Linear regression models for men and women
Figure 26-12 Produce and plot linear regression models
Figure 26-13 Using linear regression to build a classifier
Figure 26-14 Using sklearn to do multi-class logistic regression
Figure 26-15 Example of two-class logistic regression
Figure 26-16 Use logistic regression to predict gender
Figure 26-17 Construct ROC curve and find AUROC
Figure 26-18 ROC curve and AUROC
Figure 26-19 Class Passenger
Figure 26-20 Read Titanic data and build list of examples207
Figure 26-21 Test models for Titanic survival
Figure 26-22 Print statistics about classifiers
PREFACE
This book is based on courses that have been offered at MIT since
2006, and as “Massive Online Open Courses” (MOOCs) through edX
and MITx since 2012. The first edition of the book was based on a
single one-semester course. However, over time I couldn't resist
adding more material than could be fit into a semester. The current
edition is suitable for either a two-semester or a three-quarter
introductory computer science sequence.
The book is aimed at 1) readers with little or no prior
programming experience who have a desire to understand
computational approaches to problem solving, and 2) more
experienced programmers who want to learn how to use
computation to model things or explore data.
We emphasize breadth rather than depth. The goal is to provide
readers 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, this is not a
“computation appreciation” book. It is challenging and rigorous.
Readers who wish to really learn the material will have to spend a lot
of time and effort learning to bend the computer to their will.
The main goal of this book is to help readers become skillful at
making productive use of computational techniques. They should
learn to use computational modes of thoughts to frame problems, to
build computational models, and to guide the process of extracting
information from data. The primary knowledge they will take away
from this book is the art of computational problem solving.
We chose not to include problems at the end of chapters. Instead
we inserted “finger exercises” at opportune points within the
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Exploring the Variety of Random
Documents with Different Content
CHAPTER XI.
OMERS heard all that was said in the front room, and judged
from that, and the sounds which reached him, what was
taking place there. The two men who were stunned came to
their senses, after a while, and they were sent off with the dead and
the wounded ones; for it appeared that the general wanted the
apartment for a consultation with his officers. It was expected that
Major Riggleston would be present at this place with fresh
information from the Yankee lines; and the listener congratulated
himself that he had been able to disappoint them in this respect.
The major had chosen the ravine for his passage through the
pickets, and it was now evident that he intended to resume his work
as soon as he had disposed of his prisoner. The fellow was armed
with a pass, and, Somers well knew, was regarded in the loyal lines
as a major of the —nd Maryland Home Brigade, and could therefore
go where he pleased, even into the very councils of the general
commanding the army of the Potomac.
Somers believed he had made a great discovery. The rebels
always knew precisely when and where the army of the Potomac
were going to move. When McClellan had actually made up his mind
to attack the forces fortified at Manassas, they suddenly decamped.
All his movements for months were mysteriously communicated to
the enemy, even before the general officers of the loyal army were
informed in regard to them. People wondered, the press commented
severely, and the government was perplexed.
Captain Somers thought he understood all about it now, and
believed that he had laid out the man who had done all this mischief.
Much as we admire the captain, our hero, we are compelled to say
that he was mistaken. He had really made no such discovery, and
had achieved no such tremendous result as the killing of the one
who had done this immense injury to the loyal cause, as future
pages in our history will show. But he believed Major Riggleston,
whom he had seen in the staff of the general commanding, was the
man who had conveyed all this information; he believed he had
made this great discovery, accomplished this big thing; and he took
courage accordingly.
Major Riggleston was not there to speak of what the Yankees had
done, and what they intended to do; but for all this, the consultation
of officers proceeded. Somers heard them discuss their own position
and that of the enemy; he heard them suggest all manner of
possibilities and probabilities, and how to meet them; but they did
not speak so definitely as he wished they would. They alluded to a
line of field-works, which the listener was unable to locate.
Somers was coiled up behind a chest of drawers, and did not
concern himself at all about his personal safety. He was too deeply
interested in the labors of the council to think of himself. He had a
tolerably good idea of the rebel plans, and wondered whether the
man who was called “general” was really Stonewall Jackson. He
could not reach a satisfactory conclusion on this point, but he was
strongly in favor of the supposition.
“It is one o’clock, and we must get a little sleep,” said the
mysterious general, as Somers heard the rattling of chairs when they
rose from the table.
“Some of us will probably make a long sleep of it to-morrow,”
added one of the officers.
“Don’t trifle with a matter so serious,” continued the general,
solemnly. “Ah, here is the colonel,” he added, as the door opened,
and two or three persons entered the house. “What news do you
bring? Have you captured those Yankees?”
“I have neither captured them nor heard a word of them. Not a
soul within our lines knows anything about them,” replied the
colonel, in tones of disgust and mortification.
“That’s singular. Our sentinels are sleepy; they must be stirred up.
The miscreants had not been gone from this house more than
twenty minutes when we arrived, according to the statement of the
lady.”
“Nothing was ever more thoroughly done than the search we
made; but I am positive they have got through.”
“Perhaps not,” suggested the general.
“I have searched every house, grove, and clump of trees; every
hole, ditch, and cornfield within two miles of this spot. I am
satisfied, but I believe there are traitors within our camp. They could
not have got through without help from our side of the line.”
“We will look into that matter at the first opportunity,” replied the
general, with a long gape.
They left the house in a body, and all was silent within, except the
step of Maud Hasbrouk, as she attended to the wants of the
sufferers in her care. Somers had done all he could do in this place,
and he was satisfied that the search for himself and Captain
Barkwood had been abandoned. He crawled out of the corner in
which he had been coiled away for over two hours, intent upon the
great duty which was still in a measure unperformed. He had some
doubts whether his friend in the closet had been patient under the
long delay; and he was in haste to relieve him from the suspense
and discomfort of his situation.
There was no one in the house but Maud and her three patients.
There was, therefore, nothing to fear, and he crept towards the door
leading from the entry into the kitchen. He softly opened it, and was
stealthily making his way towards the shed, when the door of the
front room was thrown wide open, and Maud, apparently in a great
hurry, stepped into the kitchen. She had a bowl in her hand, and
was intent upon the object which had brought her there, so that she
did not at first see Somers, who stood in the middle of the floor.
When she discovered him she screamed, and started back in
astonishment and terror, dropping the dish; but she still held the
light which she had brought from the sick room. Somers regarded
the meeting as a very unfortunate occurrence, and wished he had
been prudent enough to go out at the front door; but it was too late
to indulge in vain regrets, and the situation was sufficiently perilous
to induce him to resort at once to decisive measures, for the tongue
of the woman was hardly less dangerous than a squad of rebel
cavalry.
“Who are you?” asked the lady, when she had recovered herself
sufficiently to speak.
“It matters not who I am,” replied Somers, disguising his voice as
much as he could.
“Captain Somers!” exclaimed she, shrinking back still farther.
“I am sorry, for your sake, that you have recognized me,” replied
he, dropping the collar of his coat, which he had drawn up over his
face. “Miss Hasbrouk, your discovery endangers my life; I am
compelled either to shoot you, or—”
“To shoot me!” exclaimed she, with horror.
“What is the matter, Maud?” said a voice from the front room,
which was followed by the appearance of Major Riggleston, whose
head was tied up with bandages, as the surgeon had dressed it.
“It is Captain Somers,” said she, in trembling tones.
“It seems that I did not fully do my work,” added Somers, taking a
pistol from his belt.
“Don’t fire, Somers, don’t,” said the major, in tones so feeble and
piteous that Somers could not help being moved by them. “You have
nearly killed me now, and you ought to be satisfied.”
“It is your life or mine, Major Riggleston, and I have no time to
argue the matter. In five minutes more you will have the whole
Confederate army at my heels. I run no risks with a villain like you,”
replied Somers.
“Don’t fire!” begged Maud; “I will do anything you desire, if you
will spare me.”
It was something to see a brawling rebel woman, the most
pestilent and inveterate enemy the government had in the contest,
in a pleading posture. It was something to expose the ridiculous
pretensions of one of that army of female rebels, fiercer and more
vindictive than the men, and to demonstrate that she had none of
the courage of which she had boasted. Maud regretted that her sex
compelled her to be a non-combatant; it was doubtful whether she
would ever again regret it.
“I wish not to take the life of either of you; but my own safety
compels me to use strong measures,” said Somers, as he cocked his
pistol.
“For mercy’s sake, don’t fire!” gasped Maud.
“Don’t kill me, Somers; I will pledge you my word and honor not
to expose you,” added the major.
“What are your word and honor good for, after what has
happened this night?” sneered Somers.
“I will give you all the information you require, if you will spare my
life.”
“That would not save my life.”
“I will give you the countersign.”
“That’s something towards it.”
The wretch gave him the word, and while he received it, he
despised the major more than ever before. He was now a traitor to
both sides; but all this, and more, would he give in exchange for his
life. Somers then questioned him in regard to the position of various
bodies of rebel troops, and the miscreant answered him promptly,
and, as it was afterwards shown, correctly.
“You know me now, Major Riggleston and Miss Hasbrouk; and you
must understand that I go about with my life in my hand. I am not
to be trifled with. I will not take your life yet.”
“I will swear never to reveal your presence to a living soul,”
exclaimed the major.
“You need not; you have given me better security than your oath
that you will not expose me. If I am taken, I shall be taken with the
countersign in my keeping. I had it from you. If you have given me
the wrong word, I shall be turned back.”
“I have given you the right word,” interposed the major.
“If I am turned back, I shall come here first, and complete my
work,” added Somers, sternly.
“You shall have my pass.”
“I have it already. I have not yet exhausted all my resources,” said
the scout, producing the two passes, which he had neglected to
return in the ravine.
He opened them; but though the wounded major was surprised,
he was too weak and broken in spirits to ask any questions, or even
to care where his late companion had procured them.
“All I ask of you, Major Riggleston, and of you, Miss Hasbrouk, is
to keep still,” continued Somers.
“I will,” replied Maud, eagerly.
“And I will, Captain Somers. What I have done here to save my
life has ruined me. I shall never be seen in the service again.”
“I think you are coming to your senses, major.”
“May I ask you to keep quiet in regard to what I have done? for
you know the penalty of that which I could not have done if I had
not stood on the brink of the open grave.”
“That will depend on your own conduct. Return to your bed; and if
you are treacherous, you will suffer for it.”
“I may die,” groaned the major, who had sunk into a chair, for he
believed his wound was much worse than it really was.
Perhaps some twinges of remorse had induced him to aid Somers
in his mission more than he otherwise would; he was not a man of
nerve, or a man of much nobility of purpose, and his severe wound
had worked a great change in his moral and mental organization.
The fear of death had deprived him of what little manliness he
possessed, and under the pressure of that terror, he had sunk lower
down in the scale of humanity than it would have been possible for
him under any other circumstances. He had absolutely betrayed the
cause for which he professed so earnest and sincere a devotion. His
boasted honor was a delusion. He was an exception, even in the
ranks of southern heroes.
Somers was satisfied with what was promised, and with what had
already been performed. He restored his pistol to his belt, and
hastened to the back room, where Captain Barkwood was no doubt
anxiously waiting to hear from him.
“Come out, captain,” said he, as he threw open the door.
“Is that you, Somers?” replied the regular, as he stepped from his
narrow quarters. “I had given you up for lost, and was just thinking
of engaging in a little enterprise of my own. Where have you been?”
Somers, as briefly as possible, explained the events that had
transpired during his absence, to which the regular listened with
wonder and admiration. It was now two o’clock in the morning, and
there was much still to be done before they could return to the
camp. Somers, still wearing the coat and feathered hat of Major
Riggleston, left the back room, followed by Barkwood, and for three
hours wandered about the camps of the rebels. They were often
challenged; but Somers gave his name as Major Riggleston, and
produced the pass when called upon, or gave the countersign. The
day was breaking in the east when they finished the examination.
CHAPTER XIII.
ebookmasss.com