100% found this document useful (1 vote)
13 views

NumPy 3rd Edition Build efficient high speed programs using the high performance NumPy mathematical library Ivan Idris - Read the ebook online or download it to own the complete version

The document promotes the third edition of 'NumPy' by Ivan Idris, which focuses on building efficient high-speed programs using the NumPy mathematical library. It includes links to download the book and other related ebooks, as well as information about the author's background and contributions. Additionally, it contains a detailed table of contents outlining various chapters and topics covered in the book.

Uploaded by

djabuqorchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
13 views

NumPy 3rd Edition Build efficient high speed programs using the high performance NumPy mathematical library Ivan Idris - Read the ebook online or download it to own the complete version

The document promotes the third edition of 'NumPy' by Ivan Idris, which focuses on building efficient high-speed programs using the NumPy mathematical library. It includes links to download the book and other related ebooks, as well as information about the author's background and contributions. Additionally, it contains a detailed table of contents outlining various chapters and topics covered in the book.

Uploaded by

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

Visit ebookfinal.

com to download the full version and


explore more ebooks or textbooks

NumPy 3rd Edition Build efficient high speed


programs using the high performance NumPy
mathematical library Ivan Idris

_____ Click the link below to download _____


https://ebookfinal.com/download/numpy-3rd-edition-build-
efficient-high-speed-programs-using-the-high-performance-
numpy-mathematical-library-ivan-idris/

Explore and download more ebooks or textbook at ebookfinal.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

NumPy Cookbook Python 2nd Edition Ivan Idris

https://ebookfinal.com/download/numpy-cookbook-python-2nd-edition-
ivan-idris/

High Commitment High Performance How to Build A Resilient


Organization for Sustained Advantage 1st Edition Michael
Beer
https://ebookfinal.com/download/high-commitment-high-performance-how-
to-build-a-resilient-organization-for-sustained-advantage-1st-edition-
michael-beer/

Super High Strength High Performance Concrete 1st Edition


Pu Xincheng (Author)

https://ebookfinal.com/download/super-high-strength-high-performance-
concrete-1st-edition-pu-xincheng-author/

High Performance MySQL 3rd Edition Optimization Backups


and Replication Baron Schwartz

https://ebookfinal.com/download/high-performance-mysql-3rd-edition-
optimization-backups-and-replication-baron-schwartz/
High Performance Android Apps Improve Ratings with Speed
Optimizations and Testing 1 (Early Release) Edition Doug
Sillars
https://ebookfinal.com/download/high-performance-android-apps-improve-
ratings-with-speed-optimizations-and-testing-1-early-release-edition-
doug-sillars/

High speed VLSI interconnections 2nd ed Edition Ashok K.


Goel

https://ebookfinal.com/download/high-speed-vlsi-interconnections-2nd-
ed-edition-ashok-k-goel/

R High Performance Programming 1st Edition Lim

https://ebookfinal.com/download/r-high-performance-programming-1st-
edition-lim/

PostgreSQL 9 0 High Performance Gregory Smith

https://ebookfinal.com/download/postgresql-9-0-high-performance-
gregory-smith/

NGINX Cookbook Advanced Recipes for High Performance Load


Balancing 3rd Edition Derek Dejonghe

https://ebookfinal.com/download/nginx-cookbook-advanced-recipes-for-
high-performance-load-balancing-3rd-edition-derek-dejonghe/
NumPy 3rd Edition Build efficient high speed programs
using the high performance NumPy mathematical library
Ivan Idris Digital Instant Download
Author(s): Ivan Idris
ISBN(s): 9781785281969, 1785281968
File Details: PDF, 22.11 MB
Year: 2015
Language: english
www.it-ebooks.info
NumPy Beginner's Guide
Third Edition

Build efficient, high-speed programs using the


high-performance NumPy mathematical library

Ivan Idris

BIRMINGHAM - MUMBAI

www.it-ebooks.info
NumPy Beginner's Guide
Third Edition

Copyright © 2015 Packt Publishing

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.

First published: November 2011

Second edition: April 2013

Third edition: June 2015

Production reference: 1160615

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-78528-196-9

www.packtpub.com

www.it-ebooks.info
Credits

Author Project Coordinator


Ivan Idris Shweta H. Birwatkar

Reviewers Proofreader
Alexandre Devert Safis Editing
Davide Fiacconi
Ardo Illaste Indexer
Rekha Nair

Commissioning Editor
Amarabha Banerjee Graphics
Sheetal Aute

Acquisition Editors Jason Monteiro


Shaon Basu
Usha Iyer Production Coordinator
Aparna Bhagat
Rebecca Youe

Cover Work
Content Development Editor
Aparna Bhagat
Neeshma Ramakrishnan

Technical Editor
Rupali R. Shrawane

Copy Editors
Charlotte Carneiro
Vikrant Phadke
Sameen Siddiqui

www.it-ebooks.info
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.

www.it-ebooks.info
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.it-ebooks.info
www.PacktPub.com

Support files, eBooks, discount offers, and more


For support files and downloads related to your book, please visit 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
[email protected] 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

Free access for Packt account holders


If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view 9 entirely free books. Simply use your login credentials for
immediate access.

www.it-ebooks.info
www.it-ebooks.info
www.it-ebooks.info
I dedicate this book to my aunt Lies who recently passed away. Rest in peace.

