100% found this document useful (3 votes)
21 views

Full download Essentials Of Programming In Mathematica 1st Edition Wellin pdf docx

The document provides information about the ebook 'Essentials of Programming in Mathematica' by Paul Wellin, which serves as an introduction to Mathematica programming for beginners and those with some programming experience. It includes over 350 exercises, solutions available online, and covers various applied areas such as natural language processing and bioinformatics. The document also lists additional ebooks available for download on the same platform.

Uploaded by

hegyikusakcw
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
100% found this document useful (3 votes)
21 views

Full download Essentials Of Programming In Mathematica 1st Edition Wellin pdf docx

The document provides information about the ebook 'Essentials of Programming in Mathematica' by Paul Wellin, which serves as an introduction to Mathematica programming for beginners and those with some programming experience. It includes over 350 exercises, solutions available online, and covers various applied areas such as natural language processing and bioinformatics. The document also lists additional ebooks available for download on the same platform.

Uploaded by

hegyikusakcw
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/ 41

Download the Full Version of the Ebook with Added Features ebookname.

com

Essentials Of Programming In Mathematica 1st


Edition Wellin

https://ebookname.com/product/essentials-of-programming-in-
mathematica-1st-edition-wellin/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookname.com


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

A Primer of NMR Theory with Calculations in Mathematica


1st Edition Alan J. Benesi

https://ebookname.com/product/a-primer-of-nmr-theory-with-
calculations-in-mathematica-1st-edition-alan-j-benesi/

ebookname.com

Extension of Mathematica system functionality Victor Z.


Aladjev

https://ebookname.com/product/extension-of-mathematica-system-
functionality-victor-z-aladjev/

ebookname.com

Mathematica Mechanical Systems Third Edition Beretta R.

https://ebookname.com/product/mathematica-mechanical-systems-third-
edition-beretta-r/

ebookname.com

Complex Plasmas and Colloidal Dispersions Particle


Resolved Studies of Classical Liquids and Solids Alexey
Ivlev
https://ebookname.com/product/complex-plasmas-and-colloidal-
dispersions-particle-resolved-studies-of-classical-liquids-and-solids-
alexey-ivlev/
ebookname.com
Science in the Study of Ancient Egypt 1st Edition Sonia
Zakrzewski

https://ebookname.com/product/science-in-the-study-of-ancient-
egypt-1st-edition-sonia-zakrzewski/

ebookname.com

Displaying Your Findings A Practical Guide for Creating


Figures Posters and Presentations 6th Edition Adelheid
A.M. Nicol
https://ebookname.com/product/displaying-your-findings-a-practical-
guide-for-creating-figures-posters-and-presentations-6th-edition-
adelheid-a-m-nicol/
ebookname.com

Importance of Growth for Health and Development Nestle


Nutrition Workshop Series Pediatric Program 1st Edition
Alan Lucas
https://ebookname.com/product/importance-of-growth-for-health-and-
development-nestle-nutrition-workshop-series-pediatric-program-1st-
edition-alan-lucas/
ebookname.com

The Twelfth Century Renaissance A Reader Alex Novikoff

https://ebookname.com/product/the-twelfth-century-renaissance-a-
reader-alex-novikoff/

ebookname.com

Frogs and Toads of Big Bend National Park 1st Edition Gage
H. Dayton

https://ebookname.com/product/frogs-and-toads-of-big-bend-national-
park-1st-edition-gage-h-dayton/

ebookname.com
Primer of Diagnostic Imaging 3rd Edition Ralph Weissleder

https://ebookname.com/product/primer-of-diagnostic-imaging-3rd-
edition-ralph-weissleder/

ebookname.com
Essentials of Programming in Mathematica
R

Essentials of Programming in Mathematica provides an introduction suitable for readers


with little or no background in the Mathematica language, as well as for those with some
experience using languages such as C, JAVA, or PERL. The author, an established authority
on Mathematica programming, has written an example-driven text that covers the language
from first principles, as well as including material from natural language processing, bioin-
formatics, graphs and networks, signal analysis, geometry, computer science, and many
other applied areas.
The book is appropriate for self-study or as a text for a course in programming in com-
putational science. Readers will benefit from the author’s tips, which provide insight and
suggestions on small and large points. He also provides more than 350 exercises from
novice through to advanced level, with all of the solutions available online.
• Assumes no formal knowledge of programming
• More than 350 exercises from basic to advanced make the book ideal for teaching or for
self-study
• Appeals to a broad readership by using examples derived from a wide variety of fields
• Solutions to exercises are available from www.cambridge.org/wellin_essentials

Paul Wellin worked for Wolfram Research from the mid-1990s through 2011, directing the
Mathematica training efforts with the Wolfram Education Group. He has taught mathe-
matics both at public schools and at university level for over 12 years. He has given talks,
workshops, and seminars around the world on the integration of technical computing and
education, and he has served on numerous government advisory panels on these issues. He
is the author and co-author of several books on Mathematica.
Essentials of Programming in
Mathematica R

PAUL WELLIN
University Printing House, Cambridge CB2 8BS, United Kingdom

Cambridge University Press is part of the University of Cambridge.


It furthers the University’s mission by disseminating knowledge in the pursuit of
education, learning and research at the highest international levels of excellence.

www.cambridge.org
Information on this title: www.cambridge.org/9781107116665

c Paul Wellin 2016
This publication is in copyright. Subject to statutory exception
and to the provisions of relevant collective licensing agreements,
no reproduction of any part may take place without the written
permission of Cambridge University Press.
First published 2016
Printed in the United Kingdom by Bell and Bain Ltd
Page 267. Quotation from “The Library of Babel” by Jorge Luis Borges. Translated by James E. Irby,
from LABYRINTHS, copyright  c 1962, 1964 by New Directions Publishing Corp. Reprinted by
permission of New Directions Publishing Corp.
Page 296. Marcel Duchamp, “Roue de bicyclette” 
c 2012 Artists Rights Society (ARS), New
York/ADAGP, Paris/Succession Marcel Duchamp.
Wolfram Mathematica
R
is a registered trademark of Wolfram Research, Inc.
A catalogue record for this publication is available from the British Library
Library of Congress Cataloguing in Publication data
ISBN 978-1-107-11666-5 Hardback
Text set in DTL Albertina 11/13; code set in Inconsolata; captions set in Syntax LT Std;
System Mathematica R
, Version 10.2.
Designed and typeset by the author
Additional resources for this publication at www.cambridge.org/wellin_essentials
Cambridge University Press has no responsibility for the persistence or accuracy
of URLs for external or third-party internet websites referred to in this publication,
and does not guarantee that any content on such websites is, or will remain,
accurate or appropriate.
To the memory of my father
whose love of books curiously led to this
Contents

Preface · xi
1 1

1 Programming with Mathematica · 1


1 1 1 1

1.1 Introduction to programming · 2


1 1 1 1

Your1rst1Mathematica1program1·1Programming1paradigms1·1Creating1programs
1.2 Getting started · 8
1 1 1

Starting1and1running1Mathematica1·1Mathematical1expressions1·1Functions1·1Lists1·1Semicolons1·1Alternative1input1
syntax1·1Comments1·1Exercises
1.3 Getting help · 14
1 1

Errors1·1Getting1out1of1trouble1·1Function1information1·1Documentation
1.4 Notes and further reading · 18
1 1 1 1 1

2 The Mathematica language · 19


1 1 1 1

2.1 Expressions · 20 1 1

Atoms1·1Normal1expressions1·1Display1of1expressions1·1Evaluation1of1expressions1·1Compound1expressions1·1Nesting1
expressions ·1Exercises
2.2 Numbers · 33 1 1

Types1of1numbers1·1Digits1and1number1bases1·1Random1numbers1·1Exercises
2.3 Denitions · 41 1 1

Dening1variables1and1functions1·1Immediate1vs.1delayed1assignments1·1Compound1functions1·1Functions1with1
multiple1denitions1·1Exercises
2.4 Predicates and Boolean operations · 49
1 1 1 1 1

