0% found this document useful (0 votes)
11 views77 pages

An introduction to programming with Mathematica 3rd Edition Paul R. Wellin 2024 scribd download

The document provides information about the 3rd edition of 'An Introduction to Programming with Mathematica' by Paul R. Wellin and others, detailing its purpose to introduce the Mathematica programming language to a broad audience. It highlights significant updates in the book, including new chapters on various programming paradigms and the latest features of Mathematica software. Additionally, it mentions the availability of supplementary materials and resources for users to enhance their understanding of Mathematica.

Uploaded by

bogiehasibhy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views77 pages

An introduction to programming with Mathematica 3rd Edition Paul R. Wellin 2024 scribd download

The document provides information about the 3rd edition of 'An Introduction to Programming with Mathematica' by Paul R. Wellin and others, detailing its purpose to introduce the Mathematica programming language to a broad audience. It highlights significant updates in the book, including new chapters on various programming paradigms and the latest features of Mathematica software. Additionally, it mentions the availability of supplementary materials and resources for users to enhance their understanding of Mathematica.

Uploaded by

bogiehasibhy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

Visit https://ebookfinal.

com to download the full version and


explore more ebooks

An introduction to programming with Mathematica


3rd Edition Paul R. Wellin

_____ Click the link below to download _____


https://ebookfinal.com/download/an-introduction-to-
programming-with-mathematica-3rd-edition-paul-r-wellin/

Explore and download more ebooks at ebookfinal.com


Here are some suggested products you might be interested in.
Click the link to download

Programming with Mathematica 4th Revised edition Edition


Paul Wellin

https://ebookfinal.com/download/programming-with-mathematica-4th-
revised-edition-edition-paul-wellin/

An Introduction to Network Programming with Java 1st


Edition Jan Graba

https://ebookfinal.com/download/an-introduction-to-network-
programming-with-java-1st-edition-jan-graba/

An Introduction to Bootstrap Methods with Applications to


R 1st Edition Michael R. Chernick

https://ebookfinal.com/download/an-introduction-to-bootstrap-methods-
with-applications-to-r-1st-edition-michael-r-chernick/

Practical Programming An Introduction to Computer Science


Using Python 3 Second Edition Paul Gries

https://ebookfinal.com/download/practical-programming-an-introduction-
to-computer-science-using-python-3-second-edition-paul-gries/
Introduction to the mathematics of operations research
with Mathematica 2. ed Edition Hastings

https://ebookfinal.com/download/introduction-to-the-mathematics-of-
operations-research-with-mathematica-2-ed-edition-hastings/

Observation and Experiment An Introduction to Causal


Inference 1st Edition Paul R. Rosenbaum

https://ebookfinal.com/download/observation-and-experiment-an-
introduction-to-causal-inference-1st-edition-paul-r-rosenbaum/

Simply Java An Introduction to Java Programming


Programming Series 1st Edition James Levenick

https://ebookfinal.com/download/simply-java-an-introduction-to-java-
programming-programming-series-1st-edition-james-levenick/

MATLAB An Introduction with Applications 3rd Edition Amos


Gilat

https://ebookfinal.com/download/matlab-an-introduction-with-
applications-3rd-edition-amos-gilat/

An Introduction to Stata Programming 2nd Edition


Christopher F. Baum

https://ebookfinal.com/download/an-introduction-to-stata-
programming-2nd-edition-christopher-f-baum/
An introduction to programming with Mathematica 3rd
Edition Paul R. Wellin Digital Instant Download
Author(s): Paul R. Wellin, Richard J. Gaylord, Samuel N. Kamin
ISBN(s): 9780521846783, 0521846781
Edition: 3
File Details: PDF, 6.48 MB
Year: 2005
Language: english
This page intentionally left blank
An Introduction to Programming with Mathematica
r

An Introduction to Programming with Mathematica r is de-

signed to introduce the Mathematica programming language


to a wide audience. Since the last edition of this book was
published, significant changes have occurred in Mathemat-
ica and its use worldwide. Keeping pace with these changes,
this substantially larger, updated version includes new and
revised chapters on numerics, procedural, rule-based, and
front end programming, and gives significant coverage to
the latest features up to, and including, version 5.1 of the
software.

Mathematica notebooks, available from www.cambridge.org/


0521846781, contain examples, programs, and solutions to
exercises in the book. Additionally, material to supplement
later versions of the software will be made available. This is
the ideal text for all scientific students, researchers, and pro-
grammers wishing to deepen their understanding of Math-
ematica, or even those keen to program using an interac-
tive language that contains programming paradigms from
all major programming languages: procedural, functional,
recursive, rule-based, and object-oriented.
An Introduction to
Programming
with
Mathematica r
Third Edition

Paul R. Wellin | Richard J. Gaylord | Samuel N. Kamin


  
Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore, São Paulo

Cambridge University Press


The Edinburgh Building, Cambridge  , UK
Published in the United States of America by Cambridge University Press, New York
www.cambridge.org
Information on this title: www.cambridge.org/9780521846783

This book is in copyright. Subject to statutory exception and to the provision of


relevant collective licensing agreements, no reproduction of any part may take place
without the written permission of Cambridge University Press.

First published in print format 2005

- ---- eBook (NetLibrary)


- --- eBook (NetLibrary)

- ---- hardback


- --- hardback

Cambridge University Press has no responsibility for the persistence or accuracy of


s for external or third-party internet websites referred to in this book, and does not
guarantee that any content on such websites is, or will remain, accurate or appropriate.

Mathematica, Mathlink and Mathsource are registered trademarks of Wolfram


Research, Inc. All other trademarks used herein are the property of their respective
owners. Mathematica is not associated with Mathematica Policy Research, Inc. or
MathTech, Inc.

Wolfram Research is the holder of the copyright to the Mathematica software system
described in this document, including without limitation such aspects of the system as
its code, structure, sequence, organization, “look and feel”, programming language, and
compilation of command names. Use of the system unless pursuant to the terms of a
license granted by Wolfram Research or an otherwise authorized by law is an
infringement of the copyright.
1 An introduction to Mathematica

Mathematica is a very large and seemingly complex system. It contains hundreds of


functions for performing various tasks in science, mathematics, and engineering,
including computing, programming, data analysis, knowledge representation, and
visualization of information. In this introductory chapter, we introduce the elementary
operations in Mathematica and give a sense of its computational and programming
breadth and depth. In addition, we give some basic information that users of Mathemat-
ica need to know, such as how to start Mathematica, how to get out of it, how to enter
simple inputs and get answers, and finally how to use Mathematica’s documentation to
get answers to questions about the system.

1.1 A brief overview of Mathematica

Numerical computations
Mathematica has been aptly described as a sophisticated calculator. With it you can enter
mathematical expressions and compute their values.
12
.08
In[1]:= Sin .86 Log 1
12
Out[1]= 0.481899

You can store values in memory.


In[2]:= rent 350
Out[2]= 350

In[3]:= food 175


Out[3]= 175

In[4]:= heat 83
Out[4]= 83
2 An Introduction to Programming with Mathematica

In[5]:= rent food heat


Out[5]= 608

Yet Mathematica differs from calculators and simple computer programs in its ability to
calculate exact results and to compute to an arbitrary degree of precision.
1 1 1
In[6]:=
15 35 63
1
Out[6]=
9

In[7]:= 2500
Out[7]= 3273390607896141870013189696827599152216642046043064789483291
368096133796404674554883270092325904157150886684127560071009
217256545885393053328527589376

In[8]:= N , 500
Out[8]= 3.14159265358979323846264338327950288419716939937510582097494
459230781640628620899862803482534211706798214808651328230664
709384460955058223172535940812848111745028410270193852110555
964462294895493038196442881097566593344612847564823378678316
527120190914564856692346034861045432664821339360726024914127
372458700660631558817488152092096282925409171536436789259036
001133053054882046652138414695194151160943305727036575959195
309218611738193261179310511854807446237996274956735188575272
48912279381830119491

Symbolic computations
One of the more powerful features of Mathematica is its ability to manipulate and compute
with symbolic expressions. For example, you can factor polynomials and simplify trigono-
metric expressions.
In[9]:= Factor x5 1

Out[9]= 1 x 1 x x2 x3 x4

3
In[10]:= TrigReduce Sin
1
Out[10]= 3 Sin Sin 3
4
1 An introduction to Mathematica 3

You can simplify expressions using assumptions about variables contained in those expres-
sions. For example, if k is assumed to be an integer, sin 2 k x simplifies to sin x .
In[11]:= Simplify Sin 2 k x ,k Integers
Out[11]= Sin x

This computes the conditions for which a general quadratic polynomial will have both
roots equal to each other.
In[12]:= Reduce x,a x2 b x c 0 y,a y2 b y c 0 x y , a, b, c

b2
Out[12]= a 0 && b 0 a 0 && b c 0 a 0 && c
4a

You can create functions that are defined piecewise.


In[13]:= Piecewise 1, x 0 , Sin x x
1 x 0
Out[13]= Sin x
x
True

The knowledge base of Mathematica includes algorithms for solving polynomial equations,
and computing integrals.
In[14]:= Solve x3 ax 1 0, x
1 3 1 3
2
3
a 9 3 27 4 a3
Out[14]= x 1 3
,
9 3 27 4 a3 21 3 32 3

1 3 a
x 1 3
22 3 31 3 9 3 27 4 a3
1 3
1 3 9 3 27 4 a3
,
2 21 3 32 3
1 3 a
x 1 3
22 3 31 3 9 3 27 4 a3
1 3
1 3 9 3 27 4 a3
2 21 3 32 3

1
In[15]:= x
1 x4
1
Out[15]= 2 ArcTan 1 2 x 2 ArcTan 1 2 x
4 2
Log 1 2 x x2 Log 1 2 x x2
4 An Introduction to Programming with Mathematica

Graphics
The ability to visualize functions or sets of data often allows us greater insight into their
structure and properties. Mathematica provides a wide range of graphing capabilities.
These include two- and three-dimensional plots of functions or data sets, contour and
density plots of functions of two variables, bar charts, histograms and pie charts of data
sets, and many packages designed for specific graphical purposes. In addition, the Mathemat-
ica programming language allows you to construct graphical images “from the ground up”
using primitive elements, as we will see in Chapter 9.
Here is a simple two-dimensional plot of the function sin x 2 sin x2 .

In[16]:= Plot Sin x 2 Sin x2 , x, ,


1

0.5

3 2 1 1 2 3

0.5

Out[16]= Graphics

You can combine two or more plots in a single graphic by enclosing them inside curly
braces.
In[17]:= Plot Sin x , Sin 2 x , x, 0, 2 ;
1

0.5

1 2 3 4 5 6

0.5

1
1 An introduction to Mathematica 5

Here is a plot of the sinc function, given in the previous section.


In[18]:= Plot Piecewise 1, x 0 , Sin x x , x, 2 ,2 ;
1

0.8

0.6

0.4

0.2

6 4 2 2 4 6

0.2

Here is a surface of constant negative curvature, represented parametrically by the three


functions , , and . This surface is often referred to as Dini’s surface.
In[19]:= Cos Sin ;
Sin Sin ;

0.2 Cos Log Tan ;


2