www.it-ebooks.info
www.it-ebooks.info
Table of Contents
Preface ix
Chapter 1: NumPy Quick Start 1
Python 1
Time for action – installing Python on different operating systems 2
The Python help system 3
Time for action – using the Python help system 3
Basic arithmetic and variable assignment 4
Time for action – using Python as a calculator 4
Time for action – assigning values to variables 5
The print() function 6
Time for action – printing with the print() function 6
Code comments 7
Time for action – commenting code 7
The if statement 8
Time for action – deciding with the if statement 8
The for loop 9
Time for action – repeating instructions with loops 9
Python functions 11
Time for action – defining functions 11
Python modules 12
Time for action – importing modules 12
NumPy on Windows 13
Time for action – installing NumPy, matplotlib, SciPy, and IPython on Windows 13
NumPy on Linux 15
Time for action – installing NumPy, matplotlib, SciPy, and IPython on Linux 15
NumPy on Mac OS X 16
Time for action – installing NumPy, SciPy, matplotlib, and IPython with
MacPorts or Fink 16

[i]

www.it-ebooks.info
Table of Contents

Building from source 16


Arrays 17
Time for action – adding vectors 17
IPython – an interactive shell 21
Online resources and help 25
Summary 26
Chapter 2: Beginning with NumPy Fundamentals 27
NumPy array object 28
Time for action – creating a multidimensional array 29
Selecting elements 30
NumPy numerical types 31
Data type objects 33
Character codes 33
The dtype constructors 34
The dtype attributes 35
Time for action – creating a record data type 35
One-dimensional slicing and indexing 36
Time for action – slicing and indexing multidimensional arrays 36
Time for action – manipulating array shapes 39
Time for action – stacking arrays 41
Time for action – splitting arrays 46
Time for action – converting arrays 51
Summary 51
Chapter 3: Getting Familiar with Commonly Used Functions 53
File I/O 53
Time for action – reading and writing files 54
Comma-seperated value files 55
Time for action – loading from CSV files 55
Volume Weighted Average Price 56
Time for action – calculating Volume Weighted Average Price 56
The mean() function 56
Time-weighted average price 57
Value range 58
Time for action – finding highest and lowest values 58
Statistics 59
Time for action – performing simple statistics 59
Stock returns 62
Time for action – analyzing stock returns 63
Dates 65

[ ii ]

www.it-ebooks.info
Table of Contents

Time for action – dealing with dates 65


Time for action – using the datetime64 data type 69
Weekly summary 70
Time for action – summarizing data 70
Average True Range 74
Time for action – calculating Average True Range 75
Simple Moving Average 77
Time for action – computing the Simple Moving Average 77
Exponential Moving Average 80
Time for action – calculating the Exponential Moving Average 80
Bollinger Bands 82
Time for action – enveloping with Bollinger Bands 83
Linear model 86
Time for action – predicting price with a linear model 86
Trend lines 89
Time for action – drawing trend lines 90
Methods of ndarray 94
Time for action – clipping and compressing arrays 94
Factorial 95
Time for action – calculating the factorial 95
Missing values and Jackknife resampling 96
Time for action – handling NaNs with the nanmean(), nanvar(),
and nanstd() functions 97
Summary 98
Chapter 4: Convenience Functions for Your Convenience 99
Correlation 100
Time for action – trading correlated pairs 100
Polynomials 104
Time for action – fitting to polynomials 105
On-balance volume 108
Time for action – balancing volume 109
Simulation 111
Time for action – avoiding loops with vectorize() 111
Smoothing 114
Time for action – smoothing with the hanning() function 114
Initialization 118
Time for action – creating value initialized arrays with the full() and
full_like() functions 119
Summary 120

[ iii ]

www.it-ebooks.info
Table of Contents

Chapter 5: Working with Matrices and ufuncs 121


Matrices 122
Time for action – creating matrices 122
Creating a matrix from other matrices 123
Time for action – creating a matrix from other matrices 123
Universal functions 125
Time for action – creating universal functions 125
Universal function methods 126
Time for action – applying the ufunc methods to the add function 127
Arithmetic functions 129
Time for action – dividing arrays 129
Modulo operation 131
Time for action – computing the modulo 131
Fibonacci numbers 132
Time for action – computing Fibonacci numbers 133
Lissajous curves 134
Time for action – drawing Lissajous curves 135
Square waves 136
Time for action – drawing a square wave 137
Sawtooth and triangle waves 138
Time for action – drawing sawtooth and triangle waves 139
Bitwise and comparison functions 140
Time for action – twiddling bits 141
Fancy indexing 143
Time for action – fancy indexing in-place for ufuncs with the at() method 144
Summary 144
Chapter 6: Moving Further with NumPy Modules 145
Linear algebra 145
Time for action – inverting matrices 146
Solving linear systems 148
Time for action – solving a linear system 148
Finding eigenvalues and eigenvectors 149
Time for action – determining eigenvalues and eigenvectors 150
Singular value decomposition 151
Time for action – decomposing a matrix 152
Pseudo inverse 154
Time for action – computing the pseudo inverse of a matrix 154
Determinants 155
Time for action – calculating the determinant of a matrix 155
Fast Fourier transform 156

[ iv ]

www.it-ebooks.info
Table of Contents

Time for action – calculating the Fourier transform 156


