NumPy Beginner S Guide Third Edition Ivan Idris Download PDF
NumPy Beginner S Guide Third Edition Ivan Idris Download PDF
com
https://ebookname.com/product/numpy-beginner-s-guide-third-
edition-ivan-idris/
OR CLICK BUTTON
DOWNLOAD EBOOK
https://ebookname.com/product/numpy-beginner-s-guide-2nd-edition-
ivan-idris/
https://ebookname.com/product/absolute-beginner-s-guide-to-corel-
wordperfect-10-absolute-beginner-s-guide-1st-edition-laura-
acklen/
https://ebookname.com/product/absolute-beginner-s-guide-to-a-
lite-and-healthy-lifestyle-absolute-beginner-s-guide-1st-edition-
nicole-haywood/
https://ebookname.com/product/the-development-of-international-
human-rights-law-volume-i-1st-edition-fionnuala-d-ni-aolain/
Shorebird Ecology Conservation and Management 1st
Edition Dr. Mark A. Colwell
https://ebookname.com/product/shorebird-ecology-conservation-and-
management-1st-edition-dr-mark-a-colwell/
https://ebookname.com/product/netherlands-yearbook-of-
international-law-volume-41-2010-necessity-across-international-
law-1st-edition-tarcisio-gazzini/
https://ebookname.com/product/restful-web-services-cookbook-
solutions-for-improving-scalability-and-simplicity-1st-edition-
subbu-allamaraju/
https://ebookname.com/product/extreme-right-activists-in-europe-
through-the-magnifying-glass-routledge-studies-in-extremism-and-
democracy-1st-edition-pieter-klandermans/
https://ebookname.com/product/being-human-in-islam-the-impact-of-
the-evolutionary-worldview-1st-edition-damian-a-howard/
Top 100 Health Care Careers 3rd Edition Dr. Saul
Wischnitzer & Edith Wischnitzer
https://ebookname.com/product/top-100-health-care-careers-3rd-
edition-dr-saul-wischnitzer-edith-wischnitzer/
NumPy Beginner's Guide
Third Edition
Ivan Idris
BIRMINGHAM - MUMBAI
NumPy Beginner's Guide
Third Edition
All rights reserved. No part of this book may be reproduced, stored in a retrieval system,
or transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged to be caused directly
or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78528-196-9
www.packtpub.com
Credits
Reviewers Proofreader
Alexandre Devert Safis Editing
Davide Fiacconi
Ardo Illaste Indexer
Rekha Nair
Commissioning Editor
Amarabha Banerjee Graphics
Sheetal Aute
Cover Work
Content Development Editor
Aparna Bhagat
Neeshma Ramakrishnan
Technical Editor
Rupali R. Shrawane
Copy Editors
Charlotte Carneiro
Vikrant Phadke
Sameen Siddiqui
About the Author
Ivan Idris has an MSc in experimental physics. His graduation thesis had a strong emphasis
on applied computer science. After graduating, he worked for several companies as a Java
developer, data warehouse developer, and QA Analyst. His main professional interests are
business intelligence, big data, and cloud computing. Ivan enjoys writing clean, testable
code and interesting technical articles. He is the author of NumPy Beginner's Guide, NumPy
Cookbook, Learning NumPy Array, and Python Data Analysis. You can find more information
about him and a blog with a few examples of NumPy at http://ivanidris.net/
wordpress/.
I would like to take this opportunity to thank the reviewers and the team
at Packt Publishing for making this book possible. Also thanks go to my
teachers, professors, colleagues, Wikipedia contributors, Stack Overflow
contributors, and other authors who taught me science and programming.
Last but not least, I would like to acknowledge my parents, family, and
friends for their support.
About the Reviewers
Davide Fiacconi is completing his PhD in theoretical astrophysics from the Institute for
Computational Science at the University of Zurich. He did his undergraduate and graduate
studies at the University of Milan-Bicocca, studying the evolution of collisional ring galaxies
using hydrodynamic numerical simulations. Davide's research now focuses on the formation
and coevolution of supermassive black holes and galaxies, using both massively parallel
simulations and analytical techniques. In particular, his interests include the formation of the
first supermassive black hole seeds, the dynamics of binary black holes, and the evolution of
high-redshift galaxies.
Ardo Illaste is a data scientist. He wants to provide everyone with easy access to data for
making major life and career decisions. He completed his PhD in computational biophysics,
prior to fully delving into data mining and machine learning. Ardo has worked and studied in
Estonia, the USA, and Switzerland.
www.PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
and eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
[i]
Table of Contents
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Table of Contents
[ vi ]
Table of Contents
[ vii ]
Table of Contents
[ viii ]
Preface
Scientists, engineers, and quantitative data analysts face many challenges nowadays. Data
scientists want to be able to perform numerical analysis on large datasets with minimal
programming effort. They also want to write readable, efficient, and fast code that is as close
as possible to the mathematical language they are used to. A number of accepted solutions
are available in the scientific computing world.
The C, C++, and Fortran programming languages have their benefits, but they are not
interactive and considered too complex by many. The common commercial alternatives,
such as MATLAB, Maple, and Mathematica, provide powerful scripting languages that are
even more limited than any general-purpose programming language. Other open source
tools similar to MATLAB exist, such as R, GNU Octave, and Scilab. Obviously, they too lack
the power of a language such as Python.
What is NumPy?
NumPy (short for numerical Python) is an open source Python library for scientific
computing. It lets you work with arrays and matrices in a natural way. The library contains
a long list of useful mathematical functions, including some functions for linear algebra,
Fourier transformation, and random number generation routines. LAPACK, a linear algebra
library, is used by the NumPy linear algebra module if you have it installed on your system.
Otherwise, NumPy provides its own implementation. LAPACK is a well-known library,
originally written in Fortran, on which MATLAB relies as well. In a way, NumPy replaces some
of the functionality of MATLAB and Mathematica, allowing rapid interactive prototyping.
Preface
We will not be discussing NumPy from a developing contributor's perspective, but from more
of a user's perspective. NumPy is a very active project and has a lot of contributors. Maybe,
one day you will be one of them!
History
NumPy is based on its predecessor Numeric. Numeric was first released in 1995 and has
deprecated status now. Neither Numeric nor NumPy made it into the standard Python library
for various reasons. However, you can install NumPy separately, which will be explained in
Chapter 1, NumPy Quick Start.
In 2001, a number of people inspired by Numeric created SciPy, an open source scientific
computing Python library that provides functionality similar to that of MATLAB, Maple, and
Mathematica. Around this time, people were growing increasingly unhappy with Numeric.
Numarray was created as an alternative to Numeric. That is also deprecated now. It was
better in some areas than Numeric, but worked very differently. For that reason, SciPy kept
on depending on the Numeric philosophy and the Numeric array object. As is customary
with new latest and greatest software, the arrival of Numarray led to the development of
an entire ecosystem around it, with a range of useful tools.
In 2005, Travis Oliphant, an early contributor to SciPy, decided to do something about this
situation. He tried to integrate some of Numarray's features into Numeric. A complete
rewrite took place, and it culminated in the release of NumPy 1.0 in 2006. At that time,
NumPy had all the features of Numeric and Numarray, and more. Tools were available to
facilitate the upgrade from Numeric and Numarray. The upgrade is recommended since
Numeric and Numarray are not actively supported any more.
Originally, the NumPy code was a part of SciPy. It was later separated and is now used by
SciPy for array and matrix processing.
NumPy's arrays are stored more efficiently than an equivalent data structure in base Python,
such as a list of lists. Array IO is significantly faster too. The improvement in performance
scales with the number of elements of the array. For large arrays, it really pays off to use
NumPy. Files as large as several terabytes can be memory-mapped to arrays, leading to
optimal reading and writing of data.
[x]
Preface
The drawback of NumPy arrays is that they are more specialized than plain lists. Outside the
context of numerical computations, NumPy arrays are less useful. The technical details of
NumPy arrays will be discussed in later chapters.
Large portions of NumPy are written in C. This makes NumPy faster than pure Python code.
A NumPy C API exists as well, and it allows further extension of functionality with the help
of the C language. The C API falls outside the scope of the book. Finally, since NumPy is open
source, you get all the related advantages. The price is the lowest possible—as free as a
beer. You don't have to worry about licenses every time somebody joins your team or you
need an upgrade of the software. The source code is available for everyone. This of course is
beneficial to code quality.
Limitations of NumPy
If you are a Java programmer, you might be interested in Jython, the Java implementation of
Python. In that case, I have bad news for you. Unfortunately, Jython runs on the Java Virtual
Machine and cannot access NumPy because NumPy's modules are mostly written in C. You
could say that Jython and Python are two totally different worlds, though they do implement
the same specifications. There are some workarounds for this discussed in NumPy Cookbook
- Second Edition, Packt Publishing, written by Ivan Idris.
Chapter 3, Getting Familiar with Commonly Used Functions, teaches you the most commonly
used NumPy functions—the basic mathematical and statistical functions.
Chapter 4, Convenience Functions for Your Convenience, tells you about functions that
make working with NumPy easier. This includes functions that select certain parts of your
arrays, for instance, based on a Boolean condition. You also learn about polynomials and
manipulating the shapes of NumPy objects.
Chapter 5, Working with Matrices and ufuncs, covers matrices and universal functions.
Matrices are well-known in mathematics and have their representation in NumPy as well.
Universal functions (ufuncs) work on arrays element by element, or on scalars. ufuncs expect
a set of scalars as the input and produce a set of scalars as the output.
[ xi ]
Preface
Chapter 6, Moving Further with NumPy Modules, discusses a number of basic modules
of universal functions. These functions can typically be mapped to their mathematical
counterparts, such as addition, subtraction, division, and multiplication.
Chapter 7, Peeking into Special Routines, describes some of the more specialized NumPy
functions. As NumPy users, we sometimes find ourselves having special requirements.
Fortunately, NumPy satisfies most of our needs.
Chapter 8, Assuring Quality with Testing, teaches you how to write NumPy unit tests.
Chapter 9, Plotting with matplotlib, covers matplotlib in depth, a very useful Python plotting
library. NumPy cannot be used on its own to create graphs and plots. matplotlib integrates
nicely with NumPy and has plotting capabilities comparable to MATLAB.
Chapter 10, When NumPy Is Not Enough – SciPy and Beyond, covers more details about
SciPy. We know that SciPy and NumPy are historically related. SciPy, as mentioned in the
History section, is a high-level Python scientific computing framework built on top of NumPy.
It can be used in conjunction with NumPy.
Chapter 11, Playing with Pygame, is the dessert of this book. You learn how to create fun
games with NumPy and Pygame. You also get a taste of artificial intelligence in this chapter.
Appendix A, Pop Quiz Answers, has the answers to all the pop quiz questions within
the chapters.
Appendix C, NumPy Functions' References, lists some useful NumPy functions and
their descriptions.
Here is a list of the software used to develop and test the code examples:
Python 2.7
NumPy 1.9
SciPy 0.13
[ xii ]
Preface
matplotlib 1.3.1
Pygame 1.9.1
IPython 2.4.1
Needless to say, you don't need exactly this software and these versions on your computer.
Python and NumPy constitute the absolute minimum you will need.
Sections
In this book, you will find several headings that appear frequently (Time for action, What just
happened?, Have a go hero, and Pop quiz).
To give clear instructions on how to complete a procedure or task, we use the following
sections.
Instructions often need some extra explanation to ensure that they make sense, so they are
followed by these sections.
You will also find some other learning aids in the book.
[ xiii ]
Preface
Conventions
In this book, you will find a number of styles of text that distinguish between different
kinds of information. Here are some examples of these styles, and an explanation of
their meaning.
Code words in text are shown as follows: "Notice that numpysum() does not need a
for loop."
When we wish to draw your attention to a particular part of a code block, the relevant lines
or items are set in bold:
reals = np.isreal(xpoints)
print "Real number?", reals
Real number? [ True True True True False False False False]
New terms and important words are shown in bold. Words that you see on the screen, in
menus or dialog boxes for example, appear in the text like this: "Clicking on the Next button
moves you to the next screen."
[ xiv ]
Preface
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or disliked. Reader feedback is important for us as it helps us develop
titles that you will really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing or
contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you
to get the most from your purchase.
[ xv ]
Preface
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you find a mistake in one of our books—maybe a mistake in the text or the code—we
would be grateful if you could report this to us. By doing so, you can save other readers from
frustration and help us improve subsequent versions of this book. If you find any errata, please
report them by visiting http://www.packtpub.com/submit-errata, selecting your book,
clicking on the Errata Submission Form link, and entering the details of your errata. Once your
errata are verified, your submission will be accepted and the errata will be uploaded to our
website or added to any list of existing errata under the Errata section of that title.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If you come
across any illegal copies of our works in any form on the Internet, please provide us with
the location address or website name immediately so that we can pursue a remedy.
We appreciate your help in protecting our authors and our ability to bring you
valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at
questions@packtpub.com, and we will do our best to address the problem.
[ xvi ]
NumPy Quick Start
1
Let's get started. We will install NumPy and related software on different
operating systems and have a look at some simple code that uses NumPy. This
chapter briefly introduces the IPython interactive shell. SciPy is closely related
to NumPy, so you will see the SciPy name appearing here and there. At the end
of this chapter, you will find pointers on how to find additional information
online if you get stuck or are uncertain about the best way to solve problems.
Python
NumPy is based on Python, so you need to have Python installed. On some operating
systems, Python is already installed. However, you need to check whether the Python version
corresponds with the NumPy version you want to install. There are many implementations of
Python, including commercial implementations and distributions. In this book, we focus on
the standard CPython implementation, which is guaranteed to be compatible with NumPy.
[1]
NumPy Quick Start
Debian and Ubuntu: Python might already be installed on Debian and Ubuntu,
but the development headers are usually not. On Debian and Ubuntu, install the
python and python-dev packages with the following commands:
$ [sudo] apt-get install python
$ [sudo] apt-get install python-dev
Install, for instance, the Python 2.7 port by running the following command:
$ [sudo] port install python27
Linear Algebra PACKage (LAPACK) does not need to be present but, if it is,
NumPy will detect it and use it during the installation phase. It is recommended
that you install LAPACK for serious numerical analysis as it has useful numerical
linear algebra functionality.
You can download the example code files for all the Packt books you have
purchased from your account at https://www.packtpub.com/. If you
purchased this book elsewhere, you can visit https://www.packtpub.
com/books/content/support and register to have the files e-mailed
directly to you.
[2]
Chapter 1
2. You will get a short message with the Python version and other information and the
following prompt:
>>>
3. If you type, for instance, keywords as the message says, you get a list of keywords.
The topics command gives a list of topics. If you type any of the topic names (such
as LISTS) in the prompt, you get additional information about the topic. Typing q
quits the information screen. Pressing Ctrl + D together returns you to the normal
Python prompt:
>>>
[3]
NumPy Quick Start
4. If you have programmed before, you probably know that dividing is a bit tricky since
there are different types of dividing. For a calculator, the result is usually adequate,
but the following division may not be what you were expecting:
>>> 3/2
1
We will discuss what this result is about in several later chapters of this book. Take
the cube of 2 as follows:
>>> 2 ** 3
8
[4]
Chapter 1
2. We defined the variable and assigned it a value. In this Python code, the type of the
variable is not fixed. We can make the variable in to a list, which is a built-in Python
type corresponding to an ordered sequence of values. Assign a list to var as follows:
>>> var = [2, 'spam', 'eggs']
>>> var
[2, 'spam', 'eggs']
We can assign a new value to a list item using its index number (counting starts from
0). Assign a new value to the first list element:
>>> var
['ham', 'spam', 'eggs']
3. We can also swap values easily. Define two variables and swap their values:
>>> a = 1
>>> b = 2
>>> a, b = b, a
>>> a
2
>>> b
1
[5]
NumPy Quick Start
The parentheses are now mandatory in Python 3. In this book, I try to use the
new syntax as much as possible; however, I use Python 2 to be on the safe side. To
enforce the syntax, each Python 2 script with print() calls in this book starts with:
>>> from __future__ import print_function
3. Try to use the old syntax to get the following error message:
>>> print 'Hello'
File "<stdin>", line 1
print 'Hello'
^
SyntaxError: invalid syntax
[6]
Chapter 1
6. By default, Python separates the printed values with spaces and prints output to the
screen. You can customize these settings. Read more about this function by typing
the following command:
>>> help(print)
Code comments
Commenting code is a best practice with the goal of making code clearer for yourself and
other coders (see https://google-styleguide.googlecode.com/svn/trunk/
pyguide.html?showone=Comments#Comments). Usually, companies and other
organizations have policies regarding code comment such as comment templates. In this
book, I did not comment the code in such a fashion for brevity and because the text in the
book should clarify the code.
2. However, if the hash sign is between single or double quotes, then we have a string,
which is an ordered sequence of characters:
>>> astring = '# This is not a comment'
>>> astring
'# This is not a comment'
3. We can also comment multiple lines as a block. This is useful if you want to write a
more detailed description of the code. Comment multiple lines as follows:
"""
Chapter 1 of NumPy Beginners Guide.
Another line of comment.
"""
We refer to this type of comment as triple-quoted for obvious reasons.
It also is used to test code. You can read about testing in Chapter 8, Assuring
Quality with Testing.
[7]
NumPy Quick Start
The if statement
The if statement in Python has a bit different syntax to other languages, such as C++ and
Java. The most important difference is that indentation matters, which I hope you are
aware of.
In the preceding example, Python decided that 42 is not negative. The else clause
is optional. The comparison operators are equivalent to the ones in C++, Java, and
similar languages.
2. Python also has a chained branching logic compound statement for multiple tests
similar to the switch statement in C++, Java, and other programming languages.
Decide whether a number is negative, 0, or positive as follows:
>>> a = -42
>>> if a < 0:
... print('Negative')
... elif a == 0:
... print('Zero')
... else:
... print('Positive')
...
Negative
[8]
Another Random Document on
Scribd Without Any Related Topics
“Sure, that’s so!” agreed the old man. “It’s Pauline’s treasure, right
enough. Ain’t it, Geoffrey?”
“I guess it’s no one else’s,” said Geoffrey, picking up the idea. “I’ll
see to that.”
I could not help smiling at the gratuitous menace in his tone; he
might have been sitting on the treasure-chests already.
At that moment we were startled by an appalling scream, a choking
cry, from Pauline’s stateroom.
We rushed in and stood for a moment transfixed with horror.
Pauline, leaning out of her bunk, was throttling with both hands the
life out of her mother, who had been sitting by the bedside. In a
flash of my first perception of the scene, I saw that the girl had
reverted to her trance-personality. It was Lucia who had that deadly
grip upon the other woman’s throat, Lucia who glared at her with
fiendishly triumphant eyes, Lucia who gloated mockingly in her
foreign accent: “Ah, Teresa!—You think you would take the
Englishman from me—you think you would go away with John
Dawson and the treasure?” She laughed, cruelly exultant. “I think
no, Teresa—I think no—not with the treasure! You can go with that
John Dawson, yes! But not with the treasure! You go and wait for
him—for your John Dawson—I will send him to you—soon—soon!”
Her low laugh was diabolical.
We flung ourselves upon her, but her strength was superhuman. She
seemed utterly oblivious of us, as heedless of our struggles as
though we were not there. Her eyes flashing, her teeth showing, she
continued to jeer at her victim in her foreign voice: “He will come to
you to-night—your John Dawson—as he promised, yes! I will send
him to you——!” Only as we finally tore the almost strangled Mrs.
Vandermeulen from her hands did she suddenly cease to speak. She
sank back upon the bed, swooning into complete unconsciousness.
I drove out the father and son and applied myself to reviving the
mother. I shall not forget the terrible night I had with her, after she
had resuscitated. At length, I had to give her a few drops of
laudanum to get her off to sleep. Pauline slept like a child.
I woke up the next morning to that strange feeling of hushed
stillness which pervades a ship when her engines are at rest after a
long period of unbroken activity. We were pitching heavily, evidently
at anchor, for our upward rise was every now and then suddenly and
jarringly arrested. We had arrived!
I went to look at my patients and found them both suffering from
sea-sickness. This vicious plunging of the yacht was more than their
weak stomachs could stand. I gave them each a steadying draught
and then went on deck.
The two Vandermeulens were on the bridge with the skipper. I
ignored them, instinctively avoiding their certain excitement. Upon
our port bow was a fairly large island, its rocky shore crowned with a
dense tropical foliage. On the other side of us was a small islet,
barren save for a few sparse trees scattered over it, surf breaking
white upon its beaches. Old Providence and its satellite, Santa
Katalina! Between the two islands a strong current was running, with
a heavy ground-swell in which we plunged and kicked, straining at
our cables. No wonder the two ladies were ill, I thought, as the deck
sank sickeningly sideways under my feet.
I went into the saloon and found that the Vandermeulens had
already breakfasted. As I ate my solitary meal, I could hear the
heavy trampling of feet on the deck overhead, and guessed that
they were hoisting outboard the little steam-launch we used when in
harbour.
When I had finished, I went to have another look at Pauline. Her
mother was with her. Mentally, she was completely her normal self,
with apparently no memory even of that trance-personality which
had for the second time surged up in her. But she was feeling very ill
in this violent and disturbing motion of the anchored yacht.
Old Vandermeulen came in.
“Get up and dress, Pauline!” he commanded, brutally, as though
bearing down opposition in advance. “We’re going ashore!”
His wife sprang forward.
“Oh, no, no, William! Don’t take her! Don’t take her!—Don’t tempt
Providence. Don’t go! William! William!” she clung to him in
supplication. “She’s too ill to go! She’s too ill to go, isn’t she,
doctor?”
The old man shook her off.
“Nonsense!” he said roughly. Nevertheless, he turned enquiringly to
me.
I considered the pros and cons dispassionately for a moment. Of
course, the old lady’s fears were mere superstition and did not
influence me in the least.
“Well,” I said, “I think that if Miss Vandermeulen feels equal to the
effort of dressing, it would do her good to get away from the yacht
and walk about on firm land for an hour or two.”
“I should like to,” said Pauline, all docility. “Besides,” she smiled, “I
should like to see for myself if there is any truth in that strange
writing.”
Half an hour later we had, with some difficulty, stowed the ladies—
for the mother insisted on coming also—in the stern-sheets of the
little launch which rose and fell dizzily under the lee of the yacht.
The two Vandermeulens were amidships, ready to give instructions
to the helmsman. I noticed that they had a pick and shovel on
board. I sat close to Pauline. She was looking pale, but the sea-
sickness was in abeyance for the moment and a touch of digitalis I
had given her had stiffened her up.
We sheered off, set a course over the rolling dark blue well toward
the islet we could see as we lifted on the waves. We had anchored
rather on the Old Providence side of the channel dividing the islands,
and the launch was about midway between the two when Pauline,
who had been looking around her with some curiosity, uttered a
sudden ejaculation.
“That’s not the island!” she cried, with a gesture toward Santa
Katalina. “It’s the other one—the big one!” She pointed to Old
Providence. Then she checked herself, a peculiar look of puzzlement
in her face. “I wonder whatever made me say that!” she exclaimed.
“One would think I have been here before—but I can’t have!”
“But that’s Santa Katalina!” objected Geoffrey, pointing to the islet. It
undoubtedly was.
“Wait!” said old Vandermeulen, who had been sharply watching his
daughter for any sign of recognition. “I guess Pauline knows what
she is talking about!”
He stopped the engine and for a few moments we rose and fell idly
upon the waves, while the two men stared across to Old Providence.
“By Jove, yes!” cried Geoffrey suddenly. “Pauline’s right! Look!
There’s Skull Point!”
He indicated, with outstretched hand, a jutting headland whose face
had been weather-sculptured into the unmistakable semblance of a
skull.
“Skull Point it is!” said old Vandermeulen, with such an oath as he
did not usually let come to his daughter’s ears.
In another moment we had gone about and were throbbing quickly
toward the headland. All eyes were fixed on it as we approached.
Geoffrey had produced a compass.
“Look!” he cried. “The three trees! South-west-by-south from Skull
Point!”
Sure enough, in the direction designated, three enormous trees,
evidently hundreds of years old, raised their heads high above the
mass of more recent vegetation.
A quarter of an hour later we were running into a little cove on the
west side of the headland. A ledge of rock, sheltered from the swell,
offered itself as a landing-stage, and we ran alongside and made
fast.
Old Vandermeulen ordered the two members of the yacht’s crew,
who had accompanied us, to remain in the launch. The rest of us
started off into the island, Geoffrey carrying the tools. The three
trees were at no great distance, at the summit of a slope of broken-
down volcanic rock. Geoffrey arrived first.
“No need to worry where to dig, Father!” he shouted. “Here it is—
plain enough!”
Under the centre tree was a cairn of loose stones, more than half
buried under the detritus of many years, it is true, but evidently the
work of men’s hands.
“That’s it, sure!” cried the old man. “First time you’ve seen this
place, Pauline?” he queried, with a touch of grim cynicism.
“Of course!” she replied. “What do you mean, Father?—and yet—”
she hesitated, looking around her—“yet I do have a strange sort of
feeling as though I had been here before. But I can’t have! It’s
absurd!”
Mother and daughter sat down under the shade of the trees whilst
we three set to work to open the cairn. I was as excited as they by
this time, and I helped with a will. The old man, wielding his pick
with the skill of an ex-miner, loosened the stones on the surface. I
rolled away the big ones, and Geoffrey shovelled away the smaller
stuff. At the end of an hour we had made a pretty deep excavation.
We then took it in turns to work with pick and shovel in the hole,
from which we threw up the stones.
Suddenly Geoffrey uttered an exclamation.
“We’re on something!—What’s that, doctor?” He passed me up a
long bone.
“That’s the tibia of a man,” I replied. “I expect you’ll find the rest of
him there.”
“Sure thing!” he said. “Here he is!” He cleared away one or two large
lumps of rock and revealed the grinning skeleton of a man. “Hallo!”
he added, as he bent down to it, “what’s this?”
A long thin stiletto was lying loosely between the fleshless ribs of the
skeleton.
The old man snatched it from him as he plucked it out.
“And by all that’s holy!” he cried, “it’s got her name on it! Look!”
I took it from him. The dagger was of antique pattern, its steel
rusted and corroded but still resilient enough to make it a dangerous
weapon, and on the hilt, still legible, roughly inlaid in silver like the
amateur work of a sailorman, was the name—Lucia!
“I guess she murdered him with that!” said the old man, grimly,
glancing from the stiletto to the skeleton grinning up at us from the
hole where it had so long lain undisturbed. He turned toward where
his daughter sat in the shade of the trees. “Here, Pauline!” he called
to her. “Come and see—your friend the pirate and the knife that
killed him!”
The girl jumped up and ran across to us, all excitement.
“How wonderful!” she said. “It’s like a dream come true!”
At the time, excited as we all were, I did not notice the strangeness
of that spontaneous phrase. She stood upon the edge of the
excavation and took the stiletto with eager curiosity from her father.
She held it in both hands, breast-high, the point toward her, to read
the name upon the hilt.
“Lucia!” she cried, with a strange look toward us, as though dimly
and uncertainly recalling some terrible experience. “Lucia!” She
repeated the name with a peculiar, slow intonation—an intonation of
puzzled half-remembrance.
We stared at her, fascinated. Was our fantastic theory true?
Her gaze lost us, fixed itself into vacancy. Her features changed. An
expression of vague fear—the fear of the hypnotic shrinking at some
invisible danger—came into them. She opened her mouth as though
to speak.
She uttered only an inarticulate cry—a cry of fright as the loose
stones of the excavation slipped from under her. She fell headlong
into the hole, where she lay oddly—ominously—still. I jumped down
after her, lifted her up. The rusty old stiletto, caught under her in her
fall, had driven straight into her heart—broken off at the hilt!