In[22]:= ParametricPlot3D , , , , 0, 4 , , .05, 1 , Axes False,


Boxed False, PlotPoints 30, AspectRatio 1.75 ;
6 An Introduction to Programming with Mathematica

Working with data


The ability to plot and visualize data is extremely important in engineering and all of the
social, natural, and physical sciences. Mathematica can import and export data from other
applications, plot the data in a variety of forms, and be used to perform numerical analysis
on the data.
The file dataset.m contains pairs of data points, in this case representing body
mass vs. heat production for 13 different animals. The data are given as (m, r), where m
represents the mass of the animal and r the heat production in kcal per day. First we set up
a platform independent path to the file and then import that file.
In[23]:= datafile ToFileName $BaseDirectory,
"Applications", "IPM3", "DataFiles" , "dataset.m"
Out[23]= C:\Documents and Settings\All Users\Application Data\
Mathematica\Applications\IPM3\DataFiles\dataset.m

In[24]:= data Import datafile, "Table"


Out[24]= 0.06099, 6.95099 , 0.403, 28.189 ,
0.62199, 41.1 , 2.50999, 120.799 ,
2.95999, 147.9 , 3.33, 182.8 , 8.19999, 368.8 ,
28.1999, 981.299 , 57.4, 1303.29 , 72.2999, 1512.5 ,
340.199, 7100.29 , 711, 10101.1 , 5000., 29894.9

You can immediately plot the data using the ListPlot function.
In[25]:= ListPlot data, PlotStyle PointSize .02 ;
17500

15000

12500

10000

7500

5000

2500

200 400 600 800


1 An introduction to Mathematica 7

This plots the data on log–log axes.


In[26]:= logplot ListPlot Log data , PlotStyle PointSize .02 ;
10

2 2 4 6 8

You can then fit a straight line to the log-data by performing a linear least squares fit. In
this example, we are fitting to the model a m x, where a and m are the parameters to be
determined in the model with variable x.
In[27]:= f FindFit Log data , a m x, a, m , x
Out[27]= a 4.15437, m 0.761465

Here is a plot of the linear fit function.


In[28]:= fplot Plot a m x . f, x, 3, 9 ;

10

2 2 4 6 8
8 An Introduction to Programming with Mathematica

Finally, you can see how well the fitted function approximates the log plot by combining
these last two graphics.
In[29]:= Show fplot, logplot ;

10

2 2 4 6 8

Programming
With a copy of The Mathematica Book (Wolfram 2003) or one of the many tutorial books
(see, for example, Glynn and Gray 1999) describing the vast array of computational tasks
that can be performed with Mathematica, it would seem you can compute just about
anything you might want. But that impression is mistaken. There are simply more kinds of
calculations than could possibly be included in a single program. Whether you are inter-
ested in computing bowling scores or finding the mean square distance of a random walk
on a torus, Mathematica does not have a built-in function to do everything that a user could
possibly want. What it does have – and what really makes it the amazingly useful tool it is –
is the capability for users to define their own functions. This is called programming, and it
is what this book is all about.
Sometimes, the programs you create will be succinct and focused on a very specific
task. Mathematica possesses a rich set of tools that enable you to quickly and naturally
translate the statement of a problem into a program. For example, the following program
defines a test for perfect numbers, numbers that are equal to the sum of their proper
divisors.
In[30]:= PerfectQ n_ : Apply Plus, Divisors n 2n
We then define another function that selects those numbers from a range of integers that
pass this PerfectQ test.
In[31]:= PerfectSearch n_ : Select Range n , PerfectQ
1 An introduction to Mathematica 9

This then finds all perfect numbers less than 1,000,000.


In[32]:= PerfectSearch 106
Out[32]= 6, 28, 496, 8128

Here are two functions for representing regular polygons. The first defines the
vertices of a regular n-gon, while the second uses those vertices to create a polygon graph-
ics object that can then be displayed with the built-in Show function.
In[33]:= vertices n_Integer, r_: 1 :
2 2
Table r Cos , r Sin , , 0, n 1
n n

In[34]:= RegularPolygon n_ :
Graphics Line vertices n . a_, b__ a, b, a ,
AspectRatio Automatic

In[35]:= Show RegularPolygon 5

Out[35]= Graphics

As another example of a succinct program, here is an iterative function that imple-


ments the well-known Newton method for root finding.
f #
In[36]:= NewtonZero f_, xi_ : NestWhile # &, xi, Unequal, 2
f' #

In[37]:= g x_ : x3 2 x2 1

In[38]:= NewtonZero g, 2.0


Out[38]= 1.61803

Of course, sometimes the task at hand requires a more involved program, stretching
across several lines (or even pages) of code. For example, here is a slightly longer program
to compute the score of a game of bowling, given a list of the number of pins scored by
each ball.
10 An Introduction to Programming with Mathematica

In[39]:= BowlingScore pins_ :


Module score , score x_, y_, z_ : x y z;
score 10, y_, z_, r___ : 10 y z score y, z, r ;
score x_, y_, z_, r___ :
x y z score z, r ;x y 10;
score x_, y_, r___ : x y score r ; x y 10;
score If pins 2 pins 1 10, pins, Append pins, 0
Here is the computation for a “perfect” game – 12 strikes in a row.
In[40]:= BowlingScore 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Out[40]= 300

These examples use a variety of programming styles: functional programming,


rule-based programming, the use of anonymous functions, and more. We do not expect
you to understand the examples in this section at this point – that is why we wrote this
book! What you should understand is that in many ways Mathematica is designed to be as
broadly useful as possible and that there are many calculations for which Mathematica does
not have a built-in function, so, to make full use of its many capabilities, you will some-
times need to program. The main purpose of this book is to show you how.
Another purpose is to teach you the basic principles of programming. These princi-
ples – making assignments, defining rules, using conditionals, recursion, and iteration – are
applicable (with great differences in detail, to be sure) to all other programming languages.

Symbolic and interactive documents


In addition to the computational tools that Mathematica provides for what many profession-
als associate with technical computing, it also contains tools for creating and modifying the
user interface to such tasks. These tools include hyperlinks for jumping to other locations
within a document or across files, buttons to perform tasks that you might normally
associate with a command-line interface, and tools to modify and manipulate the appear-
ance and functionality of your Mathematica notebooks directly. In this section we will give
a few short examples of what is possible, waiting until Chapter 10 for a methodical look at
how to program these elements.
The first example takes the code necessary to display a polyhedron and puts it in a
button. The two lines of code that could be evaluated normally in a notebook first load a
package and then display an icosahedron in the notebook.
In[41]:= Needs "Graphics`Polyhedra`"
1 An introduction to Mathematica 11

In[42]:= Show Stellate Polyhedron Icosahedron

Out[42]= Graphics3D

Here is a short program that creates a button containing the above two expressions.