Shifting 158
Time for action – shifting frequencies 158
Random numbers 160
Time for action – gambling with the binomial 161
Hypergeometric distribution 163
Time for action – simulating a game show 163
Continuous distributions 165
Time for action – drawing a normal distribution 165
Lognormal distribution 167
Time for action – drawing the lognormal distribution 167
Bootstrapping in statistics 169
Time for action – sampling with numpy.random.choice() 169
Summary 171
Chapter 7: Peeking into Special Routines 173
Sorting 173
Time for action – sorting lexically 174
Time for action – partial sorting via selection for a fast median
with the partition() function 175
Complex numbers 176
Time for action – sorting complex numbers 177
Searching 178
Time for action – using searchsorted 178
Array elements extraction 179
Time for action – extracting elements from an array 179
Financial functions 180
Time for action – determining the future value 181
Present value 183
Time for action – getting the present value 183
Net present value 183
Time for action – calculating the net present value 184
Internal rate of return 184
Time for action – determining the internal rate of return 185
Periodic payments 185
Time for action – calculating the periodic payments 185
Number of payments 186
Time for action – determining the number of periodic payments 186
Interest rate 186
Time for action – figuring out the rate 186
Window functions 187

[v]

www.it-ebooks.info
Table of Contents

Time for action – plotting the Bartlett window 187


Blackman window 188
Time for action – smoothing stock prices with the Blackman window 189
Hamming window 190
Time for action – plotting the Hamming window 190
Kaiser window 191
Time for action – plotting the Kaiser window 192
Special mathematical functions 192
Time for action – plotting the modified Bessel function 193
sinc 194
Time for action – plotting the sinc function 194
Summary 196
Chapter 8: Assuring Quality with Testing 197
Assert functions 198
Time for action – asserting almost equal 198
Approximately equal arrays 199
Time for action – asserting approximately equal 200
Almost equal arrays 200
Time for action – asserting arrays almost equal 201
Equal arrays 202
Time for action – comparing arrays 202
Ordering arrays 203
Time for action – checking the array order 203
Object comparison 204
Time for action – comparing objects 204
String comparison 204
Time for action – comparing strings 205
Floating-point comparisons 205
Time for action – comparing with assert_array_almost_equal_nulp 206
Comparison of floats with more ULPs 207
Time for action – comparing using maxulp of 2 207
Unit tests 207
Time for action – writing a unit test 208
Nose test decorators 210
Time for action – decorating tests 211
Docstrings 213
Time for action – executing doctests 214
Summary 215

[ vi ]

www.it-ebooks.info
Table of Contents

Chapter 9: Plotting with matplotlib 217


Simple plots 217
Time for action – plotting a polynomial function 218
Plot format string 219
Time for action – plotting a polynomial and its derivatives 219
Subplots 221
Time for action – plotting a polynomial and its derivatives 221
Finance 223
Time for action – plotting a year's worth of stock quotes 223
Histograms 226
Time for action – charting stock price distributions 226
Logarithmic plots 228
Time for action – plotting stock volume 228
Scatter plots 230
Time for action – plotting price and volume returns with a scatter plot 230
Fill between 232
Time for action – shading plot regions based on a condition 232
Legend and annotations 234
Time for action – using a legend and annotations 235
Three-dimensional plots 238
Time for action – plotting in three dimensions 238
Contour plots 240
Time for action – drawing a filled contour plot 240
Animation 241
Time for action – animating plots 241
Summary 243
Chapter 10: When NumPy Is Not Enough – SciPy and Beyond 245
MATLAB and Octave 245
Time for action – saving and loading a .mat file 246
Statistics 247
Time for action – analyzing random values 247
Sample comparison and SciKits 250
Time for action – comparing stock log returns 250
Signal processing 253
Time for action – detecting a trend in QQQ 253
Fourier analysis 256
Time for action – filtering a detrended signal 256
Mathematical optimization 259
Time for action – fitting to a sine 259
Numerical integration 263

[ vii ]

www.it-ebooks.info
Table of Contents

Time for action – calculating the Gaussian integral 263


Interpolation 264
Time for action – interpolating in one dimension 264
Image processing 266
Time for action – manipulating Lena 266
Audio processing 268
Time for action – replaying audio clips 268
Summary 270
Chapter 11: Playing with Pygame 271
Pygame 271
Time for action – installing Pygame 272
Hello World 272
Time for action – creating a simple game 272
Animation 275
Time for action – animating objects with NumPy and Pygame 275
matplotlib 278
Time for Action – using matplotlib in Pygame 278
Surface pixels 282
Time for Action – accessing surface pixel data with NumPy 282
Artificial Intelligence 284
Time for Action – clustering points 284
OpenGL and Pygame 287
Time for Action – drawing the Sierpinski gasket 287
Simulation game with Pygame 290
Time for Action – simulating life 290
Summary 294
Appendix A: Pop Quiz Answers 295
Appendix B: Additional Online Resources 299
Python 299
Mathematics and statistics 300
Appendix C: NumPy Functions' References 301
Index 307

[ viii ]

www.it-ebooks.info
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.

Python is a popular general-purpose programming language that is widely used in the


scientific community. You can access legacy C, Fortran, or R code easily from Python. It
is object-oriented and considered to be of a higher level than C or Fortran. It allows you
to write readable and clean code with minimal fuss. However, it lacks an out-of-the-box
MATLAB equivalent. That's where NumPy comes in. This book is about NumPy and related
Python libraries, such as SciPy and matplotlib.

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.