Predicates · Relational1and1logical1operators · Exercises


2.5 Attributes · 55 1 1

Listable1·1Hold1attributes1·1Protected1·1Exercises
2.6 Notes and further reading · 57
1 1 1 1 1
viii Contents

3 Lists and associations · 59


1 1 1 1

3.1 Creating and displaying lists · 60


1 1 1 1 1

List1structure1and1syntax1·1List1construction1·1Displaying1lists1·1Arrays1·1Exercises
3.2 Testing and measuring lists · 69
1 1 1 1 1

Testing1a1list1·1Measuring1lists1·1Exercises
3.3 Operations on lists · 72 1 1 1 1

Extracting1elements1·1Applying1functions1to1lists1·1Rearranging1lists1·1List1component1assignment1·1Multiple1lists1·1
Exercises
3.4 Associations · 84 1 1

Creating1and1displaying1associations1·1Operations1on1associations1·1Creating1a1bibliography1·1Exercises
3.5 Differences from other languages · 901 1 1 1 1

3.6 Notes and further reading · 93


1 1 1 1 1

4 Patterns and rules · 95


1 1 1 1

4.1 Patterns · 96 1 1

Blanks1·1Pattern1matching1by1type1·1Explicit1pattern1matching1·1Structured1patterns1·1Sequence1pattern1matching1·1
Conditional1pattern1matching1·1Shorthand1notation1·1Alternatives1·1Repeated1patterns1·1Functions1that1use1
patterns1·1Exercises
4.2 Transformation rules · 111 1 1 1

Creating1and1using1replacement1rules1·1Applying1transformation1rules1·1Exercises
4.3 Examples · 116 1 1

Counting1coins1·1Filtering1and1extracting1data1·1Perimeter1·1Triangle1area1·1Finding1parts1of1expressions1·1Sorting1a1
list1·1Sunspot1activity1·1Exercises
4.4 Notes and further reading · 131
1 1 1 1 1

5 Functions · 133 1 1

5.1 Functions for manipulating expressions · 134


1 1 1 1 1

Map1·1Apply1·1Thread1and1MapThread1·1Listability1·1Inner1and1Outer1·1Select1and1Pick1·1Exercises
5.2 Iterating functions · 146
1 1 1

Nest1·1FixedPoint1·1NestWhile1·1Fold1·1Exercises
5.3 Recursive functions · 152 1 1 1

Fibonacci1numbers1·1Thinking1recursively1·1Dynamic1programming1·1Exercises
5.4 Loops and ow control · 159
1 1 1 1 1

Conditional1functions1·1Piecewise-dened1functions1·1Which1and1Switch1·1Argument1checking1·1Do1and1For1loops1·1
While1loops1·1Exercises
5.5 Pure functions · 176
1 1 1

Syntax1of1pure1functions1·1Multiple1arguments1·1Pure1predicate1functions1·1Indexing1with1pure1functions1·1Newton1
revisited1·1Example:1searching1for1attributes1·1Exercises
Contents ix

5.6 Examples · 190 1 1

Hamming1distance1·1The1Josephus1problem1·1Protein1interaction1networks1·1Operating1on1arrays1·1Enumerating1
binary1matrices1·1Clustering1data1·1Exercises
5.7 Notes and further reading · 208
1 1 1 1 1

6 Programs · 209 1 1

6.1 Scoping constructs · 2101 1 1

Localizing1names:1Module1·1Localizing1values:1Block ·1Localizing1constants:1With1·1Matrix1manipulation1·1Exercises
6.2 Options and messages · 217
1 1 1 1

Options1·1Messages1·1Exercises
6.3 Examples · 223 1 1

Sieve1of1Eratosthenes1·1Radius1of1gyration1·1Lag1plots1·1Random1walks1·1Exercises
6.4 Notes and further reading · 241
1 1 1 1 1

7 Strings · 2431 1

7.1 Structure and syntax · 244 1 1 1 1

Display1of1strings1·1Testing1strings1·1Measuring1strings1·1Character1codes1·1Exercises
7.2 Operations on strings · 247 1 1 1 1

Basic1string1operations1·1Strings1vs.1lists1·1Encoding1text1·1Anagrams1·1Exercises
7.3 String patterns · 255
1 1 1

Finding1subsequences1with1strings1·1Alternatives1·1Exercises
7.4 Regular expressions · 261
1 1 1

Contractions1·1Exercises
7.5 Examples · 267 1 1

Abecedarian1words1·1Random1strings1·1Partitioning1strings1·1DNA1sequence1analysis1·1Displaying1DNA1
sequences1·1Blanagrams1·1Exercises
7.6 Notes and further reading · 281
1 1 1 1 1

8 Graphics and visualization · 283


1 1 1 1

8.1 The graphics language · 284


1 1 1 1

Primitives1· Directives1·1Options1·1Three-dimensional1graphics1·1Structure1of1built-in1graphics1functions1·1Exercises
8.2 Dynamic graphics · 292 1 1 1

Manipulate1and1locators1·1Dynamic1building1blocks1·1Exercises
8.3 Efcient structures · 303
1 1 1

Multi-objects1·1GraphicsComplex1·1Numeric1vs.1symbolic1expressions1·1Exercises
x Contents

8.4 Examples · 314 1 1

Root1plots1·1Venn1diagrams1·1Dot1plots1·1Hypocycloids1·1Space-lling1plots1·1Simple1closed1paths1·1Points1in1a1
polygon1·1Triangle1centers1·1Exercises
8.5 Notes and further reading · 343
1 1 1 1 1

9 Program optimization · 345


1 1 1

9.1 Efcient programs · 346


1 1 1

Low-level1vs.1high-level1functions1·1Pattern1matching1·1Reducing1size1of1computation1·1Symbolic1vs.1numeric1
computation1·1Listability1·1Packed1arrays1·1Pure1functions1·1Built-in1pure1functions1·1Exercises
9.2 Parallel processing · 366
1 1 1

Basic1examples1·1Proling1·1Exercises
9.3 Compiling · 372 1 1

Compile1·1Compiling1to1C1·1Exercises
9.4 Notes and further reading · 378
1 1 1 1 1

10 Packages · 379
1 1

10.1 Working with packages · 379


1 1 1 1

Loading1and1using1packages1·1Package1location
10.2 Creating packages · 382
1 1 1

Contexts1·1Package1framework1·1Creation1and1deployment
10.3 RandomWalks package · 389 1 1 1

Package1source1code1·1Running1the1package1·1Exercises
10.4 Notes and further reading · 394
1 1 1 1 1

Bibliography · 395 1 1

Index · 405
1 1
Preface

Programming with Mathematica 1 1

In its brief history, the world of programming has undergone a remarkable evolution. Those of us
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

old enough to remember boxes of punch cards and batch jobs couldn’t be happier about some of
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

these changes. One could argue that the limitations, physical and conceptual, of the early program-
1 1 1 1 1 1 1 1 1 1 1 1 1 1

ming environments helped to focus that world in a very singular manner. Eventually, efforts to
1 1 1 1 1 1 1 1 1 1 1 1 1 1

overcome those limitations led to a very visible and broad transformation of the world of computer
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

programming. We now have a plethora of languages, paradigms, and environments to choose from.
1 1 1 1 1 1 1 1 1 1 1 1 1

At times this embarrassment of riches can be a bit overwhelming, but I think most would agree that
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

we are fortunate to have such variety in programming languages with which to do our work.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

I learned about Mathematica as I suspect many people have – after using several languages over
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

the years, a colleague introduced me to a new and very different tool, Mathematica. I soon realized
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

that it was going to help me in my work in ways that previous languages could not. Perhaps the
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

most notable feature was how quickly I could translate the statement of a problem to a working
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

program. This was no doubt due to having a functional style of programming at my ngertips but
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

also being able to think in terms of rules and patterns seemed to t well with my background in
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