Cell[BoxData[
ButtonBox[
RowBox[{"Stellate", " ", "Icosahedron"}],
ButtonFunction:>CompoundExpression[
Needs[ "Graphics`Polyhedra`"],
Show[Stellate[Polyhedron[Icosahedron]]]
],
ButtonEvaluator->Automatic],
"Input",
Active->True]

The formatted version of the above cell can be displayed by choosing Show Expression
from the Format menu. When you do that, it will look like the following:

Stellate Icosahedron

Clicking the button will cause the Mathematica code in the ButtonFunction to be
immediately evaluated and the following graphics will then be displayed in your notebook.
Functions are available to jump around to different parts of a Mathematica notebook
and perform various actions. Here is a short piece of code that creates a button which,
upon being clicked, moves the selection to the next cell and then evaluates that cell.
12 An Introduction to Programming with Mathematica

Cell[TextData[{
Cell[BoxData[
ButtonBox["EVALUATE",
ButtonFunction:>FrontEndExecute[ {
FrontEnd`SelectionMove[
ButtonNotebook[ ], All, ButtonCell],
FrontEnd`SelectionMove[
ButtonNotebook[ ], Next, Cell],
FrontEnd`SelectionEvaluate[
ButtonNotebook[ ]]}],
Active->True]]],
StyleBox[" MATHEMATICA INPUT"]
}], "Text"]

The formatted version of the above cell can be displayed by choosing Show Expression
from the Format menu. When you do that, it will look somewhat like the following
(although we have removed some of the text formatting above to improve readability of the
code). Clicking the EVALUATE button will cause the input cell immediately following to
be selected and then evaluated.

EVALUATE MATHEMATICA INPUT

In[43]:= 3 4 5
Out[43]= 27

The following example demonstrates how you can use Mathematica functions to
perform some of the user interface actions that you would normally associate with key-
board and mouse events. By using such techniques, you can create a specific set of actions
that will follow certain evaluations. For example, if you were creating an electronic quiz for
your students, you could include “hint” buttons within your class notebooks that would
open a new notebook with hints and suggestions upon clicking.
This creates a new notebook that contains three cells – a Section cell, a Text cell,
and an Input cell. Upon evaluation, the NotebookPut command below will cause a new
notebook to appear, containing the three specified cells. The screen shots below show
what appears in the user interface after evaluating each of the preceding inputs.
1 An introduction to Mathematica 13

In[44]:= nb NotebookPut
Notebook
Cell "Symbolic and Interactive Documents", "Section" ,
Cell "Cells and notebooks are Mathematica expressions.",
"Text" ,
Cell "Integrate Sin x Cos x ,x ", "Input"

Out[44]= NotebookObject Untitled 1

This moves the selection bar past the last cell in the above notebook.
In[45]:= SelectionMove nb, Next, Cell, 4
14 An Introduction to Programming with Mathematica

We then select the most previous cell.


In[46]:= SelectionMove nb, Previous, Cell

Finally, we evaluate the selected cell.


In[47]:= SelectionEvaluate nb

In Chapter 10 we will give a detailed discussion of how to modify and manipulate the
user interface through the use of the symbolic programming techniques that are discussed
throughout this book.
1 An introduction to Mathematica 15

1.2 Using Mathematica


Before you can do any serious work, you will need to know how to get a Mathematica
session started, how to stop it, and how to get out of trouble when you get into it. These
procedures depend somewhat on the system you are using. You should read the system-spe-
cific information that came with your copy of Mathematica; and you may need to consult a
local Mathematica guru if our advice here is not applicable to your system.

Getting into and out of Mathematica


The most commonly used interface is often referred to as a notebook interface in which
the user creates and works in interactive documents. Personal computers running Win-
dows, Macintosh operating systems, Linux, and most flavors of Unix all support this
graphical user interface, which normally starts up automatically when you begin your
Mathematica session.
There are some situations where you may want to start up Mathematica from a
command prompt and issue commands directly through that interface, bypassing the
notebook interface entirely. For example, you may have a very long computation that you
need to run in batch mode. Typically, Mathematica is started up on these systems by typing
math at a command prompt. We will not discuss using Mathematica through a command
prompt any further. If you are interested in this mode you should consult the documenta-
tion that came with your copy of Mathematica.

Starting Mathematica and first computations


To start Mathematica you will have to find and then double-click on the Mathematica icon
on your computer, which will look something like this:

The computer will then load parts of Mathematica into its memory and soon a blank
window will appear on the screen. This window is the visual interface to a Mathematica
notebook and it has many features that are useful to the user.
Notebooks allow you to write text, perform computations, write and run programs,
and create graphics all in one document. Notebooks also have many of the features of
common word processors, so those familiar with word processing will find the notebook
interface easy to learn. In addition, the notebook provides features for outlining material
which you may find useful for giving talks and demonstrations.
16 An Introduction to Programming with Mathematica

When a blank notebook first appears on the screen (either from just starting Mathe-
matica or from selecting New in the File menu), you can start typing immediately. For
example, if you type N[Pi,200] press (hold down the Shift key while pressing
the Enter key) to evaluate an expression. Mathematica will evaluate the result and print the
200-decimal digit approximation to on the screen.

Notice that when you evaluate an expression in a notebook, Mathematica adds input
and output prompts. In the example notebook above, these are denoted In[1]:= and
Out[1]=. These prompts can be thought of as markers (or labels) that you can refer to
during your Mathematica session.
1 An introduction to Mathematica 17

You should also note that when you started typing Mathematica placed a bracket on
the far right side of the window that enclosed the cell that you were working in. These cell
brackets are helpful for organizational purposes within the notebook. Double-clicking on
cell brackets will open any collapsed cells, or close any open cells as can be seen in the
previous screen shot.
Double-clicking on the cell bracket containing the 1.1 A Brief Overview of Mathe-
matica cell will open the cell to display its contents:

Using cell brackets in this manner allows you to organize your work in an orderly
manner, as well as to outline material. For a complete description of cell brackets and
many other interface features, you should consult the documentation that came with your
version of Mathematica.
For information on other features such as saving, printing, and editing notebooks,
consult the manuals that came with your version of Mathematica.

Entering input
New input can be entered whenever there is a horizontal line that runs across the width of
the notebook. If one is not present where you wish to place an input cell, move the cursor
up and down until it changes to a horizontal bar and then click the mouse once. A horizon-
tal line should now appear across the width of the window. You can immediately start
typing and an input cell will be created.
18 An Introduction to Programming with Mathematica

Input can be entered exactly as it appears in this book. To get Mathematica to evalu-
ate an expression that you have entered, press - ; that is, hold down the Shift key
and then press the Enter key.
You can enter mathematical expressions in a traditional looking two-dimensional
format using either palettes for quick entry of template expressions, or keyboard equiva-
lents. For example, the following expression can be entered by using the Basic Input
palette, or through a series of keystrokes. For details of inputting mathematical expres-
sions, read your user documentation or read the section on 2D Expression Input in the
Help Browser.
1
In[1]:= x
1 x3
1 2x
ArcTan 1 1
3
Out[1]= Log 1 x Log 1 x x2
3 3 6

As noted previously, Mathematica enters the In and Out prompts for you. You do
not type these prompts. You will see them after you evaluate your input.
You can refer to the result of the previous calculation using the symbol %.
In[2]:= 264
Out[2]= 18446744073709551616

In[3]:= % 1
Out[3]= 18446744073709551617

You can also refer to the result of any earlier calculation using its Out[i] label or,
equivalently, %i.
In[4]:= Out 1
1 2x
ArcTan 1 1
3
Out[4]= Log 1 x Log 1 x x2
3 3 6

In[5]:= %2
Out[5]= 18446744073709551616

Ending a Mathematica session


To end your Mathematica session, choose Exit from the File menu. You will be prompted
to save any unsaved open notebooks.
1 An introduction to Mathematica 19

Getting out of trouble


From time to time, you will type an input which will cause Mathematica to misbehave in
some way, perhaps by just going silent for a long time (if, for example, you have inadvert-
ently asked it to do something very difficult) or perhaps by printing out screen after screen
of not terribly useful information. In this case, you can try to “interrupt” the calculation.
How you do this depends on your computer’s operating system:

• Macintosh: type . (the Command key and the period) and then type a

• Windows 95/98/NT/2000/XP: type . (the Alt key and the period)

• Unix: type - . and then type a and then

These attempts to stop the computation will sometimes fail. If after waiting a reason-
able amount of time (say, a few minutes), Mathematica still seems to be stuck, you will have
to “kill the kernel.” (Before attempting to kill the kernel, try to convince yourself that the
computation is really in a loop from which it will not return and that it is not just an
intensive computation that requires a lot of time.) Killing the kernel is accomplished by
selecting Quit Kernel from the Kernel menu. The kernel can then be restarted without
killing the front end by first selecting Start Kernel Local under the Kernel menu, or you
can simply evaluate a command in a notebook and a new kernel should start up
automatically.

The syntax of inputs


You can enter mathematical expressions in a linear syntax using arithmetic operators
common to almost all computer languages.
In[6]:= 39 13
Out[6]= 3

Alternately, you can enter this expression in the traditional form by typing 39, / , then
13.
39
In[7]:=
13
Out[7]= 3

The caret (^) is used for exponentiation.


In[8]:= 2^5
Out[8]= 32
20 An Introduction to Programming with Mathematica

You can enter this expression in a more traditional typeset form by typing 2, ^ , and
then 5.
In[9]:= 25
Out[9]= 32

Mathematica includes several different ways of entering typeset expressions, either


directly from the keyboard as we did above, or via palettes available from the File menu.
Below is a brief table showing some of the more commonly used typeset expressions and
how they are entered through the keyboard. You should read your documentation and
become comfortable using these input interfaces so that you can easily enter the kinds of
expressions in this book.

Expression FullForm Keyboard shortcut


x2 SuperscriptBox x, 2 x 6, 2
xi SubscriptBox x, i x ,i
x
y
FractionBox x, y x ,y

x SqrtBox x 2, x
x y GreaterEqual x, y x ,y

Table 1.1: Entering typeset expressions

You can indicate multiplication by simply putting a space between the two factors, as
in mathematics. You can also use the asterisk (*) for that purpose, as is traditional in most
computer languages.
In[10]:= 25
Out[10]= 10

In[11]:= 2 5
Out[11]= 10

Mathematica also gives operations the same precedence as in mathematics. In particu-


lar, multiplication and division have a higher precedence than addition and subtraction, so
that 3 + 4 * 5 equals 23 and not 35.
In[12]:= 3 45
Out[12]= 23
1 An introduction to Mathematica 21

Functions are also written as they are in mathematics books, except that function
names are capitalized and their arguments are enclosed in square brackets.
In[13]:= Factor x5 1

Out[13]= 1 x 1 x x2 x3 x4

Almost all of the built-in functions are spelled out in full, as in the above example.
The exceptions to this rule are well-known abbreviations such as D for differentiation,
Sqrt for square roots, Log for logarithms, and Det for the determinant of a matrix.
Spelling out the name of a function in full is quite useful when you are not sure whether a
function exists to perform a particular task. For example, if we wanted to compute the
conjugate of a complex number, an educated guess would be:
In[14]:= Conjugate 3 4
Out[14]= 3 4

Whereas square brackets [ and ] are used to enclose the arguments to functions,
curly braces { and } are used to indicate a list or range of values. Lists are a basic data type
in Mathematica and are used to represent vectors and matrices (and tensors of any dimen-
sion), as well as additional arguments to functions such as in Plot and Integrate.
In[15]:= a, b, c . x, y, z
Out[15]= ax by cz

In[16]:= Plot Sin x 2 Sin x , x, 2 ,2 ;


1

0.5

6 4 2 2 4 6

0.5

In[17]:= Integrate[Cos[x], {x, a, b}]


Out[17]= Sin a Sin b

In the Plot example, the list {x,-2 ,2 } indicates that the function
sin x 2 sin x is to be plotted over an interval as x takes on values from 2 to 2 .
The Integrate expression above is equivalent to the mathematical expression
b
a
cos x x.
22 An Introduction to Programming with Mathematica

Mathematica has very powerful list-manipulating capabilities that will be explored in


detail in Chapter 3.
When you end an expression with a semicolon (;), Mathematica computes its value
but does not display it. This is very helpful when the result of the expression would be very
long and you do not need to see it. In the following example, we first create a list of the
integers from 1 to 10,000, suppressing their display with the semicolon, and then compute
their sum and average.
In[18]:= nums Range 10000 ;

In[19]:= Apply[Plus, nums]


Out[19]= 50005000

%
In[20]:=
Length nums
10001
Out[20]=
2
An expression can be entered on multiple lines, but only if Mathematica can tell that
it is not finished after the first line. For example, you can enter 3* on one line and 4 on the
next.
In[21]:= 3 *

4
Out[21]= 12

But you cannot enter 3 on the first line and *4 on the second.
In[22]:= 3
*4
Out[22]= 3

If you use parentheses, you can avoid this problem.


In[23]:= (3
*4)
Out[23]= 12

With the notebook interface, you can input as many lines as you like within an input
cell; Mathematica will evaluate them all when you enter still obeying the rules
stated above for any incomplete lines.
1 An introduction to Mathematica 23

Finally, you can enter a comment – some words that are not evaluated – by entering
the words between (* and *).
In[24]:= D[Sin[x], (* differentiate Sin[x] *)
{x, 1}] (* with respect to x once *)
Out[24]= Cos x

Alternate input syntax


There are several different ways to write expressions in Mathematica. Usually, you will
simply use the traditional notation, fun[x], for example. But you should be aware of
several alternatives to this syntax that are widely used.
Here is an example using the standard function notation for writing a function with
one argument.
In[25]:= N
Out[25]= 3.14159

This uses a prefix operator.


In[26]:= N
Out[26]= 3.14159

Here is a postfix operator notation.


In[27]:= N
Out[27]= 3.14159

For functions with two arguments, you can use an infix notation. The following
expression is identical to N[ ,30].
In[28]:= N 30
Out[28]= 3.14159265358979323846264338328

Finally, many people prefer to use a more traditional syntax when entering and
working with mathematical expressions. You can compute an integral using standard
Mathematica syntax.
In[29]:= Integrate 1 Sin x , x
x x
Out[29]= Log Cos Log Sin
2 2
24 An Introduction to Programming with Mathematica

The same integral, represented in a more traditional manner, can be entered from palettes
or keyboard shortcuts.
1
In[30]:= x
Sin x
x x
Out[30]= Log Cos Log Sin
2 2
Many mathematical functions have traditional symbols associated with their opera-
tions and when available these can be used instead of the fully spelled-out names. For
example, you can compute the intersection of two sets using the Intersection function.
In[31]:= Intersection a, b, c, d, e , b, f, a, z
Out[31]= a, b

Or you can do the same computation using more traditional notation.


In[32]:= a, b, c, d, e b, f, a, z
Out[32]= a, b

To learn how to enter these and other notations quickly, either from palettes or
directly from the keyboard using shortcuts, refer to the 2D Expression Input section in the
Front End category of the Help Browser.

The front end and the kernel


When you work in Mathematica you are actually working with two separate programs.
They are referred to as the front end and the kernel. The front end is the user interface. It
consists of the notebooks that you work in together with the menu system, palettes (which
are really just notebooks), and any element that accepts input from the keyboard or mouse.
The kernel is the program that does the calculations. So a typical operation between the
user (you) and Mathematica consists of the following steps, where the program that is
invoked in each step is indicated in parentheses:

• enter input in the notebook (front end)

• send input to the kernel to be evaluated by pressing - (front end)

• kernel does the computation and sends it back to the front end (kernel)

• result is displayed in the notebook (front end)

There is one remaining piece that we have not yet mentioned; that is MathLink.
Since the kernel and front end are two separate programs, a means of communication is
1 An introduction to Mathematica 25

necessary for these two programs to “talk” to each other. That communication protocol is
called MathLink and it comes bundled with Mathematica. It operates behind the scenes,
completely transparent to the user.
MathLink is a very general communications protocol that is not limited to communi-
cation between the front end and the kernel, but can also be used to set up communication
between the front end and other programs on your computer, programs like compiled C
and Fortran code. It can also be used to connect a kernel to a word processor or spread-
sheet or many other programs.
MathLink programming is beyond the scope of this book, but if you are interested,
there are several books and articles that discuss it (see the References at the end of this
book).

Errors
In the course of using and programming in Mathematica, you will encounter various sorts
of errors, some obvious, some very subtle, some easily rectified, and others not. We have
already mentioned that it is possible to send Mathematica into an infinite loop from which
it cannot return. In this section, we discuss those situations where Mathematica does finish
the computation, but without giving you the answer you expected.
Perhaps the most frequent error you will make is misspelling the name of a function.
Here is an illustration of the kind of thing that will usually happen in this case.
In[33]:= Sine 1.5
General::spell :
Possible spelling error: new symbol name "Sine" is
similar to existing symbols Line, Sin, Sinh . More…

Out[33]= Sine 1.5

Whenever you type a name that is close to an existing name, Mathematica will print a
warning message like the one above. You may often use such names intentionally, in which
case these messages can be annoying. In that case, it is best to turn off the warnings.
In[34]:= Off General::spell
Now, Mathematica will not report that function names might be misspelled; and,
when it cannot find a definition associated with a misspelled function, it returns your input
unevaluated.
In[35]:= Intergate x2 , x

Out[35]= Intergate x2 , x
26 An Introduction to Programming with Mathematica

You can turn these spell warnings back on by evaluating On[General::spell].


In[36]:= On General::spell
Having your original expression returned unevaluated – as if this were perfectly
normal – is a problem you will often run into. Aside from misspelling a function name, or
simply using a function that does not exist, another case where this occurs is when you give
the wrong number of arguments to a function, especially to a user-defined function. For
example, the BowlingScore function takes a single list argument; if we accidentally leave
out the list braces, then we are actually giving BowlingScore 12 arguments.
In[37]:= BowlingScore 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Out[37]= BowlingScore 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10

Of course, some kinds of inputs cause genuine error messages. Syntax errors, as
shown above, are one example. The built-in functions are designed to usually warn you of
such errors in input. In the first example below, we have supplied the Log function with an
incorrect number of arguments (it expects one or two arguments only). In the second
example, FactorInteger operates on integers only and so the real number argument
causes the error condition.
In[38]:= Log 2, 16, 3
Log::argt : Log called with 3
arguments; 1 or 2 arguments are expected. More…

Out[38]= Log 2, 16, 3

In[39]:= FactorInteger 12.5


FactorInteger::facn : Argument 12.5` in
FactorInteger 12.5 is not an exact number. More…

Out[39]= FactorInteger 12.5

Getting help
Mathematica contains a vast array of documentation that you can access in a variety of
ways. It is also designed so that you can create new documentation for your own functions
and program in such a way that users of your programs can get help in exactly the same
way as they would for Mathematica’s built-in functions.
If you are aware of the name of a function but are unsure of its syntax or what it does,
the easiest way to find out about it is to evaluate ?function. For example, here is the
usage message for ParametricPlot.
1 An introduction to Mathematica 27

In[40]:= ?ParametricPlot
ParametricPlot fx, fy , u, umin, umax produces a parametric
plot of a curve with x and y coordinates fx and fy generated
as a function of t. ParametricPlot fx, fy , gx, gy , ... ,
u, umin, umax plots several parametric curves. More…

Also, if you were not sure of the spelling of a command (Integrate, for example),
you could type the following to display all built-in functions that start with Integ.
In[41]:= ?Integ*

System`
Integer IntegerExponent IntegerQ Integrate
IntegerDigits IntegerPart Integers

Clicking on one of these links will produce a short usage statement about that
function. For example, if you were to click on the Integrate link, here is what would be
displayed in your notebook.
Integrate f, x gives the indefinite integral of f with respect
to x. Integrate f, x, xmin, xmax gives the definite
integral of f with respect to x from xmin to xmax. Integrate
f, x, xmin, xmax , y, ymin, ymax gives a multiple
definite integral of f with respect to x and y. More…

Clicking the More… hyperlink would take you directly to the Help Browser where a
much more detailed explanation of this function can be found.
You can also get help by highlighting any Mathematica function and pressing the F1
key on your keyboard. This will take you directly into the documentation for that function
in the Help Browser.

The Help Browser


Mathematica contains a very useful addition to the help system called the Help Browser.
The Help Browser allows you to search for functions easily and it provides extensive
documentation and examples.
To start the Help Browser, select Help Browser… under the Help menu. You should
quickly see something like the following:
28 An Introduction to Programming with Mathematica

Notice the eight category tabs near the top of the Help Browser window. Choosing
the Add-ons & Links tab will give you access to all of the packages that come with each
implementation of Mathematica. Similarly, choosing The Mathematica Book tab will give
you access to the entire Mathematica book that ships with each professional version of
Mathematica.
Suppose you were looking for information about three-dimensional parametric
graphics. First click the Built-in Functions tab, then select Graphics and Sound on the left,
then 3D Plots and finally ParametricPlot3D. The Help Browser should look like this:

Notice that in the main window, the Help Browser has displayed information about
the ParametricPlot3D function. This is identical to the usage message you would get
if you entered ?ParametricPlot3D.
1 An introduction to Mathematica 29

Alternatively, you could have clicked the Master Index tab and searched for “Paramet-
ricPlot3D” or even simply “parametric” and then browsed through the index to find what
you were looking for.
Many additional features are available in the Help Browser and you are advised to
consult your documentation for a complete list and description.
2 The Mathematica language

Expressions are the basic building blocks from which everything is built. Their
structure, internal representation, and how they are evaluated are essential to under-
standing Mathematica. In this chapter we focus on the Mathematica language with
particular emphasis on the structure and syntax of expressions. We will also look at
how to define and name new expressions, how to combine them using logical opera-
tors, and how to control properties of your expressions through the use of attributes.

2.1 Expressions

Introduction
Although it may appear different at first, everything that you will work with in Mathematica
has a similar underlying structure. This means things like a simple computation, a data
object, a graphic, the cells in your Mathematica notebook, even your notebook itself, all
have a similar structure – they are all expressions, and an understanding of expressions is
essential to mastering Mathematica.

Internal forms of expressions


When doing a simple arithmetic operation such as 3 4 5, you are usually not concerned
with exactly how a system such as Mathematica actually performs the additions or multiplica-
tions. Yet you will find it extremely useful to be able to see the internal representation of
such expressions as this will allow you to manipulate them in a consistent and powerful
manner.
Internally, Mathematica groups the objects that it operates on into different types:
integers are distinct from real numbers; lists are distinct from numbers. One of the reasons
that it is useful to identify these different data types is that specialized algorithms can be
used on certain classes of objects that will help to speed up the computations involved.
32 An Introduction to Programming with Mathematica

The Head function can be used to identify types of objects. For numbers, it will
report whether the number is an integer, a rational number, a real number, or a complex
number.
1
In[1]:= Head 7 , Head , Head 7.0 , Head 7 2
7
Out[1]= Integer, Rational, Real, Complex

In fact, every Mathematica expression has a Head that gives some information about
that type of expression.
In[2]:= Head a b
Out[2]= Plus

In[3]:= Head 1, 2, 3, 4, 5
Out[3]= List

Atoms
The three basic building blocks of Mathematica – the atoms – from which every expression
is ultimately constructed are, symbols, numbers, and strings.
A symbol consists of a letter followed without interruption by letters and numbers.
For example, both f and the built-in Integrate are symbols.
In[4]:= Head f
Out[4]= Symbol

In[5]:= Head Integrate


Out[5]= Symbol

In Mathematica, built-in constants all are Symbols.


In[6]:= Head , Head , Head EulerGamma
Out[6]= Symbol, Symbol, Symbol

Symbols can consist of one or more concatenated characters so long as they do not begin
with a number.
In[7]:= Head myfunc
Out[7]= Symbol
2 The Mathematica language 33

The four kinds of numbers – integers, real numbers, complex numbers and rational
numbers – are shown in the list below.
5
In[8]:= Head 4 , Head , Head 5.201 , Head 3 4
7
Out[8]= Integer, Rational, Real, Complex

A string is composed of characters and is enclosed in quotes. They will be discussed


in detail in Section 3.5.
In[9]:= Head "Mathematica"
Out[9]= String

The structure of expressions


As mentioned earlier, everything in Mathematica is an expression. Expressions are either
atomic, as described in the previous section, or they are normal expressions, which have a
head and contain zero or more elements. Normal expressions are of the following form,
where h is the head of the expression and the ei are the elements which may themselves be
atomic or normal expressions.

h e1 , e2 , …, en

Although we indicated that you can use Head to determine the type of atomic
expressions, this is entirely general. For normal expressions, Head simply gives the head of
that expression.
In[10]:= Head a b c
Out[10]= Plus

To see the full internal representation of an expression, use FullForm.


In[11]:= FullForm a b c
Out[11]//FullForm=
Plus a, b, c

In[12]:= FullForm a, b, c
Out[12]//FullForm=
List a, b, c

The important thing to notice is that both of these objects (the sum and the list) have
very similar internal representations. Each is made up of a function (Plus and List,
34 An Introduction to Programming with Mathematica

respectively), each encloses its arguments in square brackets, and each separates its argu-
ments with commas.
Regardless of how an atomic or normal expression may appear in your notebook, its
structure is uniquely determined by its head and parts as seen using FullForm. This is
important for understanding the Mathematica evaluation mechanism which depends on the
matching of patterns based on their FullForm representation, a subject we will turn to in
detail in Chapter 6.
The number of elements in any expression is given by its length.
In[13]:= Length a b c
Out[13]= 3

Here is a more complicated expression.


In[14]:= expr Sin x a x2 bx c

Out[14]= c bx a x2 Sin x

Its head is Times because it is composed of the product of Sin[x] and the quadratic
polynomial.
In[15]:= Head expr
Out[15]= Times

Its length is 2 since it only contains two factors.


In[16]:= Length expr
Out[16]= 2

Although the FullForm of this expression is a little harder to decipher, if you look
carefully you should see that it is composed of the product of Plus[c,Times[b,x],
Times[a,Power[x,2]]] and Sin[x].
In[17]:= FullForm expr
Out[17]//FullForm=
Times Plus c, Times b, x , Times a, Power x, 2 , Sin x

There are several important differences between atomic expressions and nonatomic
expressions. While the heads of all expressions are extracted in the same way – using the
Head function – the head of an atom provides different information than the head of other
expressions. For example, the head of a symbol or string is the kind of atom that it is.
In[18]:= Head Integrate
Out[18]= Symbol
Exploring the Variety of Random
Documents with Different Content
into his blood. At the same instant he was conscious of a stab of
shame. It was the flesh, the draperies, the trappings to which his
pulses responded; it was not the magical secret which was contained
in the miniatures upon the walls, in the passionate delicacy of the
cadences which sobbed themselves out liquidly under the siren’s
touch of this beautiful woman.
He stood in front of the cosy fire, glass in hand. A soft warmth
overspread his being. His eyes glanced from the white shoulders of
the enchantress to the thousand and one hues which were blended
so cunningly in the carpets and tapestries. The subtle playings of
light and shadow, the mellow effects of the atmosphere, the
softness of the music, began to assail his senses with indescribable
pangs. He feasted his eyes, his ears, his nostrils; they rewarded him
with gladness. His heart beat violently.
“These rare kinds of genius, are they not barbarous?” he said, when
the siren had ceased to cast her fingers.
“It is like children lisping,” she said, half-turning her head, with a
smile that curved her mouth entrancingly.
“Yes,” said the young man, “poetry, romance, imagination are
primitive; they belong to the childhood of nations, to the dawn of
new worlds. What a divine inspiration these sweet-voiced children of
nature who are bought out of due time, these unhappy Poles,
Germans, and Frenchmen bring to their despair. Instead of sitting
down in black coats to make their music into beef and mutton, they
should be tripping through the glades piping to the birds, the trees,
the bright air.”
“This is a mad fellow, my angel,” said Mr. Whitcomb indulgently, “but
if you are gentle with him you may find him amusing.”
“Mr. Northcote will amuse me enormously,” said the lady, with a
demure glance.
“Is it thus you rebuke his madness?” the young man asked.
“On the contrary, I don’t think I have ever seen a sanity that is quite
so perfect.”
“Drop it,” said the solicitor, roguishly pinching her ear. “Beware of
dangerous turnings, my son. She is quite prepared to play George
Sand to anybody’s Alfred de Musset. She even does it to the
greengrocer when he comes round with his barrow. I understand
they discourse divinely together upon the subject of cabbages.”
“But Witty is too much the man of the world to be jealous about it,”
she purred.
“If Pussy hasn’t the opportunity to sharpen her claws on a sofa or an
ottoman, she doesn’t mind a wicker-work chair.”
“Witty, darling,” said the lady, “I hate to find rudeness keeping
company with real distinction of mind.”
“Upon my word,” expostulated Northcote, seeking to measure her
depth, “I consider that rebuke to be much prettier than the one
bestowed upon me.”
“When, Mr. Northcote, did I rebuke you?”
“Did you not say I should amuse you enormously?”
“Is not that the only compliment a woman has the power to pay
nowadays?”
“Yes, Noodle,” said Mr. Whitcomb, laughing; “but don’t you see how
young he is, and therefore how serious? Who would call ‘enormously
amusing’ a fitting compliment for one of the seven champions of
Christendom? This is a devil of a fellow.”
“I can roar you like any sucking dove,” said the young man.
“How it would thrill one to hear you do it!” said the lady, enfolding
him with large eyes.
“He is a man of destiny,” said Mr. Whitcomb; “he carries a genie in
his pocket.”
“Oh!” said the lady, with clasped hands.
“One of these fine mornings he will stand the world on its head.”
“O-o-o-o-h!” said the lady.
“And having done that,” said Northcote, “this amazing fellow will dig
a hole in the universe for to bury the moon.”
“I would that all men had ambition,” said the lady, looking down at
her shoe. “If Witty had only a little of that precious salt which forms
a sediment at the bottom of every fine action he would be one’s
beau-ideal of a hero, a Christian, and a philosopher.”
“Minx!” exclaimed the solicitor. “If it were not for my ambition I
should never rise from my bed.”
“So this wonderful Mr. Whitcomb has no ambition!” said Northcote.
“You see I have found his character so complex, that in my capacity
of an amateur of the human mind I am picking it out, here a little,
there a little, piece by piece.”
“You must give him no marks for ambition,” said the lady. “But since
when did you become acquainted with him not to have found out
that?”
“Since this evening at ten.”
“Ah, then, you are absolved. He will certainly baffle you at first.”
“He is wholly incomprehensible to me. He is a man of moods who
oughtn’t to have any.”
The lady clapped her hands in a little ripple of glee.
“How right,” she cried. “In a dozen little words you have shown me
the nothingness of my own knowledge.”
“Of course he has, Vapid One,” said Mr. Whitcomb. “Have I not told
you he carries a genie in his pocket?”
“Then that is why his eyes are so deep and bright,” said the lady,
turning to peruse Northcote again with an unfathomable coquetry;
“and would you not say, Witty, that the genie is in some sort
responsible for his mouth?”
“Is this public laying of one another upon the dissecting-table a new
parlor-game that has been brought into vogue by the long winter
evenings, may I ask?” said Mr. Whitcomb, concealing a yawn.
“Pray do not be insolent, Witty. The proper study of mankind is
Man.”
“In the words of Pope,” said the solicitor, turning to replenish his
glass.
“You can see how Mr. Whitcomb baffles me,” said Northcote, who did
not propose to lose the opportunity of following up his clue.
“Is it his attitude to hansom cabmen that makes him so dark?”
“That is contributory. But it is mainly because he has come before
me in the guise of a waverer that I stand so much at fault. If one
knows anything about anything one would be prepared to affirm that
nature had designed Samuel Whitcomb to know his own mind.”
“He does as a rule. I have never known him waver in anything; but
then, of course, it is only quite recently that he has begun to
associate with dangerous persons who keep a genie.”
“Do you suggest that he is susceptible to such a thing as a genie?
Would it have a malign influence upon him, do you suppose?”
“I would suggest it to be likely in the highest degree.”
“Now, look here, my young friends,” interposed the solicitor at this
point, with a broad good humor, “Samuel Whitcomb does not
propose to play the part of the corpse at the lecture on anatomy.”
“You will help yourself to another drink like a good boy,” said the
lady severely; “and you will please to say nothing until we have dealt
with your ‘case.’ Your character need not fear the lancet and bistoury
of true science. Tell me, Mr. Northcote, wherein he is a waverer.”
“I am rejoiced to hear you put that question,” said the young man,
with a gesture of triumph he did not try to conceal, “for now it is
that I unfold my tale.”
XII
THE FAITH OF A SIREN

“At about ten o’clock this evening,” Northcote began, “as I was
kneeling in front of the fire—there was not any fire, by the way, as it
costs too much to afford one sometimes—in my miserable dwelling
at the top of Shepherd’s Inn, the oldest and most moribund of all the
buildings in Fleet Street, who should come climbing up to the
topmost story of the rickety and unwholesome stairs, under which
the rats have made their home for many generations, but Mr.
Whitcomb. And what do you suppose was his business?”
“He wished to buy one of your pictures.”
“Ah, no, I am not a painter.”
“I thought there was a chance of it, since they say all very good
painters are so poor. But perhaps you are a little too fierce, although
I am told these impressionists are terrible men.”
“The painting of pictures is one of the few things I have not
attempted,” said the young man, consenting to this interruption that
he might sit for his own portrait.
“Well, I should not say you are a writer of fiction. They are so tame.
Besides they are all nearly as rich as solicitors.”
“Why not a poet?”
“Why not? although your fierceness would make you a dramatic, not
a lyric one. Still it is impossible for you to be a poet, because I am
sure that Witty would never have climbed up all those stairs to your
miserable garret—I feel sure it is a garret with a sloping roof with a
hole in it—”
“There is a pool under the hole which has been caused by the
percolation of water—”
“On to the atrocious bare boards, its occupant being much too poor
to afford a carpet. Yes, Witty would never have climbed up to your
garret if you had been a poet. Or stay, he might, had you been Mrs.
Felicia Hemans. As you are a seeker of documentary evidence, he
has been known to recite her poems, at the request of the rector of
this parish, to a Sunday-school party.”
“Base woman,” said the solicitor, with an air of injury; “I claim to be
an admirer of the poet Longfellow.”
“Never, Witty, in your heart; it is merely your fatal craving to be
respectable in all things. But in the matter of poetry you must be
content to remain outside. You would never have climbed those
rickety stairs to that cold garret to see John Keats.”
“Well, now, Featherhead, did I not tell you at the first that our young
friend was England’s future Lord Chancellor?”
“I will never believe that; I will never believe that his destiny is the
law. His eye has amazing flashes; and is there not a beautiful
eloquence burning in his mouth? I cannot think of him as rich Witty,
and successful Witty, and smug Witty, like you atrocious lawyers. He
is one who would be an overthrower of dynasties, a saviour of
societies.”
“You are letting your tongue wag, Noodle. If you talk so much it will
take the young man until daybreak to unfold his story.”
“I am an advocate,” said Northcote.
“An advocate,” said the lady softly; “yes, I think you may be that.
One no more associates an advocate with the law than one
associates a poet with a publisher.”
“You would say,” said Northcote, “that it is the function of an
advocate to draw his sword for the truth, for progress, for justice,
for every human amenity?”
“I would, indeed. Why, if one thinks about it, surely it is nobler to be
an advocate than to be a poet or a soldier. One might say it was the
highest calling in the world.”
“Then let us say it,” said the young man, “for I verily believe it to be
so.”
“And what, pray, was Witty’s business with this advocate?”
“They are going to hang a woman; and Mr. Whitcomb, who to his
infinite complexities and many-sidedness as a citizen of the world
adds a leaven of the finest humanitarian principles, has undertaken
to save the poor creature from a fate so pitiful.”
“To hang a woman!” said the lady, drawing in her breath with a
sharp sound. “Is it still possible to hang a woman at this time of
day?”
“Perfectly,” said the young man. “They do it in every Christian
country.”
“Then the world has need for an advocate,” said the lady, with
horror in her eyes. “It is necessary that we should have yet another
champion for our sex in Christendom. Yes, this was he whom Witty
came to seek in that garret at the top of all those rickety stairs.”
“He came to seek, and found no less a person,” said Northcote. “And
having found this authentic champion of your sex, he gave him a
mandate to plead on behalf of this unfortunate creature, the least
happy of all its members.”
“What a moment of high inspiration for us and for him,” said the
lady, with a glance of tenderness.
“It was even as you say. But I would have you mark what follows.
Scarcely has he bestowed these high plenary powers upon one
whom he has ventured to select from among all the great multitude
to champion your sex in the name of humanity, than for a whim he
withdraws his mandate.”
“Impossible; it would be an outrage upon us.”
“Yes; unconditionally and peremptorily he withdraws his mandate.”
“Impossible; they will do the poor creature to death.”
“Yes, they will do her to death. He who has been called to the office
of averting her doom has decreed that she must walk to embrace it
without a friend to plead her cause before humanity.”
“Surely this cannot be; society itself must protest.”
“One expects it; yet things are as they are.”
The beautiful creature turned to the solicitor with an almost royal air.
“What, sir, can you find to say in your defence?”
Mr. Whitcomb gave a short laugh.
“I yield,” said he.
“You restore the mandate?”
“Yes, yes, yes! My blood be on my own head, but so it must be. It is
beyond flesh and blood to withstand such a pair. You, madam, are a
sorceress; and this fellow is the devil.”
“I am content to be a sorceress in the cause of my unfortunate sex,”
cried the lady; and turning to Northcote added gravely: “And is it not
high time that we acquired a devil for our advocate?”
Northcote, who from the moment of her first appearance had
foreseen a victory, took her hand to his lips impulsively, with an
expression of gratitude.
“I hope this will be all right,” said the solicitor, viewing his surrender
with a rueful smile. “You see it is the first time in my life that a
foreboding has overtaken me in the midst of action. Whether it is
the importance of the case, the obscurity of the advocate, or a
certain flamboyancy in his bearing which is so repugnant to an
English common lawyer, I cannot tell; but let me confess that I have
already a premonition that I have been guilty of a mistake. And I will
go farther,” said Mr. Whitcomb, with a wry laugh; “I even see ruin,
blue ruin for all concerned, hidden in this irresolute act. Sharp little
shivers go down my spine.”
“It is no more than the reaction,” said Northcote, “which attends our
highest resolves. Is it not in such moments that a man truly
measures himself? It must have been at the fall of the barometer
that Samson was shorn of his locks.”
“Is there not always a woman in these cases?” said the lady. “This
unfortunate creature whom our advocate is to deliver from the
gallows, may she not be a Delilah of some kind?”
XIII
BE BOLD, WARY, FEAR NOT

At these words, lightly spoken, Northcote grew conscious of an


indescribable sensation which he had never experienced before.
“If it were one’s custom,” he said, with a laugh as wry as the
solicitor’s, “ever to heed the note of prophecy, one might discern it
in your words. But I will not do so. Since that dark hour in which I
summoned the genie, have I not adopted as my device, ‘Be bold,
wary, fear not’?”
“Now you come to mention it,” said the solicitor, “it may be this talk
of the genie that has filled me with these forebodings.”
“That is very foolish, Witty,” said the lady. “You have but to look into
the eyes of our advocate to know what it is and where it dwells.”
“He is quite entitled to keep one, of course, but it is not usual to
take it into society. I sometimes think I may have a bit of a genie
myself, but I do what I can to keep it a profound secret from the
world.”
“Should a man venture to compliment himself, Witty, upon the score
of his reticence?”
“Would you not say,” inquired Northcote, “that all our reticences had
their roots in our cowardice?”
“I would love to say it if I dared. And I would love to say of our
advocate that his genie enables him to fear nothing.”
“Yes,” said Northcote, “you shall say that.”
“A man must have fear of some kind,” said the solicitor, “if he is to
succeed against enormous odds.”
“There may be a place for it in his reflections, but never in his
resolves. Hence you will discern how our reticence has its basis in
our cowardice.”
“Subtle brute,” said Mr. Whitcomb, giving his mustache a tug of
perplexity. “He is entering upon his special function of turning black
into white.”
“Nay,” said Northcote, “the subtlety is not mine, but Francis Bacon’s.”
“Good, O Advocate!” said the lady, as she rewarded him with bright
eyes. “You do well to confute the Philistine with a learned name.”
Again the young man carried the jewelled hand to his lips. He felt
the lithe fingers respond with a sweet and secret motion.
“Rogue!” said the solicitor, laughing. “George Sand and De Musset—
Polly Whitcomb and the greengrocer at the back door. Well, Mischief,
as you have entered into a compact with this fellow to get him his
way, play us another bit of a tune, he shall keep his brief, and we
will go to bed.”
“I knew we should force him to capitulate,” said Northcote to the
siren, as he arranged the stool before the piano.
“What must I play?” she said, looking down at her hands.
“Play me a bit of Beethoven, so that I may take him out with me into
the darkness of the streets.”
She played three movements of a symphony, and all his senses were
submerged in the colors of romance. These fragrant hues which had
a delicate aroma and pungency the imagination alone can impart
were of no time or country. There was nothing that the mind could
render as belonging to itself; the faculties which embody the
technical were overcome by the tumultuous surgings with which
they were oppressed. He seemed to be transfigured with the sense
of joy, to be overpowered with the knowledge that he was a living
man, able to breathe and to perform. The room had grown small
and heavy. He was consumed with an overmastering desire for the
spacious streets, for the largeness of the universe.
“There is a bed for you here,” said the beautiful player, almost before
the last phrase had ceased to vibrate under her touch. “We could
not think of turning you out at this hour.”
“I have not the least intention of staying,” said Northcote. “The
hospitality you have given me already has been too profuse. I feel
that I must roam for the rest of the night in the open streets, a
Flying Dutchman of the London slush. Perhaps I shall fancy myself
to be the mad music-maker of Leipsic, who walked at night on the
ramparts to weave his harmonies.”
“We cannot consent to your leaving us in this manner,” said the
hostess. “As for roaming through the night, it will not be good for
you. Nor is there the least necessity why you should.”
“You forget his genie,” laughed the solicitor. “The infernal thing will
drive him all over the suburbs of south London and send him home
via the Crystal Palace and Blackfriars Bridge.”
“He must not go to-night,” said the lady. “It will be a perfectly horrid
walk, and I believe the sleet has turned into rain. It will be awfully
cold and unpleasant. Besides, if anything happens to our advocate
he will not be able to deliver this unfortunate creature from her
doom.”
“It is useless to argue with a man who has got a genie,” said the
solicitor. “I have tried the experiment and therefore am in a position
to give evidence. What will overtake him in the way of adventures I
dare not conjecture; but of one thing I am assured—no earthly
power will cause him to alter his determination.”
“Alas! I know it,” said the lady, sighing. “He has a face that will yield
to nothing.”
This diagnosis proved to be correct, at least as applied to this
instance, as in spite of the humane entreaties of the lady, supported
by a banter which Mr. Whitcomb did not attempt to dissemble,
Northcote insisted on faring from their roof at a quarter-past three.
He bade them adieu with a cordiality that was eloquent of a deep
sense of friendship.
When Mr. Whitcomb returned to the drawing-room after having
shown the young man over the threshold of his residence, he faced
the lady with a half-smile of bewilderment.
“Extraordinary chap,” he said. “He frightens me, takes me out of my
depth. There is such a bee buzzing about in his bonnet that he
might come wofully to grief on Friday. If he does, there will be none
but myself to blame, for he is wholly without experience.”
“I think you may trust him,” said the woman softly.
“Well, you are a mass of instincts, Miss Pussy. And you counsel me
to stick to your advocate?”
“I do, Witty; closer than a brother. I think he is perfectly amazing. I
think he will make the fortunes of all who are connected with him.”
“Another Michael Tobin, would you say?”
“What a dunce it is,” said the lady, with an indulgent sigh. “Michael
and this man don’t inhabit the same hemisphere. Michael is a dear
fellow, brilliant, clever, but only surface deep; this is an ogre of a
creature, a monster, deep as the sea, of the proportions of the
universe.”
“Come, I say, Mrs. Noodle; they don’t call that sort to the bar. They
might find the purlieus of the law too confining.”
“If you have not yet learned to scorn my advice, Witty, take care
never to have this man against you. If you have him on your side
every time you go into court, you will not have many lost causes to
record.”
“He is clever, I grant you, but the worst of it is he knows it.”
“He is arrogant with power, Witty, which is somewhat different,
although it sounds the same. I think he is a perfectly terrible man,
and he looks so big and great and deadly. Did you notice his
enormous hands? Did you observe his chest? And that voice as soft
as a flute yet as deep as an organ?”
“You are completely conquered, Featherhead. Yet you would not call
this phenomenon precisely beautiful?”
“Strength is more beautiful than symmetry, I think; although I grant
you that huge square jowl verges upon the horrible. It is far worse
than yours, my dear, although the poor hansom cabmen are
constantly mistaking it for that of an eminent pugilist.”
“Well, little gal,” said the solicitor, “I shall heed you once more, since
your luck is proverbial. I am prepared to back our latest discovery
pretty heavily, although I must confess that when in cold blood I
catch myself thinking of his infernal genie he frightens me to death.”
XIV
A JURY OF TWO

In the meantime the subject of these speculations had entered the


night. Food and wine in unaccustomed quantities, the romance of
events, the spells cast by music and by a woman of signal beauty
and accomplishment, had provoked his energies to an insurgency
that had rendered them overbearing. He walked like a whirlwind, up
one street and down another, in the chill wet darkness, not knowing
whither he was bound. Soft yet wild strains of melody which still
floated through his brain mingled with a swarm of ideas which were
whirling about in it like so many atoms in a protoplasm. He moved
so fast in the endeavor to keep abreast of his thoughts that at times
he broke into a run.
The seductive, amiable, and brilliant woman, who had so nearly
succeeded in casting over him a delicious spell, began to fade from
his consciousness like the intangible occupant of a dream. She had
no appeal for him now. The feast at the restaurant, that phase of
color, warmth, and splendor in which for an hour the squalor of his
existence had been dispelled; the struggle to retain the treasure
which had been entrusted to his keeping by a supernatural agent;
the bizarre incident of the hansom cabman; and the personality of
the genial god out of the machine had now ceased to have
significance.
Indeed one thing alone merged his faculties in his overstimulated
thoughts. It was the packet which he could feel in the breast-pocket
of his coat, towards which his hands were straying constantly. These
pages of foolscap bound with red tape, were they not his magic
talisman? By that occult presence had not his thwarted bleak and
empty life been changed into an electrical existence crowded with
glory?
His brain bursting with ideas, he began to run faster and faster
through the maze of endless streets, lined with high garden walls,
portentously respectable dwelling-houses, lamps, shops, and
secretive silent-footed policemen. These frequently flashed their
lanterns upon him, for the manner of his progress had an illegal air.
Even at the height of this orgy of freedom, the question shaped itself
with the oddest definiteness as to whether it would not be expedient
to curb his paces, since if he were stopped, he feared lest he should
be able to render an account of himself that would be sufficiently
lucid to commend itself to the myrmidons of the law.
When at last his exertions had thrown him out of breath, and his
frame did not respond with quite the same unanimity to his passion,
he stopped under a lamp in the middle of a street on the side of a
steep hill, took out the precious document he carried, and began to
peruse it for sheer human pleasure. He even pressed his lips to this
prosaic thing, with no less of fervor, indeed with more abandonment
than he had saluted the hand of the sorceress who had been the
means of restoring it to his care.
“I must make her my saint, I must burn candles to her,” he
muttered, recalling her image with a sense of rapture.
As he stood under the lamp, a very large and slow-footed policeman
waddled up towards him, trying doors and casting the light of his
lantern down the areas he passed. As he went by, keenly scrutinizing
the figure of the young man, yet pretending not to notice it,
Northcote hailed him.
“Where might I be, policeman? I am strange to these parts.”
“Well,” said the policeman slowly and with effort, “you might be in
Balham, but you ain’t. Likewise, you might be at Charing Cross, but
you are not there, nuther.”
“I observe, policeman, that you have graduated in the school of
judicial humor,” said Northcote, delighted by the suavity of outline of
X012. “If every man had his rights, which of course it is utopian to
expect, you would be adding lustre to the bench. Your mental gifts
fit you equally to be a judge, a recorder, or a stipendiary magistrate.”
Such an exaggerated view of his merits produced a deep-founded
suspicion in the honest breast of X012.
“If every man had ’is rights,” said the custodian of the peace,
speaking slowly and with effort, and eying Northcote with the
solemnity of a horse, “you’d be took up on suspicion, young feller,
and charged with loitering with intent.”
Northcote dispelled the suburban quietude with a guffaw.
“Being unwilling,” said he, “to impale myself upon that spiked railing
which calls itself the law, I ought to be extremely careful to refrain in
its presence from the vexed and overmuch discussed question of
whether the badinage of its minions is wit, wisdom, humor, or a
veritable cesspool of human inanity.”
X012 was so much astonished by these words and the forcible mode
of their delivery that he pulled his whistle out of his coat, and
proceeded to toy with it in an irresolute fashion. Before he had
decided to summon aid by blowing it, there appeared round the
corner of an adjacent street a second constable, in all essentials of
bearing, physique, and mental energy the perfect replica of himself.
“I’m glad you’ve come, Bill,” said X012. “I’ve got a rum one ’ere. I
don’t know what he’s been drinking, but you should just hear his
languidge. Here he was under this lamp, a-purtendin’ to read a
newspaper at twenty past four by the mornin’.”
“Noticed his mug?” said his confrère Z9. “Bob Capper, the
’ousebreaker, who just done in ’is last seven stretch an’ was let out
on license last Tuesday.”
“Got it in one!” said X012, not without enthusiasm. “We ’ad better
take him to the station and have ’im searched.”
“This is the result of a misplaced jocularity in the presence of
professional wits,” said Northcote, with an amiability that was viewed
with considerable disfavor by both constables. “I hope you will
forgive me, my friends. The only excuse I can urge for impinging
upon the prerogative of the legal supernumerary, if I may so express
myself, is that as one day I am certain to be a judge, I feel it to be
due to the lofty elevation I shall be called to occupy, and of which I
intend to be so signal an ornament, to neglect no opportunity of
acquiring these cardinal principles of humor, dangerous, double-
edged implement though it be, which can only be done by
association with those past-masters who as the crowning glory of
our admirable legal system inhabit it in choice perfection in all its
branches. I hope, my friends, I have made myself perfectly clear.”
“Clear as mud,” said Z9.
“Impidence!” exclaimed X012; “downright impidence! Certin to be a
judge! Why, Lord love me, young feller, if ever they ax you to be the
judge of a pair o’ pullets at a poultry show you’ll be lucky.”
“Balmy,” said Z9, tapping his forehead with an air of Christian pity.
“You are very probably right,” said Northcote. “I suspect there is a
basis of truth in this scientific opinion which you have embodied in
so expressive an idiom. But at the same time I would ask you, is it
not a somewhat extreme view to take of the mental condition of a
barrister-at-law who has been nominated to appear at the court of
the Old Bailey to-morrow morning at the hour of ten-thirty to defend
one Emma Harrison, who at that time and in that place will stand
her trial for wilful murder?”
“A-going to defend Emma Harrison!” exclaimed the constables.
“Why, what will he be saying next?”
“I do say that, my friends,” said Northcote, with a note of
imperiousness in his voice that was not without its effect on these
astonished minions of the law. “And I want you both to stand back a
yard or two against the railings, while I advance to the curb; and
further, I want you for a few minutes to imagine that you are the
jury, and I will rehearse the opening of my speech for the defence. I
shall begin something like this.”
“Oh, will you now?” muttered Z9 to his companion. “Well, if this
don’t beat cock-fighting!”
Both these constables, overawed already by the authentic manner of
the advocate, were now devoured by curiosity.
“Listen,” said he. “I rise in my place with this bundle of papers in my
hand, which I shall not consult, but shall cling to to gain confidence,
and I shall say: May it please your lordship and gentlemen of the
jury, this is a dreadful issue you are sworn to try. Indeed it would be
difficult for the human conscience to conceive an ordeal more
repugnant to the moral nature of man, one in sharper antagonism to
those principles that are his priceless inheritance, than is revealed to
you by the situation in which you stand. It is not by your own choice
that you come to take your places in this assembly. It is not in
obedience to your own instincts that you have left your toil to
subscribe to a law which is not of your own making. I venture to
affirm this without fear, for is not this ordeal into which you are
thrown in deadly conflict with the behests of that unfearing spirit
who, nineteen centuries ago, discovered the only possible faith for
His kind?
“It is as the inheritors, gentlemen, of an inimitable tradition, not as
administrators of a penal code, that I venture to address to you
these words. And let me tell you why I venture to address you in this
fashion. It is because the life of a fellow creature is at stake; it is
because sitting here in conclave in this place you are enmeshed in
the most grievous ordeal that the fruit of human imperfection is
able, at this time of day, to impose upon you. For that reason,
gentlemen, I conceive that you are entitled to take your stand upon
a lofty and secure platform to survey this issue, a platform which has
been raised for the oppressed, the unhappy, and those who are
doubtful of their way, by the travail of the choicest spirit in the
annals of human nature.
“Gentlemen, you are called upon to adjudicate upon the life of a
woman. You are called upon to do so at the bidding of a formula,
whose hideous and obsolete enactments are the fruit of an imperfect
culture of a partial and unsympathetic interpretation of those laws to
which every civilized community owes its name. Gentlemen, you are
called upon to adjudicate upon the life of a woman; you rate-payers
of London, you gentle and devout citizens, you to whom life has
given as the crown of your endeavor, as the consecration of your
painful daily labor, mothers, wives, and daughters of your own.
“Yes, gentlemen, we must indeed ascend the loftiest and most
secure platform known to us, to survey the ordeal that our own
imperfection has presented to us.
“You have heard the words that have fallen from the lips of my
learned friend, the counsel for the Crown. You have examined the
facts which he has marshalled before you. You have noted the
inferences which he has not been afraid to draw. You have been
thrilled by the union of a consummate skill with a consummate
learning. All that is base, sordid, and unworthy in the human heart
has been stripped naked before your eyes. The smallest acts of this
unfortunate woman have been shown to you as vile; even the
aspirations which are allowed to ennoble her sex have been
rendered abominable. Every kind of mental and moral degradation
has been made to defile before you; for verily there is no limit to the
talent of this accomplished gentleman.
“That such a talent should have taken service with an outworn
formula is a great public danger. For just as our common humanity is
able to assure us that the acts of the most wicked are not always
wrong, so those of the finest integrity would not bear dissection at
the hands of a cold and scientific cynicism. Our every act has two
faces. One is presented to belief, the other to unbelief; one is
presented to truth, the other to error. And as this penal code of ours,
which we traverse constantly with searchings of heart, is itself a
survival of a time of gross darkness, called into being by unbelief
and fostered by error, the acts of the best and worthiest among us
are liable to be visited by the sword of the avenger, in other words
by justice. I am convinced that if any one of you gentlemen, or any
private citizen, was called upon to rebut the most awful charge that
can be levelled against him, innocent as you might be, innocent as
he might be, it would be found immensely difficult, I will not say
impossible, to combat the deadly array of inferences which would be
marshalled against you in the interests of this penal code by one of
the most talented of its servants. The mere fact that you had come
to stand your trial in this noisome chamber, itself stained with a
thousand crimes committed in the name of justice, and that a cruel
chain of events had forced you to vindicate your kinship with the
divine will in the precincts of this charnel-house—it is well,
gentlemen, that the windows are kept so close, for who would have
this foulness mingle with the air of London?”
For the best part of an hour in that raw winter morning, with a
drizzling rain falling incessantly, did Northcote continue to rehearse
his address to the jury. The amused intolerance of his hearers
yielded to an intense interest. They had been present in court on
many occasions and had heard these things for themselves, but
never had they listened to a voice of such dominion, of such volume
and majesty, a voice capable of such burning appeal. They stood
merely at the threshold of the argument, it was true; but the art of
the orator unfolded it, made it clear. His natural magic, his
incommunicable gift, rendered it with the harmony of music, so that
before the end these oxlike custodians of the peace, far from
growing weary of their situation, began to view with emotion the
injury that threatened an outcast from society.
“Go on, sir,” said Z9 humbly; “you’ve the gift and no mistake. They’ll
not be able to hang her if you talk to ’em that way.”
“This is not quite the form it will take, you know,” said Northcote,
whose exertions had been so great that he was breathing heavily
and dripping with perspiration. “It is only a sort of opening roughly
blocked out. It will have to be rendered a bit finer, so that it pins
them like a fly on a card.”
“You’ll pin them to-morrow, sir,” said Z9; “you’ll get your verdict, see
if you don’t!”
Z9 spoke with the proud consciousness of one who can respond to
an intellectual pleasure. X012, with a mental organization of less
delicacy, although impressed by so rare a personality, yet retained
the reverence for facts of the honest Englishman.
“He’ve a gift right enough, Bill,” said X012 magisterially, “but the law
is the law to my mind; and black’s black an’ white’s white. If this
woman done the crime—I don’t say she did, mind—the law will ’ang
her. An’ rightly, too. This gentleman is a book-learned man and a
horator,—I know that because I heard Gladstone on Blackheath,—
but the law is the law and horatory ain’t a-going to alter it.”
“I am obliged to you both for your courtesy,” said Northcote, with a
perfect gravity, “and my obligation is even the deeper for the
opinions you have been good enough to express. You are prototypes
of the twelve honest men I am going to sway; and I take it that if
my address were to be launched in its present immature shape, you,
sir, would record your vote for an acquittal, and you, sir, for the
severity of the law?”
“The law is the law I say,” said X012, inflating his chest before the
honor of this direct canvass of his intelligence, “an’ words is words,
although, mind you, sir, I respec’s you, because I heard Gladstone
on Blackheath.”
“I assume,” said Northcote, “that although you admired Gladstone’s
oratory, you did not allow it to influence your judgment?”
“That’s ’is pig-headedness, sir,” said Z9. “That’s just like a Tory; great
horators can talk till all’s blue, and then they can’t get daylight into a
Tory. ‘The law is the law,’ says he; an’ if it come to, he’d hang his
own fayther.”
“I take it, policeman, that you try to keep an open mind, a mind
accessible to new impressions?”
“That is so, sir,” said Z9. “I say with you, sir, that although the law is
the law, human natur’ is human natur’. And although Bill ’Arper is
just a common p’liceman with on’y one stripe, an’ not a lawyer like
you, sir, nor a beak, nor a judge, ’e never goes into court and a-
takes off ’is ’elmet but what ’e feels ’igh-minded.”
“Then, policeman, regarding you in the light of a juryman, it is most
probable that you would want mercy to be extended to the prisoner,
in spite of the law, if you happened to be in your present frame of
mind?”
“Yes, sir, I should in my present frame o’ mind.”
“More shame to you, Bill,” said X012; “you are a nice bloke to be a
copper, an’ no mistake.”
“Close it, ’Orrice,” said Z9, with a restrained enthusiasm; “you
bloomin’ Tories are so thick’eaded you don’t know nothing.”
“Well, gentlemen,” interposed the advocate, brushing the water from
his brief, “as I observe you to be on the brink of an altercation, I will
hasten to discharge you with my best thanks for your kind attention
in order that you may have it out. For the subject will engage your
powers worthily; pursue it, and it will take you into strange places.
But before I leave you to do so, may I ask where I am?”
“Bottom o’ Sydenham ’ill, sir,” chimed both constables as one.
“Good morning, my friends. I must leave you to ponder this subject
or I shall not get home to breakfast.”
The two myrmidons of the law stepped together into the middle of
the road to watch this astonishing figure ascend out of their ken.
“Well, if ’e don’t beat all as ever I ’eard!” was the comment of Z9.
“’E’s not got ’er off yet, and ’e won’t nuther,” rejoined X012. “She’s a
wrong un; an’ if they let ’er off, it won’t be fair to peace.”
“Well, ’e can talk. ’E kind of got ’old of me. I could ha’ stood there all
day.”
“’E kind o’ did me too, but I should shake him off in court. You’ll see
the beak will put a muzzle on ’im. He warn’t talkin’ law, and you’re
no good in court unless you talk law. The old bloke and them K. C.’s
will not stand that sort o’ lip, see if they does.”
“Well, ’ere’s the sergeant comin’. But just to show there’s no ill-
feelin’, I’ll ’ave ’arf a pint with you, mate, that ’e gets her off.”
“Make it a pint, matey. A pint seems more legal.”
XV
TRUTH’S CHAMPION

Northcote had only a hazy notion of his whereabouts. He had never


been in these high latitudes before. He had a dim idea that London
lay “over there;” but upon ascending the steep hill that lay before
him, he found that “over there” was merged in the dark and
enormous bulk of the Crystal Palace.
“Whitcomb was right in his topography,” he laughed. “This is the
route he predicted I should take; therefore it is a perfectly fair
inference to regard it as the wrong one.”
He hailed yet another minion of the law, who no less than his
brethren was communicative.
“You are going away from London as fast as your legs will take you,”
said Z201, and proceeded to set a course which in itself was so
intricate that the young man by no means pledged himself to follow
it.
The terrific central energy still driving him, the wayfarer strode forth
through the rain with an undiminished vigor. By now his clothes were
saturated and lay upon him heavily. But nothing could abate the
force of these concentrated fires which bore him so lightly mile after
mile. Not only did they burn with splendor, but also with a vital
clarity. His lips moved with the phrases that sprang upon them; the
sense of dull power, of unused native force, which had oppressed
him like a nightmare during many nights and days, had been fused
all at once into an immense fecundity of expression. Each minute
blood-vessel that formed a web round the ball of crystallized energy
that was his brain was big with its own peculiar, original, and special
idea. The strangest vistas had opened before his eyes. His faculties
in the first flush of their self-consciousness had grown insolent and
overbearing.
How could a body of common citizens hope to stand against the
battery that would be directed upon them! All the subtleties of the
sophists, all the enthusiasms of the creeds would be as naught in
the presence of such an overweening personal force. How could
such insignificant fragments as these, the mere excrescences of the
universal scheme, who could not make a mind among them, hope to
retain the all-too-precarious standard of their probity when touched
by the wand of the magician? He laughed aloud to the rain when his
thoughts reverted to the two perplexed constables he had left at the
bottom of Sydenham Hill; and how, in spite of the tentativeness of
the effort, as his talent had mounted in him, so that presently its
irresistible force had seemed even to surprise himself, these two
stolid, unemotional Englishmen had nodded their heads in approval,
and had hung breathless upon his words. Only one of God’s great
advocates could hope to perform that miracle under a gas-lamp in
the wind-swept streets on a wet and chill winter’s morning. The old
mystics, delivering with a divine naïveté their surprising message to
mankind, could never have accomplished a feat more wonderful.
His eyes veiled in darkness, his head high-poised yet thrust forward,
his mouth and nostrils filled with cold and deep draughts of air, his
whole being was surrendered to an orgy of freedom and power. For
the first time since he had come to maturity he had found an
occupation for his ferocious energies. It was no unworthy task by
which they were confronted. Thirty was usually the age at which
genius elected to give to the world its first masterpiece. And was it
not as seemly that an advocate should rejoice in a theme as the
statesman, the musician, or the poet? This first essay should be as
complete, as audacious, and as worthy of the sanction of the best
minds of the time, as the chefs-d’œuvres of other representative
spirits. It should stand as a landmark in an art as little understood as
that of truth itself.
Old men on the Woolsack, the most reverend seigniors of the law,
advocates who had received the homage the age is accustomed to
lavish on a scanty pretext, should stand aghast before an alarming
iconoclasm of which he would be the pioneer. His ideas should prove
so revolutionary that these practitioners, complacently drawing their
emoluments, should foregather to turn this magnificent ruffler out of
his inn. The scathing criticisms which the elect of all ages launch
against a Jesus, a Galileo, or a Wagner, before the world has grown
accustomed to their strangeness, he would be called upon to
support; for would not he alone be the true advocate, the heaven-
born, immortal one, while they would remain, as always, complacent
performers of tricks which they mistook for the operations of their
specific talent, subscribers to conventions that were shallow and
nonsensical and in open enmity to the idea of justice for which they
stood as the self-satisfied expression.
As he raced along in the company of these wonderful thoughts
through the south of London, he recognized in himself all the signs
that declare Truth’s authentic champion. It would be his to deliver
more than one rueful blow upon the close-locked portals of
pedantry. “The purblind old man who dares to occupy the seat of
judgment, his authority shall be traversed, it shall be rent in pieces.
As for that amazing creature who will dare to stand up for the
Crown, who will propose to do to death a human being with that
bleak and irascible voice, and the operations of that arrested growth
he calls his intellect, an awful example will have to be made of him.”
There was no end to the succession of deserted streets. Water swam
in shallow pools along the black pavements which seemed to reflect
the color of the sky. The numerous lamps, picked out as so many
dull, yellow balls in the surrounding blackness, suffused their
oppressive rays along the long, flat surfaces so that they appeared
to shine without giving forth a radiance.
How vague and vast seemed these early hours before the dawn!
They did not contain a living soul. The sky, the streets, the dark
houses, the bare trees in the gardens and at the sides of the roads
were soundless, empty, destitute of life. A quietness so profound
appeared uncanny on the outskirts of pandemonium. But
astonishing, desolating as it was, it seemed to aid the furious brain
that was borne so fast in its midst. There was only the echo of the
advocate’s own feet, which came weirdly from across the way, and
the high and labored breathing of his own body.
By the time the hour of seven chimed out from the half-dozen
neighboring steeples of a population that was beginning to cluster
much closer together, he divined that he was pressing nearer to the
heart of the metropolis. He did not stay to inquire of the occasional
wayfarer who was abroad in these regions, but set his face into the
ruck of the streets, where the dark forms of the houses rose like an
impenetrable and endless forest. No fears assailed him as to
whether he would reach his home—the coldest, most inhospitable
home that was ever called upon to harbor a spirit with such
widespread, space-cleaving pinions.
His feet seemed to devour the pavements. His stride was great,
elastic, and unflagging; it was propelled by the lungs, heart, and
muscles of the athlete. In the swing of the arms, the lunge of the
limbs, the lissom sway of the body, there was fine physical power,
and the seething engines that presided over this massive yet elastic
framework were like the boilers of a locomotive which eat up the
miles without fatigue. When excited into action on the football field
the feeling was always upon him that no puny human agent could
stay his course. The feeling was upon him now in an intensified
degree. With will and muscle coöperating to overstride the darkness,
he longed for opposition to declare itself that he might trample it
down.
Near eight o’clock he recognized Waterloo Bridge and the cold
Thames below stealing like a felon through the vapors of the dawn.
With a stupefied surprise he awoke to the sensation of being
launched once more into the sharp and too-definite business of the
time. The pavements were now swarming with people, the roads
with omnibuses, cabs, and vans. Traffic was belching out of every
street; clerks and seamstresses were scurrying to their
employments, masticating their breakfasts as they went. Vendors of
newspapers and hawkers of food were tearing the gray air to pieces
with their cries. He emerged from the orgy of his passion to find that
he was up to the throat and being stifled in pandemonium, even
before he was aware that his feet had entered it.
The lines of palaces across the river, towering tier upon tier above
the embankment, with their majestic bulks half-thrust through the
curtain of December mist which the first streaks of day had seemed
to thicken, fell upon the imagination of the wayfarer, who had
slackened his pace all at once to a footsore limp as he crossed the
bridge and crept towards them. At a distance they stood insolent,
aloof, and cynical. He could hardly believe that in one of these
wonderful caravanserais he, the starving, the friendless, and the
solitary, had eaten and drunk only a few hours before. It was not
feasible that such palaces as these could touch a life so obscure at
any point. Penniless, friendless, lacking even life’s common
necessaries, in the midst of six millions of people, who contended
rudely with the first weapons that came to their hands to enforce
their claims, how could he, whose coat was in holes, whose pockets
were empty, have penetrated to the Mecca of their gods?
Limping into the Strand as the clock at the Law Courts chimed the
hour of eight, his imagination was assailed, not with their
unmeaning mass of architecture, but with that unseen and grisly
bulk which only the eye of his inner consciousness could apprehend.
A shudder convulsed his veins. Less than thirty short hours hence
the gladiator would be called into the arena. He would have to face
the lions with no defence for his nakedness except a small shield in
the use of which he had had no practice, and a sharp but untried
spear.
Climbing up the steep stairs to his garret, his nostrils were affronted
as they had been on so many other occasions by the foulness of the
heavy and noisome air. What a labor it was to reach the locked door
at the top of the highest, the darkest, the most unpleasant story! His
fibres had grown strangely slack, his breathing was no longer joyous
and free. The mighty engines of his mind had ceased suddenly to
vibrate; those pulses which had been so overweening in their
insolence could only flutter now. He had fallen without a warning
from his eminence. His whole being was enveloped in a despicable
flaccidity, a despicable weakness, as he turned the key in the lock
and entered his garret.
He recoiled from the dismal scene that met his eyes with the
shudder that one gives in plunging into icy water. As he stood on the
threshold all the phantoms of his previous despair sprang upon him
from the walls of his chamber and seemed to throw him down.
There was the cold grate with the gray ashes in it still; there the
lamp that had left him in the darkness. The table was there with its
pile of law-books that he had conned with the sickening patience
which tortured him so keenly. Strewn over them were fragments of
the writings which had eaten away the flower of his intelligence
without bringing him a shilling to fill his belly or to pay his rent.
Enveloped within them was the piece of lead by whose aid and with
a skill so ferocious he had destroyed the rat. The confectioner’s
paper was there that had contained his dinner; also the crumbs
which remained to testify to its nature. On the mantelpiece was the
burned and dirty old pipe which he had cherished so much, the only
friend of his adversity; on the floor was the pouch that had not a
grain of tobacco in it. The pool of water was still in the corner,
underneath the discoloration of the plaster in the low sloping roof.
How cold it was! Everything in this horrible apartment seemed to be
rendered icier, more dismal, by the callous gray beams that stole
through the grimy windows with a sullenness that hardly merited the
name of light. Ah, that window with its outlook on oblivion! It all
came back to him with the indescribable pangs of the knife, that the
night before he had leaned out of it, bareheaded, open-mouthed, his
eyes and nostrils cut by blasts of sleet, and had cried his haughty
challenge to a world that grovelled so far below him in the mire.
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!

ebookfinal.com

You might also like