www.it-ebooks.info
Discovering Diverse Content Through
Random Scribd Documents
“I assure you, mother-in-law, that I had no intention——”
“That will do. I accept your excuses. We now come to a more
delicate matter, to—but, of course, you must understand me.”
“I confess that I do not at all.”
“Listen, son-in-law. Some newly married young men, on their
wedding-night, when the ball is at its gayest, take the liberty of
carrying off their wives, and disappearing with them about twelve
o’clock.”
“And you object to that?”
“Fie, sir, fie! If you were to be guilty of such a thing, I would make
your wife sue for a divorce the day after your marriage.”
“Be easy, then; I will not disappear. But when may I go away with
my wife?”
“I shall take my daughter with me, and arrange an opportune time
when the decencies of the situation may be observed.”
“And who will take me?”
“You will go alone, but you will not go, understand me well, until
there isn’t a cat left at the ball.”
“I shall be getting to bed very late, then. Some of the people will
want square dances and country dances, and——”
“You will get to bed soon enough, son-in-law.”
“But why all this, mother-in-law?”
“That will do, M. Tamponnet! It is not becoming that this
conversation be prolonged.”

Alexandre Dumas, the Elder, was a noted novelist and dramatist.


His output was enormous, and the wit, though always discernible,
was subordinate to matters of heroism, adventure and the like.
CHAPTER TOUCHING THE OLFACTORY ORGAN

Has it ever occurred to you, dear reader, how admirable an organ


the nose is?
The nose; yes, the nose.
And how useful an article this very nose is to every creature
which, as Ovid says, lifts its face to heaven?
Well, strange as it may seem, monstrous ingratitude that it is, no
poet has yet thought of addressing an ode to the nose!
So it has been left to me, who am not a poet, or who, at least,
claim to rank only after our greatest poets, to conceive such an idea.
Truly, the nose is unfortunate.
So many things have been invented for the eyes:
Songs and compliments and kaleidoscopes, pictures and scenery
and spectacles.
And for the ears:
Ear-rings, of course, and Robert the Devil, William Tell, and Fra
Diavolo, Stradivarius violins and Érard pianos and Sax trumpets.
And for the mouth:
Lent, plain cooking, The Gastronomists’ Calendar, The Gormand’s
Dictionary. Soups of every kind have they made for it, from Russian
broth to French cabbage-soup; dishes for it are connected with the
reputations of the greatest men, from Soubise cutlets to Richelieu
puddings; its lips have been compared to coral, its teeth to pearls, its
breath to perfume. Before it have been set plumed peacocks and
undrawn snipes; and, for the future, it has been promised whole
roast larks.
But what has been invented for the nose?
Attar of roses and snuff.
You have not done well, oh, my masters the philanthropists; oh,
my brothers the poets!
And yet how faithfully this limb——
“It is not a limb!” cry the scientists.
I beg your pardon, gentlemen, and retract. This appendage—Ah
yes, I was saying with what touching fidelity this appendage has
done service for you.
The eyes sleep, the mouth closes, the ears are deaf.
The nose is always on duty.
It watches over your repose and contributes to your health. Feet,
hands, all other parts of the body are stupid. The hands are often
caught in foolish acts; the feet stumble, and in their clumsiness allow
the body to fall. And when they do, they get off free, and the poor
nose is punished for their misdeeds.
How often do you not hear it said: “Mr. So-and-So has broken his
nose.”
There have been a great many broken noses since the creation of
the world.
Can any one give a single instance of a nose broken through any
fault of its own?
No; but, nevertheless, the poor nose is always being scolded.
Well, it endures it all with angelic patience. True, it sometimes has
the impertinence to snore. But where and when did you ever hear it
complain?...
But let us forget for a moment the utility of the nose, and regard it
only from the esthetic point of view.
A cedar of Lebanon, it tramples underfoot the hyssop of the
mustache; a central column, it provides a support for the double arch
of the eyebrows. On its capital perches the eagle of thought. It is
enwreathed with smiles. With what boldness did the nose of Ajax
confront the storm when he said, “I will escape in spite of the gods.”
With what courage did the nose of the great Condé—whose
greatness really derived from his nose—with what courage did the
nose of the great Condé enter before all others, before the great
Condé himself, the entrenchments of the Spanish at Lens and
Rocroy, where their conqueror boldly flourished the staff of
command? With what assurance was Dugazon’s nose thrust before
the public, that nose which knew how to wriggle in forty-two different
ways, and each way funnier than the last?
No, I do not believe that the nose should be permitted to remain in
the obscurity into which man’s ingratitude has hitherto forced it.
I suggest as one reason why the nose has submitted to this
injustice the fact that Occidental noses are so small.
But the deuce is to pay if the noses of the West are the only
noses.
There are the Oriental noses, which are very handsome noses.
Do you question the superiority of these noses to your own,
gentlemen of Paris, of Vienna, of St. Petersburg?
In that case, my Viennese friends, go by the Danube; you
Parisians, take the steamer; Petersburgers, the sledge; and say
these simple words:
“To Georgia.”
But I forewarn you of deep humiliation. Should you bring to
Georgia one of the largest noses in Europe, at the gate of Tiflis they
would gaze at you in astonishment and exclaim:
“What a pity that this gentleman has lost his nose on the way.” ...
Ah, sweet Heaven! those beautiful Georgian noses! Robust
noses, magnificent noses!
They are all shapes:
Round, fat, long, large.
There is every color:
White, pink, crimson, violet.
Some are set with rubies, others with pearls. I saw one set with
turquoises.
In Georgia, Vakhtang IV abolished the fathom, the meter, and the
yard, keeping only the nose.
Goods are measured off by the nose.
They say, “I bought seventeen noses of flannel for a dressing-
gown, seven noses of cloth for a pair of breeches, a nose and a half
of satin for a cravat.”
Let us add, finally, that the Georgian ladies find this more
convenient than European measures.