mathematics.
Well, Mathematica is no longer a young up-start in the programming world. It has been around
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

now for over 25 years, making it, if not an elder statesman, certainly a mature and familiar player.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

And one that is used by people in elds as varied as linguistics, bioinformatics, engineering, and
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

information theory. Like myself, many people are rst introduced to it in an academic setting. Many
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

more are introduced through a colleague at work. Still others have seen it mentioned in various
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

media and are curious as to what it is all about. After using it to do basic or more advanced computa-
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

tion, most users soon nd the need to extend the default set of tools that come with Mathematica.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Programming is the ticket. 1 1 1

So what makes Mathematica such a useful programming tool? First, it is a well-designed language,
1 1 1 1 1 1 1 1 1 1 1 1 1 1

one whose internal logic will be quite apparent as you get to know it. It is not only easier to use but
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

it also provides an enjoyable programming experience. Second, it is a multi-paradigmatic language,


1 1 1 1 1 1 1 1 1 1 1 1

meaning several different styles of programming are available under one roof: functional program-
1 1 1 1 1 1 1 1 1 1 1 1

ming (like Lisp or Haskell), procedural programming (like C, Fortran, Java, Perl), logic program-
1 1 1 1 1 1 1 1 1 1 1 1 1

ming (like Prolog), rule-based programming (Snobol and some of Prolog), and it has a rich
1 1 1 1 1 1 1 1 1 1 1 1 1 1
xii Preface
g p g g
string pattern language, including support for regular expressions (like Perl). In no other language
1 1 1 1 1 1 1 1 1 1 1 1 1

can you program in so many styles and mix them at will.


1 1 1 1 1 1 1 1 1 1 1

The generality of the Mathematica language is in sharp contrast to what are called domain-specic
1 1 1 1 1 1 1 1 1 1 1 1 1 1

languages. As the name implies, these are languages designed to solve problems for a specic applica-
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

tion domain. HTML is a classic example – it is a markup language that is only really useful for its
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

intended purpose, marking up web pages. Similarly, TEX, used for page composition of technical
1 1 1 1 1 1 1 1 1 1 1 1 1

material and GraphML, for representing, formatting, and operating on graph objects, can both be
1 1 1 1 1 1 1 1 1 1 1 1 1

thought of as domain-specic languages.


1 1 1 1 1

Mathematica takes a different approach. The language is general enough that it can be used in a
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

variety of different disciplines to represent and solve computational problems. As for speed, it is fast
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

enough for many problems you will encounter. When the need to increase performance arises,
1 1 1 1 1 1 1 1 1 1 1 1 1

options are available: parallel programming, compilation, connecting to external programs.


1 1 1 1 1 1 1 1 1

Given the generality of Mathematica and the fact that you can choose different programming
1 1 1 1 1 1 1 1 1 1 1 1 1

paradigms with which to write your programs, the novice is often left feeling a little bewildered.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Which style should you use for a particular problem? Which is fastest? Which approach makes the
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

most sense for your particular domain? In general, although good Mathematica programmers rely on
1 1 1 1 1 1 1 1 1 1 1 1 1

a functional style to a great degree, your Mathematica programs will contain a combination of styles.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

They tend to be more compact, easier to read, and easier to debug (although not always) than more
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

traditional procedural implementations. Well, perhaps I am showing my bias. It may be that I chose
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Mathematica because it t well with how I think; or perhaps my adoption of Mathematica has shaped
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

the form of programs I write. Perhaps this is just another instance of the Sapir–Whorf hypothesis in
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

linguistics, which states that a spoken language inuences the patterns of thought of the speaker of
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

that language. Rather than go down that rabbit hole, let’s just say that you will program differently
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

with Mathematica, and, I think, more efciently and more enjoyably.


1 1 1 1 1 1 1 1 1

Who is this book for? 1 1 1 1

This book is designed for two overlapping audiences. First, it is intended as a self-contained, self-
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

study book for anyone who wants to learn how to use the Mathematica language to solve problems
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

in their domain. Typically, this includes researchers, academics, students, and even hobbyists who
1 1 1 1 1 1 1 1 1 1 1 1

are accustomed to picking up and learning about any tools that will help them do what they do
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

better. Comments from users of my previous books have persuaded me that an example-based
1 1 1 1 1 1 1 1 1 1 1 1 1

book, such as this, is appreciated by many.


1 1 1 1 1 1 1

Second, this book can also be used as a text in a course on Mathematica programming such as is
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

used in many schools and universities as part of, or in preparation for, a computational science
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

course. Toward that end, each section includes many exercises to check basic understanding of the
1 1 1 1 1 1 1 1 1 1 1 1 1 1

concepts in that section, as well as providing extended and (hopefully) interesting examples in their
1 1 1 1 1 1 1 1 1 1 1 1 1 1

own right. A complete set of solutions in both PDF format and as Mathematica notebooks is available
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

at the publisher’s website www.cambridge.org/wellin_essentials.


1 1 1 1
Preface xiii

The examples and exercises in this book draw from many different elds, including:
1 1 1 1 1 1 1 1 1 1 1 1

 Bioinformatics. Analysis of nucleotide sequences, computing GC ratios, displaying blocks of


1 1 1 1 1 1 1 1 1 1 1

genetic information, searching for subsequences, protein–protein interaction networks, dot


1 1 1 1 1 1 1 1 1

plots, displaying amino acid sequences, space-lling plots.


1 1 1 1 1 1

 Computer science. Encoding/encryption, sorting, adjacency structures, Collatz sequences,


1 1 1 1 1 1 1 1

Hamming numbers, Hamming weight, Tower of Hanoi, Fibonacci numbers, Fibonacci words,
1 1 1 1 1 1 1 1 1 1 1

Euler numbers, root nders, Horner polynomial representation, inverse permutations,


1 1 1 1 1 1 1 1 1

random number algorithms, sieving, associative arrays, Monte Carlo simulations,


1 1 1 1 1 1 1 1 1

comparisons with other languages. 1 1 1

 Data and signal analysis. Filtering signals (smoothing, clipping, removing spikes), entropy of
1 1 1 1 1 1 1 1 1 1 1 1

signals, Benford’s law, stem plots, lag plots, statistical analysis of data, random walks,
1 1 1 1 1 1 1 1 1 1 1 1 1

visualizing extent of data, Hamming distance, cluster analysis.


1 1 1 1 1 1 1

 Finance and economics. Time-series analysis of economic and nancial data, trend plots, stock
1 1 1 1 1 1 1 1 1 1 1 1 1

screens.
 Geometry. Convex hull, diameter of point sets, point-in-polygon problems, traveling salesman-
1 1 1 1 1 1 1 1 1 1

type problems, hypocycloids and epicycloids, area and perimeter problems, boundaries of
1 1 1 1 1 1 1 1 1 1 1

regions, Heron’s formula, triangle medians and centers.


1 1 1 1 1 1

 Graphs and networks. Random graphs, regular graphs, bond percolation, connected
1 1 1 1 1 1 1 1 1 1

components, dense graphs, directed acyclic graphs, neighborhood graphs, random walk on
1 1 1 1 1 1 1 1 1 1 1

graphs.
 Image processing. Resizing, ltering, segmentation.
1 1 1 1

 Mathematics. Palindromic numbers, triangular numbers, pyramidal numbers, truth tables,


1 1 1 1 1 1 1 1 1

prime gaps, Vandermonde and Jacobian matrices, Mersenne numbers, Venn diagrams,
1 1 1 1 1 1 1 1 1 1

geometric transformations. 1

 Solar physics and atmospheric science. Analyzing and visualizing sunspot activity using time
1 1 1 1 1 1 1 1 1 1 1 1

series, analyzing global sea-surface temperature data, solar magnetic eld cycles.
1 1 1 1 1 1 1 1 1

 Textual analysis and natural language processing. Corpus linguistics, word stemming, stop words,
1 1 1 1 1 1 1 1 1 1 1 1