Théophile Gautier, poet, artist and novelist was identified with the
romantic movement in French literature.
A charming art of description was his, as may be seen in the story
of the Lap Dog.

FANFRELUCHE

To write in praise of this marvelous lap-dog, one should pluck a


quill from the wing of Love himself; the hands of the Graces alone
would be light enough to trace his picture; nor would the touch of
Latour be too soft.
His name was Fanfreluche, a pretty name for a dog, and one that
he bore with honor.
Fanfreluche was no larger than his mistress’s hand, and it is well
known that the marquise has the smallest hand in the world; and yet
he seemed larger to the eye, assuming almost the proportions of a
small sheep, for he had silky hair a foot in length, and so fine and
soft and lustrous that the tresses of Minette were a mere mop by
contrast. When he presented his paw, and one pressed it a little, one
was astonished to feel nothing at all. Fanfreluche was rather a ball of
silk, from which two beautiful brown eyes and a little red nose
glittered, than an actual dog. Such a dog could only have belonged
to the mother of Love, who lost him in Cytherea, where the
marquise, on one of her occasional visits, found him. Look for a
moment at this fascinatingly exquisite face. Would not Roxalana
herself have been jealous of that delicately tipped-up nose, divided
in the middle by a little furrow just like Anne of Austria’s?
What vivacity in that quick eye! And that double row of white
teeth, no larger than grains of rice, which, at the least emotion,
sparkled in all their brilliance—what duchess would not envy them?
And this charming Fanfreluche, apart from his physical attractions,
possessed a thousand social graces: he danced the minuet with
exquisite grace, knew how to give his paw and tell the hour, capered
before the queen and great ladies of France, and distinguished his
right paw from his left. And Fanfreluche was learned, and knew more
than the members of the Academy. If he was not a member of that
body it was because he did not desire it, thinking, no doubt, to shine
rather by his absence. The abbé declared that he was as strong as a
Turk in the dead languages, and that, if he did not talk, it was from
pure malice and to vex his mistress.
Then, too, Fanfreluche had not the vivacity of common dogs. He
was very dainty, and very hard to please. He absolutely refused to
eat anything but little pies of calves’ brains made especially for him;
he would drink nothing but cream from a little Japanese saucer. Only
when his mistress dined in town would he consent to nibble at the
wing of a chicken, and to take sweets for dessert; but he did not
grant this favor to every one, and one had to have an excellent cook
to gain it. Fanfreluche had only one little fault. But who is perfect in
this world? He loved cherries in brandy and Spanish snuff, of which
he took a little pinch from time to time. But the latter is a weakness
he shared with the Prince of Condé.
When he heard the cover of the general’s golden snuff-box click, it
was a treat to see him sit up on his little hind legs and brush the
carpet with his silken tail; and, if the marquise was engrossed in the
pleasures of whist, and did not watch him closely, he would jump on
the abbé’s lap, who fed him with brandied cherries. And Fanfreluche,
whose head was not strong, would become as tipsy as a Swiss
guard and two choristers, would perform the queerest little tricks on
the carpet, and become extraordinarily ferocious on the subject of
the calves of the chevalier, who, to preserve what little was left of
them, would draw up his legs on his chair. Then Fanfreluche was no
longer a little dog, but a little lion, and the marquise alone could
manage him. His picture would not be complete without mentioning
the droll little naughtinesses that he was guilty of before being
stowed away into his muff, and put to bed in his niche of rosewood,
padded with white satin and edged with blue silk cord.
Henri Murger, a noted litterateur, wrote on themes both gloomy
and merry. More than most, he ran the gamut from grave to gay,
from lively to severe.
Among his best known works are his Bohemian Life Sketches.
From the subjoined bit, it may be seen that boresome parties obtain
in all times and nations.

AN EVENING RECEPTION

Toward the end of the month of December the messengers of


Bidault’s agency received for distribution about a hundred copies of
a circular of which we certify the following to be a true and genuine
copy:

Messieurs Rodolphe and Marcel request the honor of your


company at a reception, on Christmas Eve, Saturday next. There is
going to be some fun.
P. S. We only live once!
Program
I
7 p.m. The rooms will open: lively and animated conversation.
8 p.m. The ingenious authors of The Mountain in Labor, a comedy
rejected by the Odéon, will take a turn round the rooms.
8.30 p.m. M. Alexandre Schaunard, the distinguished artist, will
execute his Imitative Symphony for the piano, called The Influence of
Blue in Art.
9 p.m. First reading of a memoir on the abolition of the penalty of
tragedy.
9.30 p.m. M. Gustave Colline, hyperphysical philosopher, and M.
Schaunard will commence a debate on comparative philosophy and
metapolitics. In order to prevent any possible collision, the two
disputants will be tied together.
10 p.m. M. Tristan, a literary man, will relate the story of his first
love. M. Alexandre Schaunard will play a pianoforte accompaniment.
10.30 p.m. Second reading of the memoir on the abolition of the
penalty of tragedy.
11 p.m. The Story of a Cassowary Hunt, by a foreign prince.
II
At midnight M. Marcel, historical painter, will make a white chalk
drawing, with his eyes bandaged. Subject: The interview between
Napoleon and Voltaire in the Champs Élysées. At the same time M.
Rodolphe will improvise a parallel between the author of Zaïre and
the author of The Battle of Austerlitz.
12.30 a.m. M. Gustave Colline, in modest undress, will give a
revival of the athletic sports of the Fourth Olympiad.
1 a.m. Third reading of the memoir on the abolition of the penalty
of tragedy, followed by a collection in aid of authors of tragedies
likely to be thrown out of employment.
2 a.m. Sports and quadrilles, which will be kept up till morning.
6 a.m. Rise of the sun upon the scene. Final chorus.
The ventilators will be open during the whole of the reception.