comparative textual analysis, scraping websites for data, sorting strings, bigrams and n-grams,
1 1 1 1 1 1 1 1 1 1 1 1

word games (anagrams, blanagrams, palindromes), ltering text.


1 1 1 1 1 1

The background necessary to successfully navigate and learn from this book includes some
1 1 1 1 1 1 1 1 1 1 1 1

introductory undergraduate mathematics (basic linear algebra, geometry). The science topics and
1 1 1 1 1 1 1 1 1 1

problems introduced in this book are mostly self-contained and, where necessary, they point to
1 1 1 1 1 1 1 1 1 1 1 1 1

available references in the literature. Although no prior experience with programming is assumed,
1 1 1 1 1 1 1 1 1 1 1 1

even the most basic experience with writing, running, or debugging programs will be helpful in
1 1 1 1 1 1 1 1 1 1 1 1 1 1

getting you up and running more quickly.


1 1 1 1 1 1
xiv Preface

This book is not a tutorial introduction to Mathematica. For that, fortunately, there are many
1 1 1 1 1 1 1 1 1 1 1 1 1 1

useful resources available, including in-product tutorials, online courses, and many good books.
1 1 1 1 1 1 1 1 1 1 1

Refer to the Wolfram Research website for a comprehensive listing of these materials.
1 1 1 1 1 1 1 1 1 1 1 1

How to use this book 1 1 1 1

For those new to Mathematica, Chapter 1 will give you a sense of what it means to program, what it
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

means to program in Mathematica, and introduces you to some of the basic tools every Mathematica
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

user should know about: entering and evaluating expressions, dealing with errors, getting help.
1 1 1 1 1 1 1 1 1 1 1 1

The real meat of the book starts with Chapter 2, which provides a semi-formal description of the
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Mathematica language with a particular focus on expressions. Chapters 3 through 5 (lists, patterns
1 1 1 1 1 1 1 1 1 1 1 1 1

and rules, functions) are the core of the book. Lists are a fundamental data type in Mathematica and
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

provide a relatively simple structure for much of what follows. Pattern matching and the use of
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

transformation rules are an essential and somewhat unique aspect that every Mathematica program-
1 1 1 1 1 1 1 1 1 1 1 1

mer must master. Functional programming, introduced in Chapter 5, will likely be new to you, but
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

once you understand it, the speed and efciency of what you can do will increase dramatically.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Chapter 6 introduces localization constructs, options and messages enabling your programs to
1 1 1 1 1 1 1 1 1 1 1

look and behave much like the built-in functions. Although you could skip this chapter if you were
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

solely focused on solving particular computational problems, spending some time with these topics
1 1 1 1 1 1 1 1 1 1 1 1

will help you to start thinking like a programmer. How will your programs be used by others? How
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

will they likely interact with your programs? What should happen when something goes wrong?
1 1 1 1 1 1 1 1 1 1 1 1 1

Strings are used of course in linguistics, but they also have broad applicability in computer
1 1 1 1 1 1 1 1 1 1 1 1 1 1

science, web search, and bioinformatics. They are discussed in Chapter 7, which includes an intro-
1 1 1 1 1 1 1 1 1 1 1 1 1 1

duction to regular expressions. If you do little or no work with strings you could safely skim or skip
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

this chapter but there is a lot of useful material there if you do dive in.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Chapter 8 on graphics and visualization gives an introduction to the Mathematica graphics


1 1 1 1 1 1 1 1 1 1 1 1

language as well as the dynamic expression language as it relates to graphics. Topics on optimizing
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

your graphics code are included.


1 1 1 1

With all the different approaches available in Mathematica to solve problems, it is sometimes
1 1 1 1 1 1 1 1 1 1 1 1 1

difcult to determine the “best” approach. Chapter 9 on program optimization addresses this issue
1 1 1 1 1 1 1 1 1 1 1 1 1

from the point of view of speed and efciency; that is, which approaches will help your programs
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

run faster and use fewer system resources.


1 1 1 1 1 1

Chapter 10 provides a framework for those who wish to turn their programs into packages that
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

can be shared with colleagues, students, or clients. It includes an extended example, random walks,
1 1 1 1 1 1 1 1 1 1 1 1 1 1

so that you can begin to see examples of larger programs that include modularization, namespace
1 1 1 1 1 1 1 1 1 1 1 1 1 1

constructs, messaging, options, testing, and other meta-programming issues that are important to
1 1 1 1 1 1 1 1 1 1 1

think about as your programming skills advance.


1 1 1 1 1 1

To return to the question about which style of programming you should adopt for a particular
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

problem, I hope that this book will convince you that this is the wrong question to ask. As you
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

become more familiar with the Mathematica programming language, you will start to reword and
1 1 1 1 1 1 1 1 1 1 1 1 1

formulate your programs and implement them using all of the tools you have under your belt.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Another Random Document on
Scribd Without Any Related Topics
retiring to the Northern continent to breed and spend the summer. To
Wilson’s and Audubon’s descriptions, I refer the reader, as I have
scarcely anything to add to their accounts of these birds.
The Yellow-throat, one of the most beautiful of them, was first seen
by me on the 8th of October, on which day I obtained two males, in
distinct localities. I do not think the species had arrived long, though
some of the Sylvicolæ had been with us nearly two months, for I and
my servants were in the woods every day seeking for birds, and this
species is too striking to be easily overlooked. In the latter autumn
months it was quite common, particularly in marshy places: I have
seen it in some numbers hopping busily about the bulrushes in a
pond, even descending down the stems to the very surface of the
water, and picking minute flies from thence. The stomachs of such
as I have examined, contained fragments of beetles and other
insects.
In the spring, it seems to linger longer than its fellows; for the last
warbler that I saw was of this species, on the 1st of May. Yet Wilson
mentions that it habitually appears in Pennsylvania about the middle,
or last week, of April; and that it begins to build its nest about the
middle of May. The migration of the short-winged birds is probably
performed in straggling parties, and extends over a considerable
period of time; individuals remaining some time after the greater
number have departed.

WORM-EATER.[32]

Vermivora Pennsylvanica.
Sylvia vermivora, Lath.
Dacnis vermivpra, Aud. pl. 34.
Vermivora Pennsylvanica, Sw.

[32] Length 5 inches, expanse 8½, flexure 2½, tail 1⁸⁄₁₀, rictus ⁶⁄₁₀, tarsus
⁸⁄₁₀, middle toe ¹³⁄₂₀.
This is a scarce bird with us. Some three or four specimens are all
that have occurred to my observation. It seems, however, to spread
rather widely over the diversities of mountain and lowland; for, while
the first was obtained on the top of the Bluefields Peak, the next was
found close to the sea-shore. Its habits are constant: for we have
always observed it perched transversely on the dry trunks of slender
dead trees, engaged in peeping into, and picking from, the crevices
of the bark. In the stomachs of those which I have examined, I have
found comminuted insects. Spiders and caterpillars form the chief
portion of its food, according to Wilson.
It is too rare to warrant an opinion as to the period of its arrival or
departure: I first met with it on the 7th of October.

WATER THRUSH.[33]
Bessy Kick-up.—River-pink. (Rob. MSS.)

Seiurus Noveboracensis.
Motacilla Noveboracensis, Gm.—Aud. pl. 426.
Turdus aquaticus, Wils.
Seiurus Noveboracensis, Sw.

[33] Length 5½ inches, expanse 9⁴⁄₁₀, flexure 3, tail 2, rictus ⁷⁄₁₀, tarsus
⁹⁄₁₀, middle toe ¹³⁄₂₀.

I first saw this amusing species about the end of August, around
the muddy margins of ponds in St. Elizabeth and Westmoreland; and
immediately afterward they became so abundant, that individuals
were to be seen running here and there on the road, all the way from
Bluefields to Savanna-le-Mar, especially along the sea-shore, and by
the edges of morasses; not at all associating, however. They run
rapidly; often wade up to the heel in the water, or run along the twigs
of a fallen tree at the brink, now and then flying up into the pimento
and orange trees. When walking or standing, the tail is continually
flirted up in the manner of the Wagtails, whence the local name of
Kick-up, though, perhaps, none but a negro would consider a motion
of the tail, kicking. The resemblance of this bird to the Wagtail,
Wilson has noticed, and it is very striking in many respects. It walks
among the low grass of pastures, picking here and there, wagging
the tail, and uttering a sharp chip. Now and then it runs briskly, and
snatches something, probably a winged insect, from the grass.
Wilson praises its song very highly; in its winter residence with us it
merely chips monotonously. The stomachs of several that I have
dissected contained water-insects in fragments, and one or two
small pond shells.
There is a remarkable analogy in the Water Thrushes to the
Snipes and Plovers, in their habits of running by the side of water, of
wading, and of flirting up the hinder parts; in the height of the tarsi;
and in the elongation of the tertials. The Pea-Dove, which frequents
water more than any other of our Doves, has longer tertials than any.
Is there any connexion between the lengthening of these feathers,
and aquatic habits?

GOLD-CROWNED THRUSH.[34]
Land Kick-up.

Seiurus aurocapillus.
Turdus aurocapillus, Linn.—Aud. pl. 143.
Sylvia aurocapilla, Bonap.
Seiurus aurocapillus, Sw.

[34] Length 6¼ inches, expanse 9½, flexure 3, tail 2¹⁄₁₀, rictus ⁷⁄₁₀, tarsus
1, middle toe ¾.

The speckled breast, rich fulvous crown, and warm olive back,
make this a very pretty bird. His manners are much like those of his
cousin Bessy, running along with much wagging of the tail, and
chirping tsip, tsip, incessantly. He is, however, less aquatic in his
predilections. I first observed the species about the middle of
September; it was on a low part of the road by the side of a morass.
Its attitude struck me, as it was running on the ground with the tail
held almost perpendicularly upwards. In the stomach, a muscular
gizzard, I have occasionally found various seeds, gravel, mud-
insects, caterpillars, and small turbinate shells. I was one day
amused by watching two, unassociated, walking about a place
covered with dry leaves, beneath some trees. I was unseen by them,
though quite close. The tail of each was carried quite perpendicular
as they walked, which gave a most grotesque effect; but, as if this
elevation were not sufficient, at almost every step they jerked it up
still higher, the white under-coverts projecting in a puffy globose
form.
Though this species arrives in Jamaica rather later than the
preceding, they depart together, about the 20th of April: and soon
after this their appearance in the United States is recorded. Unlike
the preceding, the present species is said to be, even in summer,
destitute of song.

BLUE YELLOW-BACK WARBLER.[35]

Parula Americana.
Parus Americanus, Linn.
Sylvia Americana, Lath.—Aud. pl. 15.
Sylvia pusilla, Wils.
Parula Americana, Bonap.

[35] Length 4½ inches, expanse 7, flexure 2¼, tail 1⁶⁄₁₀, rictus ⁵⁄₁₀, tarsus
¾, middle toe ⁴⁄₁₀.

This pretty little species, so much in habits and appearance like


the European Tits, arrives in Jamaica early in September, and retires
late in April, for we last saw it on the 20th. During the autumn and
winter it was among the most common of our warblers. In the
morasses, especially, they were to be seen in numbers, yet not in
company, making the sombre mangrove-woods lively, if not vocal.
They are active and restless, hopping perpendicularly up the slender
boles, and about the twigs, peeping into the bases of the leaves, and
crevices of the bark, for insects.
The female, identified by dissection, has all the colours paler, but
agrees with the male in their variety and distribution. Individuals,
however, were found in September, which had the blue plumage of
the head and of the rump, tipped with yellow, imparting a green tinge
to those parts.

YELLOW-RUMP WARBLER.[36]

Sylvicola coronata.
Motacilla coronata, Linn.—Aud. pl. 153.
Sylvicola coronata, Sw.

[36] Length 5¾ inches, expanse 9²⁄₁₀, flexure 2⁹⁄₁₀, tail 2¼, rictus ⁶⁄₁₀,
(nearly), tarsus ¹⁷⁄₂₀, middle toe ¹¹⁄₂₀.

I have little to say of this changeable species. It occurs but


sparsely with us, coming rather late in the autumn, when the
plumage is undergoing its transformation, so well detailed by Wilson.
On only one occasion have I observed them numerous; towards the
latter part of March, on the estate called Dawkins’ Saltpond, near
Spanish town, many were hopping about the Cashaw trees
(Prosopis juliflora) that abound there. All of these that I examined,
had the yellow of the crown obscured, and some almost obliterated.
One which I shot in October did not display it at all, while one in
January had the hue very brilliant, but only at the bases of the
coronal feathers; exposed or concealed as in some of the Tyrants.
As far as I have observed, the manners of this bird are those of a
Flycatcher, capturing minute insects on the wing, and returning to a
twig to eat them. The stomach is usually filled with a black mass of
minute flies.
YELLOW-THROAT WARBLER.[37]

Sylvicola pensilis.
Sylvia pensilis, Lath.—Aud. pl. 85.
Sylvia flavicollis, Wils.
Sylvicola pensilis, Bonap.

[37] Length 5¼ inches, expanse 8, flexure 2½, tail 1⁹⁄₁₀, rictus ¹³⁄₂₀
(nearly), tarsus ¾, middle toe ¹¹⁄₂₀.

Wilson has justly observed that the habits of this lovely bird are
those of a Tit or a Creeper. I have usually observed it creeping about
the twigs of trees, or among the blossoms. The first I met with was
thus engaged, creeping in and out, and clinging to the beautiful and
fragrant flowers that grew in profuse spikes from the summit of a
papaw-tree. It is one of the earliest of our visitors from the north, for
this was on the 16th of August; and it remains until April among the
sunny glades of our magnificent island. The stomach of such as I
have examined was large, and contained caterpillars of various sizes
and species. An individual in March, which I proved by dissection to
be a female, did not differ in intensity of colouring, or any other
appreciable respect, from the male. The eggs in the ovary at that
season, were distinguishable, but minute.

YELLOW RED-POLL WARBLER.[38]

Sylvicola æstiva.
Sylvia æstiva et petechia, Lath.—Aud. pl. 95.
Sylvia citrinella et petechia, Wils.
Sylvia Childrenii (young,) Aud. pl. 35.
Sylvicola æstiva, Sw.

[38] Length 5¼ inches, expanse 8¹⁄₁₀, flexure 2⁶⁄₁₀, tail 2¹⁄₁₀, rictus ⁶⁄₁₀,
tarsus ⁹⁄₁₀, middle toe ½.
Of this very beautiful species, which has been described under so
many names, I have specimens in much diversity of plumage, from
that in which the chestnut crown, and spots of the breast are deep
and conspicuous, to that in which there is no trace either of the one
or the other. There is little in their manners to distinguish them from
others of this pretty family. They arrive in Jamaica in September, and
depart in April; and, like their fellows, hop about low trees, feeding on
small insects. In March, I observed it rather numerous, hopping
about the Cleome pentaphylla, and other low shrubs which were
then in flower, on the banks of the new cut of the Rio Cobre, not half
a mile from the sea of Kingston Harbour. Whenever I have seen it, it
has been very near the sea.

AURORA WARBLER.[39]

Sylvicola eoa.—Mihi.
[39] Length 5 inches, expanse 7⁶⁄₁₀, flexure 2⁷⁄₂₀, tail 1⁹⁄₁₀, rictus ⁶⁄₁₀,
(nearly), tarsus ⁹⁄₁₀, middle toe ½. Irides dark hazel; feet horn-colour;
beak pale horn, culmen and tip darker. Male. Upper parts olive,
approaching to yellow on the rump: sides of head marked with a band of
orange, extending from the ear to the beak, and meeting both on the
forehead and on the chin. Wing quills and coverts blackish with yellowish
edges. Tail blackish olive, with yellow edges; the outermost two feathers
on each side, have the greatest portion of the inner webs pale yellow.
Under parts pale yellow. The crown, rump, tertials, belly, and under tail-
coverts, are sparsely marked with undefined patches of pale orange.
Female. Nearly as the male, but the deep orange is spread over the
whole cheeks, chin, throat, and breast. The head and back are dusky
grey, tinged with olive, and patched with the fulvous, much more largely,
but irregularly, and as if laid upon the darker hue.