N. B. Any person attempting to read or recite poetry will be


immediately ejected from the rooms and taken into custody; you are
also requested not to take away candle-ends.

Victor Marie Hugo, celebrated poet, novelist and dramatist, was a


recognized leader of the Romantic school of Nineteenth century
France.
Quotation from his works is hard to do in brief, but an amusing
story is given from Tales of a Grandfather.

THE GOOD FLEA AND THE WICKED KING

Once upon a time there was a wicked king, who made his people
very unhappy. Everybody detested him, and those whom he had put
in prison and beheaded would have liked to whip him. But how? He
was the strongest, he was the master, he did not have to give
account to any one, and when he was told his subjects were not
content, he replied:
“Well, what of it? I don’t care a rap!” Which was an ugly answer.
As he continued to act like a king, and as every day he became a
little more wicked than the day before, this set a certain little flea to
thinking over the matter. It was a little bit of a flea, who was of no
consequence at all, but full of good sentiments. This is not the nature
of fleas in general; but this one had been very well brought up; it bit
people with moderation, and only when it was very hungry.
“What if I were to bring the king to reason?” it said to itself. “It is
not without danger. But no matter—I will try.”
That night the wicked king, after having done all sorts of naughty
things during the day, was calmly going to sleep when he felt what
seemed to be the prick of a pin.
“Bite!”
He growled, and turned over on the other side.
“Bite! Bite! Bite!”
“Who is it that bites me so?” cried the king in a terrible voice.
“It is I,” replied a very little voice.
“You? Who are you?”
“A little flea who wishes to correct you.”
“A flea? Just you wait! Just you wait, and you shall see!”
And the king sprang from his bed, twisted his coverings, and
shook the sheets, all of which was quite useless, for the good flea
had hidden itself in the royal beard.
“Ah,” said the king, “it has gone now, and I shall be able to get a
sound sleep.”
But scarcely had he laid his head on the pillow, when—
“Bite!”
“How? What? Again?”
“Bite! Bite!”
“You dare to return, you abominable little flea? Think for a moment
what you are doing! You are no bigger than a grain of sand, and you
dare to bite one of the greatest kings on earth!”
“Well, what of it? I don’t care a rap!” answered the flea in the very
words of the king.
“Ah, if I only had you!”
“Yes, but you haven’t got me!”
The wicked king did not sleep all that night, and he arose the next
morning in a killing ill humor. He resolved to destroy his enemy. By
his orders, they cleaned the palace from top to bottom, and
particularly his bedroom; his bed was made by ten old women very
skilful in the art of catching fleas. But they caught nothing, for the
good flea had hidden itself under the collar of the king’s coat.
That night, this frightful tyrant, who was dying for want of sleep,
lay back on both his ears, though this is said to be very difficult. But
he wished to sleep double, and he knew no better way. I wish you
may find a better. Scarcely had he put out his light, when he felt the
flea on his neck.
“Bite! Bite!”
“Ah, zounds! What is this?”
“It is I—the flea of yesterday.”
“But what do you want, you rascal—you tiny pest?”
“I wish you to obey me, and to make your people happy.”
“Ho, there, my soldiers, my captain of the guard, my ministers, my
generals! Everybody! The whole lot of you!”
The whole lot of them came in. The king was in a rage, which
made everybody tremble. He found fault with all the servants of the
palace. Everybody was in consternation. During this time the flea,
quite calm, kept itself hid in the king’s nightcap.
The guards were doubled; laws and decrees were made;
ordinances were published against all fleas; there were processions
and public prayers to ask of Heaven the extermination of the flea,
and sound sleep for the king. It was all of no avail. The wretched
king could not lie down, even on the grass, without being attacked by
his obstinate enemy, the good flea, who did not let him sleep a single
minute.
“Bite! Bite!”
It would take too long to tell the many hard knocks the king gave
himself in trying to crush the flea; he was covered with bruises and
contusions. As he could not sleep, he wandered about like an
uneasy spirit. He grew thinner. He would certainly have died if, at
last, he had not made up his mind to obey the good flea.
“I surrender,” he said at last, when it began to bite him again. “I
ask for quarter. I will do what you wish.”
“So much the better. On that condition only shall you sleep,”
replied the flea.
“Thank you. What must I do?”
“Make your people happy!”
“I have never learned how. I do not know how——”
“Nothing more easy: you have only to go away.”
“Taking my treasures with me?”
“Without taking anything.”
“But I shall die if I have no money,” said the king.
“Well, what of it? I don’t care!” replied the flea.
But the flea was not hard-hearted, and it let the king fill his
pockets with money before he went away. And the people were able
to be very happy by setting up a republic.

Alphonse Daudet, humorist and story writer, created the character


of Tartarin, a gasconading humbug, and a satire on the typical
character attributed to Southern France.
A bit from Tartarin in the Alps will show the type of humor.

WILLIAM TELL

The party of travelers now came to the Lake of Lucerne, with its
dark waters overshadowed by high and menacing mountains. To
their right they saw that Ruetli meadow where Melchthal, Fuerst, and
Stauffacher had sworn the oath to deliver their country.
Tartarin, deeply moved, took off his cap, and even threw it into the
air three times to render homage to the shades of the departed
heroes. Some of the tourists mistook this for a salutation, and bowed
in return. At last they reached Tell’s Chapel. This chapel is situated
at the edge of the lake, on the very rock upon which, during the
storm, William Tell jumped from Gessler’s boat. And it was a
delicious emotion to Tartarin, while he followed the travelers along
the lake, to tread this historic ground, to recall and revive the various
scenes of this great drama, which he knew as well as his own
biography.
For William Tell had always been his ideal man. When at
Bézuquet’s pharmacy the game of Preferences was being played,
and each one wrote on his slip of paper the name of the poet, the
tree, the odor, the hero, and the woman that he preferred to all
others of their kind, one slip invariably bore this inscription:
“Favorite tree?—The baobab.
“Favorite odor?—Gunpowder.
“Favorite author?—Fenimore Cooper.
“Who would you like to have been?—William Tell.”
And then everybody would exclaim, “That’s Tartarin!”
Imagine, then, how happy he was, and how his heart beat when
he stood before the chapel commemorative of the gratitude of a
whole nation. It seemed to him as if William Tell must come in person
to open the door, still dripping from the waters of the lake, and
holding in his hand his bolts and crossbow.
“Don’t come in here. I’m working. This is not the day on which
tourists are allowed,” sounded a strong voice from the interior,
reechoing against the walls.
“M. Astier-Réhu, of the French Academy!”
“Herr Professor Doctor Schwanthaler!”
“Tartarin of Tarascon!”
The painter, who was standing on a scaffolding within, stretched
out half of his body clad in his working-blouse, and holding his
palette in his hand.
“My pupil will come down and open the door for you, gentlemen,”
he said in a respectful tone.
“I was sure of it; of course,” said Tartarin to himself, “I have only to
mention my name.”
For all that, he had the good taste to fall into line and modestly
enter the chapel behind the others.
The painter, a splendid fellow, with a magnificent golden head of
an artist of the Renaissance, received his visitors on the wooden
staircase which led to the temporary scaffolding from which the
mural paintings were being done. All the frescos, representing
scenes from Tell’s life, were complete, except the one in which the
scene of the apple at Altorf was to be shown. Upon that the painter
was now working....
“I find it all very characteristically done,” said the great Astier-
Réhu.
And Schwanthaler, folding his arms, recited two of Schiller’s
verses, half of which was lost in his beard. Then the ladies delivered
their opinions, and for some minutes one would have thought oneself
in a confectioner’s shop. “Beautiful!” they cried. “Lovely! Exquisite!
Delicious!”
Suddenly came a voice, tearing the silence like a trumpet’s blare:
“Badly shouldered, that blunderbuss, I tell you! He never held it in
that way!”
Imagine the stupefaction of the painter when this tourist, stick in
hand and bundle on his back, undertook to demonstrate to him as
clearly as that two and two are four, that the position of Tell in the
picture was incorrect.
“And I understand these matters, I would have you know!”
“And who are you?”
“Who am I?” said our Tarasconian hero, deeply astonished. And
so it was not at his name that the door had opened. Drawing himself
up, he answered, “Ask the panthers of Zaccar, or the lions of Atlas,
and perhaps they will answer you.”
Every one drew away from Tartarin in fright and consternation.
“But then,” asked the painter, “in what respect is Tell’s position
incorrect?”
“Look at me!”
Falling back with a double step that made the planks creak,
Tartarin, using his cane to represent the “blunderbuss,” threw himself
into position.
“Superb! He is right! Don’t move!” cried the painter. Then to his
pupil:
“Quick, bring me paper and charcoal!”
GERMAN HUMOR
Christian F. Gellert, a German poet of the early Eighteenth
century, was also a lecturer and professor of philosophy.
His literary fame rests upon his sacred songs and his fables. One
of the latter we quote.
THE PATIENT CURED
A man long plagued with aches in joint and limb
Did all his neighbors recommended him,
But, despite that, could nowise gain
Deliverance from his pain.
An ancient dame, to whom he told his case,
Cut an oracular grimace,
And thus announced a magic remedy:
“You must,” said she,
Mysteriously hissing in his ear,
And calling him “My dear,”
“Sit on a good man’s grave at early light,
And with the dew fresh-fallen over night
Thrice bathe your hands, your knee-joints thrice:
’Twill cure you in a trice.
Remember her who gave you this advice.”

The patient did just as the grandam said.


(What will not mortals do to be
Relieved of misery?)
He went right early to the burying-ground,
And on a tombstone—’twas the first he found—
These words, delighted, read:
“Stranger, what man he was who sleeps below,
This monument and epitaph may show.
The wonder of his time was he,
The pattern of most genuine piety;
And that thou all in a few words may’st learn,
Him church and school and town and country mourn.”

Here the poor cripple takes his seat,


And bathes his hands, his joints, his feet;
But all his labor’s worse than vain:
It rather aggravates his pain.

With troubled mind he grasps his staff,