The pair of singularly marked Warblers which I describe below,


were shot on the 21st and 24th of January at Crabpond. That the
male in summer plumage would be much more brilliant than my
specimen, I have no doubt, for the latter is inferior to the female, and
the patched character of the plumage indicates that a seasonal
change was then proceeding. If it has been described in its nuptial
livery I have failed to recognise it. The male, which was the first
obtained, was hopping about the mangroves, which are abundant at
the marshy place named, from the summits down to the very surface
of the water; and the female was one of a pair that were toying, and
chasing each other through the branches of the same trees. At this
time, the ovary was scarcely developed, the ova being
distinguishable only with a lens. The stomach, in each case, was
filled with a black mass of insects.

RED-BACKED WARBLER.[40]
Prairie Warbler.—Wils.

Sylvicola discolor.
Sylvia discolor, Vieill.—Aud. pl. 14.
Sylvia minuta, Wils.

[40] Length 4¾ inches, expanse 7, flexure 2³⁄₁₀, tail 1⁹⁄₁₀, rictus ¹¹⁄₂₀,
tarsus ¾, middle toe ⁵⁄₁₀.

It is before the fierce heat of summer has begun to abate in the


prairies of the west, that this little bird seeks its winter quarters. On
the 18th of August I first met with it, on which day I shot two in
different localities. One was hopping hurriedly about low bushes, and
herbaceous weeds, not a foot from the ground, examining every
stalk and twig, as it proceeded regularly but rapidly along the road-
side, for insects. The other was differently engaged. It flew from a
bush by the way-side as far as the middle of the road, when hovering
in the air a few feet from the ground, it fluttered and turned hither and
thither, and then flew back to nearly the same spot as that whence it
had started. In a second or two it performed exactly the same
manœuvres again; and then a third time, preventing, by the
irregularity of its contortions, my taking aim at it, for some time. I
have no doubt it was capturing some of the minute dipterous flies
which were floating in the declining sun, in numerous swarms; but in
a manner not usual with the Warblers. The stomach, in each
specimen, was full of small fragments of insects. From that period to
April, on the 11th of which month I last saw it, it was a very common
resident in the bushes and low woods.
Wilson describes the markings of the female as less vivid than
those of the male; but two of that sex, which I shot in January, were
in no respect inferior to the brightest males. Some have the red
spots of the back almost, or even quite, obliterated; but this is not a
sexual distinction.

BLACK-THROATED BLUE WARBLER.[41]


Sylvicola Canadensis.
Motacilla Canadensis, Linn.
Sylvia Canadensis, Lath.—Aud. pl. 155.
Sylvia sphagnosa (young), Bonap.

[41] Length 5½ inches, expanse 8, flexure 2⁶⁄₁₀, tail 2¹⁄₈, rictus ¹¹⁄₂₀, tarsus
⁸⁄₁₀, middle toe ⁶⁄₁₀.

In its winter residence with us, the Black-throat prefers the edges
of tall woods, in unfrequented mountainous localities. I have scarcely
met with it in the lowlands. The summits of Bluefields Peaks, Bognie
and Rotherwood, are where I have been familiar with it. It was there
that Sam shot the first specimen that I obtained, on the 7th of
October, and at the same lofty elevation. I afterwards saw it
repeatedly. Three or four of these lovely birds frequently play
together with much spirit, for half an hour at a time, chasing each
other swiftly round and round, occasionally dodging through the
bushes, and uttering, at intervals, a pebbly chip. They often alight,
but are no sooner on the twig than off, so that it is difficult to shoot
them. I have observed one peck a glass-eye berry, and in the
stomachs of more than one, I have observed many hard shining
black seeds. But more frequently it leaps up at flies and returns to a
twig. At other times I have noticed it flitting and turning about in the
woods, apparently pursuing insects, and suddenly drop
perpendicularly fifteen or twenty feet, to the ground, and there hop
about. Restlessness is its character: often it alights transversely on
the long pendent vines and withes, or on slender dry trees, hopping
up and down them without a moment’s intermission, pecking at
insects. It is generally excessively fat, and what is rather unusual,
the fat is as white as that of mutton.
In the middle of March I met with it in the neighbourhood of
Spanish town, and, on the 9th of April, Sam found it at Crabpond, for
the last time, soon after which it, no doubt, deserted its insular for a
continental residence.
The form of the beak as well as the habits, of this bird, indicate an
approach to the Flycatchers.
In the Ornithology of M. Ramon de la Sagra’s Cuba, this species is
figured, under the name of Bijirita, which, however, appears to be
common to the Warblers. “Though migratory, it seems to breed
occasionally in the Antilles, for M. de la Sagra has killed in Cuba,
young ones, which were doubtless hatched in the island.”

OLIVE WARBLER.[42]

Sylvicola pannosa.—Mihi.
[42] Length 5 inches, expanse 7, flexure 2⁴⁄₁₀, tail 1⁹⁄₁₀, (nearly), rictus
⁵⁄₁₀, tarsus ⁹⁄₁₀, middle toe ⁶⁄₁₀. Irides dark brown; feet dark horn; beak
black. Upper parts dull olive; wing-quills blackish with olive edges; the
second, third, fourth, and fifth, have a white spot at the base of the outer
web, forming a short band. Tail greyish-black. Cheeks blackish-ash.
Upper parts yellowish-white, tinged on the breast and sides with dingy
olive.

The bird described below, a sombre exception to a particularly


brilliant family, I cannot refer to any species with which I am familiar;
it may, however, be the female of a recorded species. I regret that I
did not ascertain the sex of the individual described, the only one
that ever fell into my hands. Nor can I give any information
concerning it, but that it was shot by Sam, at Basin-spring, on the 8th
of October, hopping about low bushes.

ARROW-HEADED WARBLER.[43]

Sylvicola pharetra.—Mihi.
[43] Length 5⁴⁄₁₀ inches, expanse 8 (nearly), flexure 2¹¹⁄₂₀, tail 2, rictus
about ⁶⁄₁₀? tarsus ⁷⁄₁₀, middle toe ⁵⁄₁₀. Irides hazel; beak black above,
suture and lower mandible grey; feet purplish horn, with pale soles. Head,
neck, back, less coverts, chin, throat and breast, mottled with black and
white, each feather being grey at the base, and black, bounded on each
side by white, at the tip. The black preponderates on the upper parts, the
white on the breast, where the black spots take arrow-headed forms.
Wing-quills and coverts black; the first primaries have the middle portion
of their outer edge narrowly white, and those from the third to the seventh
inclusive have a more conspicuous white spot at the basal part of the
outer edge. The secondary greater coverts are tipped outwardly with
white, the medial coverts more broadly; and these form two bands, but
not very notable. Plumage of rump and tail-coverts unwebbed, brownish-
grey. Tail-feathers black, with paler edges, the outmost two or three
tipped inwardly with white. Sides, thighs, and under tail-coverts grey, with
indistinct black centres. Belly greyish white.

This is another species, of which I have but a single specimen. It


was shot on the 9th of February, in Bognie woods, on the top of
Bluefields Peak. I know nothing of its manners, but that it was
engaged, as Warblers commonly are, hopping on trees, and peeping
for insects. The specimen was a male. Its general aspect is like that
of the Black and white Creeper, but it may be distinguished at once
by comparison; the colours in that being distributed in greater
masses, and disposed in broad stripes; in this, in small mottlings, or
thick spotting, which difference is especially observable on the head.
The beak, also, though partly shot away in my specimen, is
decidedly that of a Sylvicola.