Turns from the good man’s grave, and creeps
On to the next, where lowly sleeps
One honored by no epitaph.
Scarce had he touched the nameless stone,
When lo! each racking pain had flown;
His useless staff forgotten on the ground,
He leaves this holy grave, erect and sound.

“Ah!” he exclaimed, “is there no line to tell


Who was this holy man that makes me well?”
Just then the sexton did appear,
Of him he asked, “Pray, who lies buried here?”
The sexton waited long, and seemed quite shy
Of making any sort of a reply.
“Well,” he began at last with mournful sigh,
“The Lord forgive him, ’twas a man
Placed by all honest circles under ban;
Whom scarcely they allowed a decent grave;
Whose soul naught but a miracle might save;
A heretic, and, what is worse,
Wrote plays and verse!
In short, to speak my full conviction,
And without fear of contradiction,
He was an innovator and a scound—”
“No!” cried the man. “No, I’ll be bound!
Not so, though all the world the lie repeat!
But that chap there, who sleeps hard by us,
Whom you and all the world call pious,
He was, for sure, a scoundrel and a cheat!”

Gotthold Ephraim Lessing was a celebrated German dramatist


and critic. His collected works fill many volumes.
We quote a few of his Fables and Epigrams.

THE RAVEN
The raven remarked that the eagle sat thirty days upon her eggs.
“That, undoubtedly,” said she, “is the reason why the young of the
eagle are so all-seeing and strong. Good! I will do the same.”
And, since then, the raven actually sits thirty days upon her eggs;
but, as yet, she has hatched nothing but miserable ravens.—Fables.

THE DECORATED BOW

A man had an excellent bow of ebony, with which he shot very far
and very sure, and which he valued at a great price. But once, after
considering it attentively, he said:
“A little too rude still! Your only ornament is your polish. It is a pity!
However, that can be remedied,” thought he. “I will go and let a first-
rate artist carve something on the bow.”
He went, and the artist carved an entire hunting-scene upon the
bow. And what more fitting for a bow than a hunting-scene?
The man was delighted. “You deserve this embellishment, my
beloved bow.” So saying, he wished to try it.
He drew the string. The bow broke!—Fables.

EPIGRAMS
From the grave where dead Gripeall, the miser, reposes,
What a villainous odor invades all our noses!
It can’t be his body alone—in the hole
They have certainly buried the usurer’s soul.

While Fell was reposing himself on the hay,


A reptile conceal’d bit his leg as he lay;
But all venom himself, of the wound he made light,
And got well, while the scorpion died of the bite.
So vile your grimace, and so croaking your speech,
One scarcely can tell if you’re laughing or crying;
Were you fix’d on one’s funeral sermon to preach,
The bare apprehension would keep one from dying.

Quoth gallant Fritz, “I ran away


To fight again another day.”
The meaning of his speech is plain,
He only fled to fly again.

“How strange, a deaf wife to prefer!”


“True, but she’s also dumb, good sir.”

Rudolph Erich Raspe was a German author who was also an


Archæologist of note.
His best known work is the celebrated History of Baron
Münchausen.

A HORSE TIED TO A STEEPLE

I set off from Rome on a journey to Russia, in the midst of winter,


from a just notion that frost and snow must of course improve the
roads, which every traveler had described as uncommonly bad
through the northern parts of Germany, Poland, Courland, and
Livonia. I went on horseback, as the most convenient manner of
traveling. I was but lightly clothed, and of this I felt the inconvenience
the more I advanced northeast. What must not a poor old man have
suffered in that severe weather and climate, whom I saw on a bleak
common in Poland, lying on the road, helpless, shivering, and hardly
having wherewithal to cover his nakedness? I pitied the poor soul.
Though I felt the severity of the atmosphere myself, I threw my
mantle over him, and immediately I heard a voice from the heavens,
blessing me for that piece of charity, saying:
“You will be rewarded, my son, for this in time.”
I went on. Night and darkness overtook me. No village was to be
seen. The country was covered with snow, and I was unacquainted
with the road.
Tired out, I alighted, and fastened my horse to something like the
pointed stump of a tree which appeared above the snow. For the
sake of safety I placed my pistols under my arm, and laid down on
the snow, where I slept so soundly that I did not open my eyes till full
daylight. It is not easy to conceive my astonishment at finding myself
in the midst of a village, lying in a churchyard. Nor was my horse to
be seen; but I heard him soon after neigh somewhere above me. On
looking upward, I beheld him hanging by his bridle to the
weathercock of the steeple. Matters were now quite plain to me. The
village had been covered with snow overnight; a sudden change in
the weather had taken place; I had sunk down to the churchyard
while asleep at the same rate as the snow had melted away; and
what in the dark I had taken to be a stump of a little tree appearing
above the snow, to which I had tied my horse, proved to have been
the cross or weathercock of the steeple!
Without long consideration, I took one of my pistols, shot the
bridle in two, brought down the horse, and proceeded on my journey.
—Adventures of Baron Münchausen.

A RATHER LARGE WHALE

I embarked at Portsmouth, in a first-rate English man-of-war of


one hundred guns and fourteen hundred men, for North America.
Nothing worth relating happened till we arrived within three hundred
leagues of the river St. Lawrence, when the ship struck with amazing
force against (as we supposed) a rock. However, upon heaving the
lead, we could find no bottom, even with three hundred fathoms.
What made this circumstance the more wonderful, and indeed
beyond all comprehension, was, that the violence of the shock was
such that we lost our rudder, broke our bowsprit in the middle, and
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like