Fam.—MUSCICAPADÆ.—(The Flycatchers.)
REDSTART FLYCATCHER.[44]

Setophaga ruticilla.
Musicapa ruticilla, Linn.—Aud. pl. 40.
Motacilla flavicauda, (fem.) Gmel.
Setophaga ruticilla, Sw.

[44] Length of 5³⁄₈ inches, expanse 7½, flexure 2⁶⁄₁₀, tail 2¼, rictus ¹¹⁄₂₀,
tarsus ⁸⁄₁₀, middle toe ⁵⁄₁₀.
The great family of Flycatchers are distinguished by their
depressed beak and rictal bristles, and by their general habit of
capturing flying insects on the wing, and returning to a resting place
to swallow them. The species, before us, however, a bird of
remarkable elegance, both of form and colour,—combines with this
habit, those of the Warblers; Wilson’s assertion to the contrary
notwithstanding. It is particularly restless, hopping from one twig to
another through a wood, so rapidly, that it is difficult to keep it in
sight, though conspicuous from its brilliant contrast of colours; yet it
is not a shy bird. A good deal of its insect food it obtains by picking it
from the twigs and flowers. About the end of the year, a male was in
the habit of frequenting the lawn of Bluefields House, day after day.
In the early morning, while the grass was yet wet with dews, it might
be seen running on the ground, at which time its long tail being
raised at a small angle, and the fore parts of its body depressed, it
had much of the aspect of a Wagtail. It ran with great swiftness hither
and thither, a few feet at a time, and during each run, the wings were
opened and vibrated in a peculiar flutter with great rapidity. It was, I
am sure, taking small insects, as now and then it turned short.
Sometimes, instead of running, it took a short flight, but still close to
the turf.
One which was wounded in the wing, I put into a cage; on the floor
of which it sat, looking wildly upwards, the beautiful tail being
expanded like a fan, so as to display the orange-colour on each side.
All the while it chirped pertinaciously, producing the sharp sound of
two quartz pebbles struck together.
This was the very first of the migrant visitors from the North that I
met with, a female having been killed in the mountains of St.
Elizabeth as early as the 10th of August. We lost sight of it again
about the 20th of April; so that this species remains in the islands
upwards of eight months. Yet nearly four weeks before this, I
observed a pair engaged in amatory toying, pursuing each other to
and fro among the pimento trees.
On the 8th of May, 1838, being at sea in the Gulf of Mexico, not far
from the Dry Tortugas, a young male of this lovely species flew on
board. It would fly from side to side, and from rope to rope, as if
unwilling to leave the vessel, but occasionally it would stretch off to a
long distance, then turn round, and fly straight back again; it was not
at all exhausted. While I held it, it squeaked and bit at my hand
violently and fiercely.

BUFF-WINGED FLAT-BILL.[45]

Myiobius pallidus.—Mihi.
[45] Length 6¼ inches, expanse 8½, flexure 2⁸⁄₁₀, tail 2⁵⁄₁₀, rictus ¹³⁄₂₀,
breadth at base ⁷⁄₂₀, tarsus ⁶⁄₁₀, middle toe ⁴⁄₁₀. Irides hazel; feet black;
beak very depressed, lateral margin convex, upper mandible black, lower
pale fulvous, dark at tip. Upper parts olive-brown; wing-quills black, third
longest; greater coverts, secondaries, and tertiaries edged with pale
brown. Tail blackish, emarginated. Throat ashy, tinged with yellow. Breast,
belly, sides, and under tail-coverts, yellowish-brown. Under wing-coverts
dull-buff.

There is much resemblance between this species and the


Tyrannula megacephala of Swainson’s Birds of Brazil, pl. 47; but
they are manifestly distinct.
In unfrequented mountain roads, bordered by deep forests, the
Flat-bill is very common, and from its fearlessness easily obtained. In
the autumn months, the traveller may observe a dozen or more in
the course of a mile, sitting on the projecting branches of the way-
side woods. There is, however, nothing like association of one with
another; like the other Tyrants, it is quite solitary, at least in its
occupation. It flies very little, the wings being short and hollow; but
sits on a twig, and leaps out at vagrant flies, which it catches with a
loud snap, and returns; it utters a feeble squeak as it sits.
Sometimes it emits a weak wailing cry, as, it flits from one tree to
another.
The analogies often observed between animals possessing no
affinity, is curious. The flat, weak bill, darker above than below, the
general form, the hollow wings, the loose plumage, and the habit of
sitting on a low twig unmoved by the presence of man, this species
possesses in common with the Tody.

BLACK-BILLED FLAT-BILL.[46]

Myiobius tristis.—Mihi.
[46] Length 6¾ inches, expanse 9¼, flexure 2⁹⁄₁₀, tail 2¾, rictus ¹⁷⁄₂₀,
breadth at base ⁴⁄₁₀, tarsus ¾, middle toe ¹¹⁄₂₀. Irides dark hazel; beak
black above, dark brown beneath, formed as that of the preceding. Feet
greyish black. Crown deep bistre-brown, softening on the back to a paler
hue, slightly tinged with olive; tail-coverts dark umber. Wings black;
greater and mid coverts, and secondaries edged with pale umber; the
tertials have still paler edges. Tail smoky black, each feather narrowly
edged with umber. Sides of head and neck, pale bistre. Chin, throat, and
fore neck, ashy-grey, blending on the breast with the pure straw-yellow,
which is the hue of the belly, sides, vent, and under tail-coverts. Edge of
shoulder pale buff.

A very common species, frequenting the edges of high woods and


road-sides, like the preceding, the manners of these birds being
nearly the same. It is a skilful fly-catcher, and a voracious one. I have
taken a Libellula of considerable size from the stomach of one, which
not only filled that organ, but extended through the proventriculus to
the œsophagus: the head was downward, which position was of
course the most favourable for being swallowed.
When taken in the hand, it erects the crown-feathers, and snaps
the beak loudly and often, uttering shrill squeaks also, at intervals. Its
note is one of the very earliest; even before the light of day has
begun to dim the brilliancy of the morning star, this little bird is vocal.
A single wailing note, somewhat protracted, is his ordinary voice,
particularly sad to hear, but sometimes followed by one or two short
notes in another tone.
I have never met with the nest of either this or the preceding
species, but Robinson (MSS. ii. 98,) describing this bird as “the
Lesser Loggerhead of Jamaica,” says, “they have three young,
generally reared in any hollow place of a tree in June.” He adds,
“they have no note;” but in this he was in error.

FOOLISH PETCHARY.[47]
Little Tom-fool.

Myiobius stolidus.—Mihi.
[47] Length 7½ inches, expanse 10½, flexure 3¼, tail 3, rictus 1, tarsus
⁹⁄₁₀, middle toe ¹¹⁄₂₀. Irides dark hazel; beak black; feet blackish grey.
Upper parts bistre-brown, rather paler on the back. Wing primaries have
the basal part of their outer edge, narrowly chestnut; greater and mid
coverts, secondaries and tertiaries, edged and tipped with whitish. Tail
even, the feathers broadly edged inwardly with chestnut. Cheeks grey,
mottled; chin, throat, and fore-breast, greyish white; breast, belly, vent
under-tail-coverts, and interior of wings pale yellow. Head feathers
erectile. Female has the primaries and tail-feathers edged with whitish,
instead of chestnut. Two minute cæca.

For a time I considered this to be the Pewee of Wilson, but its


superior size, grey throat, and rufous edges of the wing and tail,
have convinced me that it is quite distinct. I have little information to
give concerning it that would distinguish it from the other Tyrants. It
resides in Jamaica permanently, and is of rather common
occurrence, at the edges of woods; it manifests, perhaps, less fear of
man than even its congeners, often pursuing its employment of
catching insects though a person stand beneath the twig which it has
chosen as a station. If it does remove it usually perches again a few
yards off, and sits looking at the stranger.
I have not found its nest; but near the end of August, I met some
negro boys who had three young ones of this species, which they
had just taken from the nest, situated, as they described, in a hollow
stump.
GREY PETCHARY.[48]

Tyrannus Dominicensis.
Muscicapa Dominicensis, Linn.—Aud. pl. 170.
Tyrannus griseus, Vieill. Ois. de l’Am. 46.
Tyrannus Dominicensis, Bonap.

[48] Length 9½ inches, expanse 14½, tail 3⁸⁄₁₀, flexure 4⁵⁄₈, rictus 1¼,
tarsus ⁹⁄₁₀, middle toe ¾. Irides dark hazel. Intestine 8 inches: two cæca
very minute, about ¹⁄₈ inch long, and no thicker than a pin, at 1 inch from
the cloaca. Sexes exactly alike.

The history of this bird shall be mainly told by my valued friend Mr.
Hill. “It is along the sea-side savannas and pastures, and among the
adjacent hills and valleys, that the migratory flocks of the Grey
Petchary swarm at the beginning of September. Occasional showers
have given a partial freshness to the lowland landscape; the fields
have begun to look grassy and green, and the trees to brighten with
verdure, when numbers of these birds appear congregated on the
trees around the cattle ponds, and about the open meadows,
hawking the insect-swarms that fill the air at sun-down. No sooner do
the migrant visitors appear on our shores, than the several birds of
the species, that breed with us, quit their nestling trees, and
disappear from their customary beat. They join the stranger flocks,
and gather about the places to which the migratory visitors resort,
and never resume their ordinary abodes till the breeding season
returns.
The migrant visitors do not appear among us many days before
they become exceedingly fat: they are then eagerly sought after by
the sportsman, who follows the flocks to their favourite haunts, and
slaughters them by dozens. The Petchary is not exclusively an
insect-feeder;—the sweet wild berries tempt him. In September the
pimenta begins to fill and ripen, and in these groves the birds may
always be found, not so much gathered in flocks as thickly dispersed
about. It is, however, at sunset that they exclusively congregate;
when insect life is busiest on the wing. Wherever the stirring swarms
abound, they may be seen ranged in dense lines on the bare branch
of some advantageous tree. By the end of September, the migrant
Petcharies quit us, leaving with us most of those which bred with us.”
“The Petchary is among the earliest breeders of the year. As early
as the month of January the mated pairs are already in possession
of some lofty and commanding tree, sounding at day-dawn that
ceaseless shriek, composed of a repetition of some three or four
shrill notes, very similar to the words pecheery—pecheery—pe-
chēēr-ry, from which they receive their name. To this locality they
remain constant till the autumn. They then quit these haunts, and
congregate about the lowland ponds. At some hour or two before
sunset, they assemble in considerable numbers to prey upon the
insects that hover about these watering-places. They are then
observed unceasingly winging upward and downward, and athwart
the waters, twittering and shrieking, but never flying far. They dart off
from some exposed twig, where they had sat eight or ten in a row,
and return to it again, devouring there, the prey they have caught.
Their evolutions are rapid; their positions of flight are constantly and
hurriedly changing; they shew at one while all the outer, and at
another all the inner plumage; and they fly, checking their speed
suddenly, and turning at the smallest imaginable angle. There are
times when the Petchary starts off in a straight line from his perch,
and glides with motionless wings, as light and buoyant as a
gossamer, from one tree to another. When he descends to pick an
insect from the surface of the water, his downward course is as if he
were tumbling, and when he rises in a line upward, he ascends with
a curious lift of the wings, as if he were thrown up in the air, and
were endeavouring to recover himself from the impetus.
“The congregated flocks disappear entirely before the month of
October is out. It is only in some five or six weeks of the year that
they are reconciled to association in communities. At all other times
they restrict their company to their mates, and permit no other bird to
divide with them their solitary trees.
“From the window of the room in which I am writing, I look out
upon a very lofty cocoa-nut tree, in the possession of a pair of
Petcharies. Long before the voice of any other bird is heard in the
morning, even when daylight is but faintly gleaming, the shrill
unvarying cry of these birds is reiterated from their aerie on the tree-
top. Perched on this vantage-height, they scream defiance to every
inhabitant around them, and sally forth to wage war on all the birds
that venture near. None but the Swallow dares to take the circuit of
their nestling tree. At a signal from one of the birds, perhaps the
female, when a Carrion Vulture is sweeping near, or a Hawk is
approaching, the mate flings himself upwards in the air, and having
gained an elevation equal to that of the bird he intends to attack, he
starts off in a horizontal line, with nicely balanced wings, and
hovering for a moment, descends upon the intruder’s back, shrieking
all the while, as he sinks and rises, and repeats his attacks with
vehemence. The Carrion Vulture, that seldom courses the air but
with gliding motion now flaps his wings eagerly, and pitches
downward at every stroke his assailant makes at him, and tries to
dodge him. In this way he pursues him, and frequently brings him to
the ground.
“The Hawk is beset by all birds of any power of wing, but the
boldest, and, judging from the continued exertion he makes to
escape, the most effective of his assailants is the Petchary. It is not
with feelings of contempt the Hawk regards this foe:—he hurries
away from him with rapid flight, and hastily seeks to gain some
resting place; but as he takes a direct course from one exposed tree
to another equally ill-suited, he is seen again submitting to the
infliction of a renewed visit from his pertinacious assailant, till he is
constrained to soar upward, and speed away, wearied by the buffets
of his adversary.
“The appearance of the Petchary, when he erects the feathers of
his crest, or opens those of his forehead, and shews glimpses of his
fiery crown is fierce, vindictive, and desperate. His eye is deeply
dark, and his bill, although it greatly resembles, in its robust make,
that of the Raven, is even of sturdier proportions than that bird’s; the
bristles are black, and amazingly strong.
“The Petchary has been known to make prey of the Humming-bird,
as it hovers over the blossom of the garden. When he seizes it, he
kills it by repeated blows, struck on the branch where he devours it. I
have remarked him, beside, beating over little spaces of a field, like
a Hawk, and reconnoitring the flowers beneath him; searching also
along the blossoms of a hedge-bank, and striking so violently into
the herbage for insects, that he has been turned over as he grabbed
his prey, and seemed saved from breaking his neck in his
vehemence, only by the recoil of the herbage.
“His nest in this part of the island has seldom been found in any
other trees than those of the palm-kind. Amid the web of fibres that
encircle the footstalk of each branch of the cocoa-nut, he weaves a
nest, lined with cotton, wool, and grass. The eggs are four or five, of
an ivory colour, blotched with deep purple spots, intermingled with
brown specks, with the clusters thickening at the greater end. The
Eagle, flapping his pinions as he shrieks from his rock when the
tempest-cloud passes by, is not a more striking picture than this little
bird, when, with his anxieties all centred in the cradle of his young
ones, he stands in ‘his pride of place,’ on the limb of his palm,
towering high above all other trees, and battling with the breeze that
rocks it, and, rush after rush as the wind sweeps onward, flutters his
wings with every jerk of the branches, and screams like a fury.”
I have little to add to the above detail. With us at the western end
of the Island, the Grey Petchary is wholly migratory, not one having
been seen by us from October to April. If its migrations be, as I have
reason to think, not northward and southward, but eastward and
westward, this fact is easily accounted for, from the greater nearness
of our part to Central America, where they probably winter. This
species is found in St. Domingo, but not, as it appears, in Cuba,
where it seems to be represented by T. Magnirostris, D’Orb., nor has
it been recognised, except accidentally, in North America. Even its
wintering about Spanish Town, seems to be not constant, for from
communications made to me by Mr. Hill, the present spring, I infer
none had been seen through the winter. In Westmoreland, I
observed the first individual after the winter, on the 30th of March, at
the Short Cut of Paradise-morass; and a day or two afterwards they
were numerous there, and were advancing to the eastward. Yet on
the 16th of April, Mr. Hill writes me, “It is worth remarking that,
although Grey Petcharies have been several days now with you,
they have not made their appearance here yet.” He adds the
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like