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

Deep Learning with Python 1st Edition Nikhil Ketkar pdf download

Ebook installation

Uploaded by

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

Deep Learning with Python 1st Edition Nikhil Ketkar pdf download

Ebook installation

Uploaded by

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

Deep Learning with Python 1st Edition Nikhil

Ketkar download

https://ebookmeta.com/product/deep-learning-with-python-1st-
edition-nikhil-ketkar/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

Deep Learning with Python 2nd Edition Nikhil Ketkar

https://ebookmeta.com/product/deep-learning-with-python-2nd-
edition-nikhil-ketkar/

Fundamentals of Deep Learning Nikhil Buduma

https://ebookmeta.com/product/fundamentals-of-deep-learning-
nikhil-buduma/

Applied Deep Learning with TensorFlow 2: Learn to


Implement Advanced Deep Learning Techniques with
Python, 2nd Edition Umberto Michelucci

https://ebookmeta.com/product/applied-deep-learning-with-
tensorflow-2-learn-to-implement-advanced-deep-learning-
techniques-with-python-2nd-edition-umberto-michelucci-2/

Oxford Textbook of Palliative Care for Children 3rd


Edition Richard Hain

https://ebookmeta.com/product/oxford-textbook-of-palliative-care-
for-children-3rd-edition-richard-hain/
Business Law 11th Edition Andy Gibson

https://ebookmeta.com/product/business-law-11th-edition-andy-
gibson/

Algorithmic Game Theory 15th International Symposium


SAGT 2022 Colchester UK September 12 15 2022
Proceedings Panagiotis Kanellopoulos

https://ebookmeta.com/product/algorithmic-game-theory-15th-
international-symposium-sagt-2022-colchester-uk-
september-12-15-2022-proceedings-panagiotis-kanellopoulos/

Savage Caress Savage Shifters Book 4 1st Edition Milly


Taiden Taiden Milly

https://ebookmeta.com/product/savage-caress-savage-shifters-
book-4-1st-edition-milly-taiden-taiden-milly/

The Indigenization of Christianity in China II 1st


Edition Qi Duan

https://ebookmeta.com/product/the-indigenization-of-christianity-
in-china-ii-1st-edition-qi-duan/

Essential Partial Differential Equations Analytical and


Computational Aspects Instructor Solution Manual
Solutions 1st Edition David F F Griffiths David J
Silvester John W Dold
https://ebookmeta.com/product/essential-partial-differential-
equations-analytical-and-computational-aspects-instructor-
solution-manual-solutions-1st-edition-david-f-f-griffiths-david-
The Balanced Scorecard as Strategic Controlling
Instrument Introducing the Indicators based BSC for
Implementation of a Corporate Strategy from Four
Different Perspectives 1st Edition Christoper Dewangga
Pramudita
https://ebookmeta.com/product/the-balanced-scorecard-as-
strategic-controlling-instrument-introducing-the-indicators-
based-bsc-for-implementation-of-a-corporate-strategy-from-four-
different-perspectives-1st-edition-christoper-dewan/
Nikhil Ketkar and Jojo Moolayil

Deep Learning with Python


Learn Best Practices of Deep Learning Models
with PyTorch
2nd ed.
Nikhil Ketkar
Bangalore, Karnataka, India

Jojo Moolayil
Vancouver, BC, Canada

Any source code or other supplementary material referenced by the


author in this book is available to readers on GitHub via the book’s
product page, located at www.​apress.​com/​978-1-4842-5363-2. For
more detailed information, please visit http://​www.​apress.​com/​
source-code.

ISBN 978-1-4842-5363-2 e-ISBN 978-1-4842-5364-9


https://doi.org/10.1007/978-1-4842-5364-9

© Nikhil Ketkar, Jojo Moolayil 2021

Apress Standard

Trademarked names, logos, and images may appear in this book. Rather
than use a trademark symbol with every occurrence of a trademarked
name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark. The use in this publication
of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of
opinion as to whether or not they are subject to proprietary rights.

The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, express or implied, with respect to the material
contained herein or for any errors or omissions that may have been
made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.

Distributed to the book trade worldwide by Springer Science+Business


Media New York, 233 Spring Street, 6th Floor, New York, NY 10013.
Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-
ny@springer-sbm.com, or visit www.springeronline.com. Apress Media,
LLC is a California LLC and the sole member (owner) is Springer
Science + Business Media Finance Inc (SSBM Finance Inc). SSBM
Finance Inc is a Delaware corporation.
Introduction
This book has been drafted with a unique approach. The second edition
focuses on the practicality of the topics within deep learning that help
the reader to embrace modern tools with the right mathematical
foundations. The first edition focused on introducing a meaningful
foundation for the subject, while limiting the depth of the practical
implementations. While we explored a breadth of technical frameworks
for deep learning (Theano, TensorFlow, Keras, and PyTorch), we limited
the depth of the implementation details. The idea was to distill the
mathematical foundations while focusing briefly on the practical tools
used for implementation.
A lot has changed over the past three years. The deep learning
fraternity is now stronger than ever, and the frameworks have evolved
in size and adoption. Theano is now deprecated (ceased development);
TensorFlow saw huge adoption in the industry and academia; and
Keras became more popular among beginners and deep learning
enthusiasts. However, PyTorch has emerged recently as a widely
popular choice for academia as well as industry. The growing number
of research publications that recently have used PyTorch over
TensorFlow is a testament to its growth within deep learning.
On the same note, we felt the need to revise the book with a focus
on engaging readers with hands-on exercises to aid a more meaningful
understanding of the subject. In this book, we have struck the perfect
balance, with mathematical foundations as well as hands-on exercises,
to embrace practical implementation exclusively on PyTorch. Each
exercise is supplemented with the required explanations of PyTorch’s
functionalities and required abstractions for programming
complexities.
Part I serves as a brief introduction to machine learning, deep
learning, and PyTorch. We explore the evolution of the field, from early
rule-based systems to the present-day sophisticated algorithms, in an
accelerated fashion.
Part II explores the essential deep learning building blocks. Chapter
3 introduces a simple feed-forward neural network. Incrementally and
logically, we uncover the various building blocks that constitute a
neural network and which can be reused in building any other network.
Though foundational, Chapter 3 focuses on building a baby neural
network with the required framework that helps to construct and train
networks of all kinds and complexities. In Chapter 4, we explore the
core idea that enabled the possibility of training large networks
through backpropagation using automatic differentiation and chain
rule. We explore PyTorch’s Autograd module with a small example to
understand how the solution works programmatically. In Chapter 5, we
look at orchestrating all the building blocks discussed through so far,
along with the performance metrics of deep learning models and the
artifacts required to enable an improved means for training—i.e.,
regularization, hyperparameter tuning, overfitting, underfitting, and
model capacity. Finally, we leverage all this content to develop a deep
neural network for a real-life dataset using PyTorch. In this exercise, we
also explore additional PyTorch constructs that help in the
orchestration of various deep learning building blocks.
Part III covers three important topics within deep learning. Chapter
6 explores convolutional neural networks and introduces the field of
computer vision. We explore the core topics within convolutional
neural networks, including how they learn and how they are
distinguished from other networks. We also leverage a few hands-on
exercises—using a small MNIST dataset as well as the popular Cats and
Dogs dataset—to study the practical implementation of a convolutional
neural network. In Chapter 7, we study recurrent neural networks and
enter the field of natural language processing. Similar to Chapter 6, we
incrementally build an intuition around the fundamentals and later
explore practical exercises with real-life datasets. Chapter 8 concludes
the book by looking at some of the recent trends within deep learning.
This chapter is only a cursory introduction and does not include any
implementation details. The objective is to highlight some advances in
the research and the possible next steps for advanced topics.
Overall, we have put in great efforts to write a structured, concise,
exercise-rich book that balances the coverage between the
mathematical foundations and the practical implementation.
Acknowledgments
I would like to thank my colleagues at Flipkart and Indix, and the
technical reviewers, for their feedback and comments. I will also like to
thank Charu Mudholkar for proofreading the book in its final stages.

—Nikhil Ketkar

I would like to thank my beloved wife, Divya, for her constant


support.

—Jojo Moolayil
Table of Contents
Chapter 1:​Introduction to Machine Learning and Deep Learning
Defining Deep Learning
A Brief History
Advances in Related Fields
Prerequisites
The Approach Ahead
Installing the Required Libraries
The Concept of Machine Learning
Binary Classification
Regression
Generalization
Regularization
Summary
Chapter 2:​Introduction to PyTorch
Why Do We Need a Deep Learning Framework?​
What Is PyTorch?​
Why PyTorch?​
It All Starts with a Tensor
Creating Tensors
Tensor Munging Operations
Mathematical Operations
Element-Wise Mathematical Operations
Trigonometric Operations in Tensors
Comparison Operations for Tensors
Linear Algebraic Operations
Summary
Chapter 3:​Feed-Forward Neural Networks
What Is a Neural Network?​
Unit
The Overall Structure of a Neural Network
Expressing a Neural Network in Vector Form
Evaluating the Output of a Neural Network
Training a Neural Network
Deriving Cost Functions Using Maximum Likelihood
Binary Cross-Entropy
Cross-Entropy
Squared Error
Summary of Loss Functions
Types of Activation Functions
Linear Unit
Sigmoid Activation
Softmax Activation
Rectified Linear Unit
Hyperbolic Tangent
Backpropagation
Gradient Descent Variants
Gradient-Based Optimization Techniques
Practical Implementation with PyTorch
Summary
Chapter 4:​Automatic Differentiation in Deep Learning
Numerical Differentiation
Symbolic Differentiation
Automatic Differentiation Fundamentals
Implementing Automatic Differentiation
Summary
Chapter 5:​Training Deep Leaning Models
Performance Metrics
Classification Metrics
Regression Metrics
Data Procurement
Splitting Data for Training, Validation, and Testing
Establishing the Achievable Limit on the Error Rate
Establishing the Baseline with Standard Choices
Building an Automated, End-to-End Pipeline
Orchestration for Visibility
Analysis of Overfitting and Underfitting
Hyperparameter Tuning
Model Capacity
Regularizing the Model
Early Stopping
Norm Penalties
Dropout
A Practical Implementation in PyTorch
Interpreting the Business Outcomes for Deep Learning
Summary
Chapter 6:​Convolutional Neural Networks
Convolution Operation
Pooling Operation
Convolution-Detector-Pooling Building Block
Stride
Padding
Batch Normalization
Filter
Filter Depth
Number of Filters
Summarizing key learnings from CNNs
Implementing a basic CNN using PyTorch
Implementing a larger CNN in PyTorch
CNN Thumb Rules
Summary
Chapter 7:​Recurrent Neural Networks
Introduction to RNNs
Training RNNs
Bidirectional RNNs
Vanishing and Exploding Gradients
Gradient Clipping
Long Short-Term Memory
Practical Implementation
Summary
Chapter 8:​Recent Advances in Deep Learning
Going Beyond Classification in Computer Vision
Object Detection
Image Segmentation
Pose Estimation
Generative Computer Vision
Natural Language Processing with Deep Learning
Transformer Models
Bidirectional Encoder Representations from Transformers
GrokNet
Additional Noteworthy Research
Concluding Thoughts
Index
About the Authors
Nikhil Ketkar
currently leads the Machine Learning
Platform team at Flipkart, India’s largest
ecommerce company. He received his
PhD from Washington State University.
Following that, he conducted
postdoctoral research at University of
North Carolina at Charlotte, which was
followed by a brief stint in high-
frequency trading at TransMarket in
Chicago. More recently, he led the data
mining team at Guavus, a startup doing
big data analytics in the telecom domain,
and Indix, a startup doing data science in the ecommerce domain. His
research interests include machine learning and graph theory.

Jojo Moolayil
is an artificial intelligence professional
and published author of three books on
machine learning, deep learning, and IoT.
He is currently working with Amazon
Web Services as a Research Scientist –
A.I. in their Vancouver, BC office.
In his current role with AWS, Jojo
works on researching and developing
large-scale A.I. solutions for combating
fraud and enriching the customer’s
payment experience in the cloud. He is
also actively involved as a technical
reviewer and AI consultant with leading
publishers and has reviewed over a
dozen books on machine learning, deep
learning, and business analytics.
You can reach Jojo at:
https://www.jojomoolayil.com/
https://www.linkedin.com/in/jojo62000
https://twitter.com/jojo62000
About the Technical Reviewers
Judy T. Raj
is a Google Certified Professional Cloud
Architect. She has great experience with
the three leading cloud platforms—
Amazon Web Services, Azure, and Google
Cloud Platform—and has co-authored a
book on Google Cloud Platform with
Packt Publications. She has also worked
with a wide range of technologies in
machine learning, data science,
blockchains, IoT, robotics, and mobile
and web app development. She is
currently a technical content engineer in
Loonycorn. Judy holds a degree in
computer science and engineering from Cochin University of Science
and Technology. A driven engineer fascinated with technology, she is a
passionate coder, a machine language enthusiast, and a blockchain
aficionado.

Manohar Swamynathan
is a data science practitioner and an avid
programmer, with more than 14 years of
experience in various data science-
related areas, including data
warehousing, business intelligence (BI),
analytical tool development, ad-hoc
analysis, predictive modeling, data
science product development,
consulting, formulating strategy, and
executing analytics programs. His career
has covered the life cycle of data across
multiple domains, such as US mortgage
banking, retail/ecommerce, insurance,
Exploring the Variety of Random
Documents with Different Content
CHAPTER XVI.
WATER ALWAYS TRYING TO BE LEVEL.

If you look at water in a bowl, you see that its surface is smooth
and level. If now you stir it about, you make it uneven. Watch it as it
becomes still and smooth again. There seems to be a kind of
struggle as all the particles of water take their places.
But you will ask me what I mean by the particles of water. We
suppose that water is made up of exceedingly fine balls. These balls
or particles are so round and smooth that they move among each
other very easily. This is the reason that water runs so readily, and
so soon becomes level when nothing is disturbing it. If the particles
were not so smooth, they would rub each other. They would not roll
over each other so freely as they do.
To make this plain, we will compare water to
small shot. If you put these into a bowl, they will The particles of
water compared
not lie level, as water does. Now what is the reason to shot.
that these round balls of lead do not act as the
smaller round balls of the water do? It is because
they are not as smooth. They can not roll over each other easily, for
they rub together. They can not in any way be made as smooth as
the particles of water are.
If you pour the shot from one bowl into another, they will run
somewhat as the water does; but they will not slip along as easily,
for they rub each other as they go, while there is almost no rubbing
among the particles of water.
The balls or particles of water are exceedingly
small. They are so small that no one has ever seen The particles of
water round and
them. How, then, you will ask, do we know that smooth.
they are round and smooth? We say that they are,
because we can not see how they could move
about among each other so easily if they were rough, or had corners
or points on them. You can not roll about blocks or nails as you can
roll shot; and the smoother the shot the more easily they will roll. So
then we know, from what we see in other things, that the particles
of water that roll so easily must be round, and must be smooth also.
If the particles of water were large enough for us to see them,
they would look to us, on the surface of still water, as a level layer of
little shot or round beads, and we should see them rolling about
among each other whenever there is the least motion of the water;
but, as we can not see the particles, the surface of the water looks
like smooth glass when they are all still.
As water moves so easily, it is almost always in motion. It is
moved by the wind, and is raised by it sometimes into very high
waves. It runs in the brooks and rivers.
In all its motions the water is always trying to be
level; and this is the only reason that water ever Why water runs.
runs. Water that is level will not run; it will be still.
But, when you disturb this level, it will run till it finds its level again.
I will make this plain to you. Suppose that you have a trough
stopped at both ends. Put some water in it as it lies on level ground.
The water is level in it, and is quiet. Now raise up one end of the
trough a little. The water is at once in motion. Why? Because you
have disturbed the level. The water runs from the end that you raise
toward the other end. Now hold the trough still a little time with the
end raised, and as soon as the water gets its level again, it will be as
still as it was before.
Suppose the trough is open at both ends, and
water is running in all the time at the raised end. It Brooks and rivers.
will keep running toward the lower end. It will be
all the time trying to get on a level, but never can. You see here the
reason that water runs in a brook or river. You can think of a brook
or a river as a trough with one end a little raised; and the water in it
is always, as we may say, running after a level, but never finds it.
The sea is to a river as a tub would be to the trough that pours its
water into it.
There is often great power in the water of a
running stream. It works a great deal of machinery The power of
running water.
in mills of various kinds; and, if the stream be
swollen with heavy rains, the water carries away
bridges, houses, etc. It does all this in trying to get on a level. If it
all could be made level in some way, as you see it in a bowl or a
pond, it would do no such violence.
Sometimes men build a dam across a river. This
is for the purpose of turning the water off one side Dams.
into a canal. The dam stops some of the water
running in the river, sometimes all of it. In doing this the water is
made about level just above the dam, and so is much more quiet
than it is any where else in the river.
Children often build mud dams, and the water that they stop is
very still because it is level. When the dams give way, how briskly
the water runs to try to get on a level again.
Water is always on the same level in the spout of
a coffee-pot that it is in the pot itself, as Pouring from a
coffee-pot.
represented in the first of these figures. If the
coffee-pot be turned up, as seen in the second
figure, the level is still preserved. If it be turned up a little more, the
liquid in the spout, in trying to be on a level with that in the pot,
runs out, as represented in the third figure.

A man once thought that he had discovered a way of keeping up


perpetual motion. He thought that he could make a vessel of such a
shape that some water in it would never stop moving. The vessel
was to be of the shape that you see here. His idea was, that there
was so much more water in the
vessel than there was in the spout, A supposed
discovery of
that it would press the water in the perpetual motion.
spout up its whole length, and
make it run into the vessel. You
can see that, if it would operate in this way, the water would be
always in motion—it would be going the rounds by way of the spout
all the time. But the difficulty is that it would not operate in this way.
After the man made his vessel, he found that the water was only as
high in the spout as in the vessel, as you see in the figure. It is just
as it is with the spout of the coffee-pot.

In the same way, if an aqueduct pipe extend Water can rise in


from a spring, the water will not rise any higher in the pipes of an
the pipe than it is in the spring. The pipe is to the aqueduct as high
spring what the spout is to a coffee-pot. And it as it is in the
fountain.
makes no difference how long the spout is. The
water will stand at the same height in a pipe that
extends for miles that it does in one that goes but a little way from
the reservoir or fountain. This can be illustrated in a vessel with two
pipes, as seen here. The water stands in the branch pipe that is
farthest from the vessel at the same height that it does in the near
one. Sometimes an aqueduct will supply the lower stories of a
building with water, but not the upper stories. The reason is that the
upper stories are higher than the level of the water in the fountain
from which the water comes.
You have often seen a fountain playing. How beautifully the
stream rises and spreads out, dropping in a shower all around! Now
why is it that the water rises? It is because the spring from which
the water comes is so much higher than the pipe of the fountain.
The water in the pipe
tries, as we may say, to The playing of a
fountain
get on a level with the explained.
water in the spring. This
I will make plain to you
by two figures. In the first figure you see
represented a vessel of water, with a pipe
extending from its lower part up at its
side. The water stands at the same level
in the pipe that it does in the vessel, as in
the case of the coffee-pot. Now suppose,
as represented in the second figure, the
pipe is quite short. If the vessel be filled with water, the water in the
pipe, seeking to get to the same level as that in the vessel, will be
thrown up in a stream, as you see. The reason that the stream
spreads out and drops in a shower is, that the air resists the stream,
and so divides it up, because water is so easily separated into parts.
Questions.—What is said about water in a bowl? What is
said about the particles of water? Give the comparison
about shot. Why will not shot run as easily as water from
one vessel into another? What is said about the smallness
of the particles of water? How do we know that they are
round or smooth? If we could see the particles, how
would water look to us? What is said about water’s being
in motion? What makes it run? Tell about water in a
trough. Give the comparison about a trough and a river.
What is said about the power of running water? What is
said about dams? Tell about the level of water in a coffee-
pot. Tell about the man’s contrivance for perpetual motion.
What is said about the pipes of an aqueduct? Why will
water sometimes come only to the lower story of a
building, and not to the upper? Tell about the playing of
water from a fountain. Why does the water come down in
a shower of drops?
CHAPTER XVII.
THE PRESSURE OF WATER.

Any thing that is solid presses only one way,


directly down; but water or any fluid presses all The pressure of
the particles of
ways. It presses just as much sidewise, or even water upon each
upward, as it does down. The reason is, that the other.
particles of water move about among each other,
and are not fastened tight together as they are in a solid. When
water freezes, its particles become all fastened together, and then
the pressure is all downward.
To see how this pressure of the particles of water
operates, look at some shot lying together. One shot does
not lie right upon another shot below it in this way, a, but
they lie in this way, b. You see that each shot presses
down between those that are underneath it. Each shot is
trying, as we may say, to get down between its neighbors
below; and if there was nothing to prevent it, it would press them
apart.
You can see that this is so by trying a little
experiment. Put some shot close together on a The pile of balls.
very smooth surface. Now put another shot on top
of them, and you will see that it will press them all apart. If the shot
should be rough, and the surface on which you lay them should be
rough also, your experiment will not succeed, because the shot will
not roll easily. It is for this reason that cannon balls, as you see them
piled up in an ordnance-yard, as represented in the annexed figure,
do not roll away. If they were smooth, and the place which they
were piled on were smooth, they would all be pressed apart, and the
pile would thus be spoiled.
Now see what this sidewise pressure will do in a vessel filled with
shot if there should be an opening made in the side. The shot close
by the opening will run
out, because they are
pressed sidewise by
the shot lying right
above them; and as
they go out, those that
press them out will be
pressed out in their
turn by those above
them, and so on.
Jus
t so it Particles of water
compared with
is with the little fine balls or particles of water. They shot.
lie on each other in the same way that shot do.
Each particle is pressing always to get down
between the particles that are underneath it, as I have showed you
it is with the shot. And if you make an opening in the vessel that
holds the water, its particles will run, or rather roll out, like the shot,
only a great deal easier, because they are so smooth. They are
pushed out by this pressing down of each particle between those
that are below it.
If you make an opening near the top of a vessel
filled with water, it does not run out with much About water
running from
force; but if the opening be made near the bottom, openings in
it spouts out as if it was in a great hurry to get out different parts of
of the vessel. What is the reason of this difference? a vessel.
To understand this, observe that all the particles
are pushing downward in the way that I have shown. Those
particles, therefore, that are near the bottom, have a great deal
more pressure on them than those that are near the top; so that
when the opening is made near the bottom, the particles there are
pushed out with great force. There is a large crowd of particles
pushing down to get out at that opening. And observe, as the water
in the vessel lessens, the force of the stream from the opening
lessens; it does not leap out so straight as it did at first. It is very
much as it is with a crowd pressing through a door. When the crowd
is very great, those that are pushed through the door are pushed
with great force; but as the crowd lessens, the pressure lessens.
It is found that water runs out of a vessel from an opening in the
side close to the bottom just as quickly as it does from an opening of
the same size in the bottom itself. What is the reason of this? It is
because the little round particles of water roll so easily. They roll out
just as easily as they drop out.
See the difference between pressing on a fluid and on a solid. If
you press on a block of ice, you press it all one way. If you press it
down, you press it all down. If you press it sidewise, it all moves
sidewise. And it makes no difference whether your hand, or
whatever you push with, covers the whole side of the block or not.
But it is not so with water. If you press your hand down into a vessel
of water, you press down some of the water, but not all of it. Some
of it is pressed up; for, as you press down what is right under your
hand, this pushes what is below it off each way to the side, and this
pushes up the water that is over it. This is because the round,
smooth particles roll so easily on each other. When pressure is made
upon them, they roll away from it just where they can—downward,
or sidewise, or upward.
There is one way in which you can make all of a
body of water go straight along. It must be in a Water moving in a
tube.
tube, so that it can not escape sidewise, and then
there must be something to fit this tube which will
push along the water. It must fit exactly, or some of the little
particles will slip back by it.
In this way you can push the round body of water in the tube
straight along, just as you push a round stick or a long icicle. But
suppose that there is a little hole in the tube. This would make no
difference if the water were ice, because the particles of a solid are
so tightly fastened together; but the pressed liquid, you know, will
spout out of the hole, because the particles, not being well fastened
together, will escape from the pressure wherever they can. Open a
door any where, and out they will leap.
You see the difference between a liquid and a
solid in the operation of a squirt-gun, and of one of Squirt-guns and
stick-guns.
the stick-guns so common among children. So long
as the water is in the squirt-gun, it is all pushed
along together, as the stick is in the stick-gun. But The gas and the
as soon as it gets out, it becomes all divided up by ball.
the air, just as you saw in the last chapter the
water from a fountain does. But the stick, as it flies out of the gun,
keeps whole, because its particles are well fastened together. If the
water were changed into ice, it would fly out whole as the stick
does, for its particles would be so fastened together that the air
could not separate them as it does the particles of water.
The difference is still greater between solids and
gases. You see this in the firing of a gun or a Attraction in
solids, and fluids,
cannon. The gas into which the powder changes and gases.
keeps together while it is in the gun, just as the
water does in the squirt-gun; but as soon as it gets
out, it spreads like the water when it gets out of the squirt-gun, only
a great deal more. This is because the particles of the gas are
disposed to separate instead of keeping together. They have no
attraction for each other; but the ball which the gas drives out of the
gun leaves the gas behind it, and goes on whole, because its
particles are so well fastened together by attraction.
You see, then, that in a solid there is considerable attraction
between the particles; in a fluid there is much less; and in a gas
there is none at all.
Questions.—How does the pressure of a fluid differ from
that of a solid? Give the comparison about shot. Relate
the experiment with shot. Tell about the pile of cannon
balls. Give the comparison about shot and water running
for an opening in a vessel. Why does water run faster
from an opening near the bottom of a vessel than from an
opening near the top? Why does it run more slowly as the
water in the vessel lessens? Give the comparison about a
crowd going through a door. Why does water run out from
an opening in the side of a vessel close to the bottom as
fast as from a hole in the bottom itself? What is the
difference between pressing on a solid and pressing on a
fluid? How can you make a fluid all go one way in pressing
it? What will happen if there be a hole in the tube? Tell
about the squirt-gun and the stick-gun. Tell about the ball
and the gas in a common gun. Tell about attraction in
solids, and fluids, and gases.
CHAPTER XVIII.
ATTRACTION IN SOLIDS AND FLUIDS.

You saw by what I told you in the latter part of the last chapter
that the great difference between a solid and a fluid is that the
particles of a solid are fastened tightly together, while those of a
fluid are not. If you should tie some people tightly together so that
they could not move away from each other at all, they would be like
the particles of a solid. If you moved them, you would move them all
together as you do a stick of wood, a lump of ice, or any thing else
that is solid. You can not move them, one one way, and another
another way, as you can the particles of water; but if they are all
pretty close together, and yet can move about among each other, as
you often see in a crowded company, they are like the particles of a
fluid. You can make your way among them just as you do among the
particles of water when you wade.
But you will ask, Are the particles of a solid really
tied together in any way? No; but there is Attraction of the
particles of solids
something that does the same thing to them as illustrated.
tying together would. It makes them stick together
very tight. We know not what it is, but we call it
attraction. We say that the particles of a solid attract each other very
much. This is really just what a child would mean by saying that
they stick together very close or very tight. Why they thus attract
each other, or how they do it, no one has ever yet found out.
It seems to be necessary that the particles
should be very near together to attract each other Experiment with
India-rubber and
as hard as they do in a solid. If a solid is divided in with bullets.
any way, you know that you can not make the two
parts stick close together again. The reason is that
you can not bring the particles near enough to each other to hold
together. This is commonly so, but not always. If you divide a piece
of India-rubber, making a smooth cut with a very sharp knife, you
can press the two parts together so as to make them adhere. Boys
often try the following experiment: A piece is cut off from two
bullets, and each cut place is scraped as smooth as it can be. The
two bullets are then pressed together at these smooth surfaces, and
they adhere so well that it takes considerable pulling to get them
apart. Here enough of the particles on the surfaces are brought near
enough together to hold on to each other, or to attract each other,
as it is commonly expressed.
The particles of solids, then, attract each other
very much, and it is this attraction that makes Drops of water.
them solid. But how is it with the particles of
liquids? Do they not attract each other? See that drop of water on a
window. Why is it in the shape of a drop? If the particles of water
did not attract each other they would be spread out on the glass.
They would not be in the shape of a drop. They do not attract each
other very much, but enough to keep them together in that shape.
But you can spoil that drop very easily. Put your finger on it, and it
is gone. It is all spread out now, partly on your finger and partly on
the glass. Why is this? It is because the particles attract each other
so little that they are easily separated.
Put your finger on a shot, and it remains shot
still. Why is it not gone like the round drop of Drops of water
and shot
water? Because its particles attract each other so compared.
much that they are not easily separated. A mere
touch will separate the particles of the drop of
water, and make them roll about any way; but you can not do this to
the shot without heating it very hot. You can melt it, and then it will
be, like the water, a liquid. Its particles now attract each other but
little, just as the particles of water do. And then, again, you can
freeze the water, and its particles attract each other like the particles
of the solid shot.
In some fluids the particles attract each other more strongly than
they do in others. And the more they attract each other, the better
they keep their drop shape. Pour a very little
quicksilver on a flat surface. See the round drops of Quicksilver.
it roll about! How well they keep their shape! If you
touch them you do not spoil them, as you do a drop of water when
you touch it. If you break one as you touch it, its parts make only so
many little drops or balls. Why is this? It is because the particles of
the quicksilver attract each other so much more than the particles of
water do. They are so attractive to each other that they are disposed
to keep together in little companies.
You sometimes see drops of water on the leaves
of plants more round and separate than you see Drops on leaves.
them on window-panes. They roll about like the
little balls of quicksilver. See the reason of this. The particles of the
drop like each other, as we may say, better than they do the leaf.
They are more ready to stick together than they are to stick to the
leaf, and so they roll about on it like little balls. As you see the drops
on the glass, they are not round, because the particles on one side
stick to the glass—that is, they are attracted by it; but the leaf does
not attract the particles so much as the glass does, for it lets them
keep together in a round form. There is a difference between
different leaves about this. On some, the drops of water act as they
do on the window-pane, and on others they do as I have just told
you; and then, on the same leaves, the drops act differently at
different times.
If you pour a little oil on water, you see the oil
floating in drops. This is for the same reason that Oil on water.
water stands in round drops on some leaves. The
water has no attraction for the oil, and so the particles of the oil hold
together in little companies on the surface of the water. It is
different when oil is spilled upon cloth or wood. It has so much
attraction for them that it mingles up with their fibres, instead of
forming into round companies as it does on the water.
Whenever there is a little of any liquid by itself, it
tends to take a round shape, as seen in the How shot are
quicksilver, and in the drops of water on windows made.
and leaves. We see a pretty example of this in the
manufacture of shot. Perhaps you have seen a shot
How shot are
tower. It is very high. All the shot that are made round.
drop from the top to the bottom. At the top they
have the melted lead. They pour it into a sort of
cullender—that is, a vessel with holes in it. These holes are quite
small. From each one of these holes come out, one after another,
drops of the melted lead. Each drop is round. It cools as it goes
down all this long distance in the air, and by the time that it gets to
the bottom of the tower, it is cold and solid. The shot all fall into a
tub of water, so that they may keep their round shape.
Now why is it that the shot are round? Simply because when they
begin to fall they are melted lead—that is, a fluid. Their particles are
disposed, therefore, to hold together in a round form, like the
particles of quicksilver, or of a drop of water.
Bullets are made by pouring the melted lead into
moulds. Think, now, why they can not be made in Bullets.
the same way that shot are. The reason is that
there are more particles in a bullet than can hold together in a round
shape while the lead is fluid. You can not have very large drops of
any fluid. The particles will hold together only in small companies.
There is one thing that you can do with soap-
bubbles which perhaps you have never thought of. Making soap-
bubbles roll.
You can make them roll on a table or on the floor
by blowing them along. The reason is that the
particles of soap and water mixed together hold on to each other, or
attract each other, better than the particles of water alone.
Questions.—What is the great difference between a
solid and a fluid? Give the comparison about a crowd. Do
we know what it is that fastens the particles of a solid
together? What is it called? What is said about the
particles being near together? Tell about the experiment
with the India-rubber and the lead. How do liquids differ
from solids in attraction? Why is water on a pane of glass
often in drops? Why is it that you can spoil a drop by a
touch? Tell how a shot differs from a drop of water. Is the
attraction between the particles alike in all fluids? Tell
about the quicksilver. Tell about the drops of water on
leaves. Tell about oil dropped upon water. How is it with
oil spilled upon cloth or wood? Describe shot-making. Why
are the shot round? How are bullets made? Why can not
they be made in the same way that shot are? What is said
about soap-bubbles?
CHAPTER XIX.
WATER IN THE AIR.

I have told you how water is in motion whenever it can be. It runs
whenever it can get a chance to do it; but it is in motion in another
way, which I will now tell you about.
You hang out a wet cloth to dry. When it is dry,
what has become of the water that was in it? It From what water
goes up into the
has gone somewhere. Where has it gone? It has air.
flown, like the birds, into the air; but it has gone so
quietly that nobody has seen it go. The little fine
particles of the water that I have told you about have mixed up with
the air, and are blown about with it every where. And so, when you
write, as the ink dries on the paper, the water in it flies off into the
air, leaving the dark part of the ink behind.
There is a great deal of water that is going up into the air in this
way all the time. It goes up from every thing that is wet. After a
shower, the ground, the stones, the houses, the trees, and plants
are all very wet, but in a little time they are dry again. Most of the
water on them has gone up in the air, and is mingled up with it. It
has mingled with it in such a way that you can not see it. The air is
generally as clear with all this water in it as it is when it is perfectly
dry. Even in a bright, clear day, there is a great deal of water mixed
up with the air.
But water goes up into the air not merely from things that appear
wet. You remember that, in Part First, I told you that water is all the
time going out from the pores of the leaves. A great deal of water is
furnished to the air in this way.
Then there is water going up from the skins of animals. Much
water goes from your skin into the air constantly, even when you
can not see that you are perspiring. You can prove this by putting
your arm into a glass jar, and holding it there some
time. The inside of the jar will become covered Experiment with
the arm and a
with the water that comes from the pores of the glass jar.
skin on your arm. This is like the experiment with
leaves noticed on page 77 of Part First.
There is water, too, coming out from the lungs of
animals and mixing with the air. It comes from Water in the
breath.
their lungs just as it does from the leaves, which
you know are the lungs of plants. You can see this
if you breathe upon a cold window. The moisture or water that is
breathed out with the air from the lungs gathers upon the glass. In
the morning you often see the panes of the windows in your
chamber very wet. All this water has come from your lungs as you
have slept. In a very cold day the water in your breath freezes upon
whatever is about your mouth. You see the water of the breath of a
horse frozen on the hairs about his mouth.
So you see water is going up into the air all the time from the
ground, the leaves, the animals, and indeed from every thing that is
at all moist. It goes up also in great quantities from seas, rivers,
lakes, etc. Water, then, is always moving. It runs and it flies. It flies
up into the air, and comes down again in the rain to run in the
streams. It is ever going its rounds, going up and coming down, and
none of it ever stays long in one place. The only way in which it can
be made to keep still is to shut it up. Let it be free, and it will soon
be gone, either by running or flying.
Commonly the water in the air is not seen, as I
have before told you; but sometimes you can see Water in the air
seen in fog.
it. You see it in the breath in a very cold day. The
cold air makes it look like smoke coming out of the
mouth. You see it, too, in the fog. When there is a fog there is a
great deal of water in the air. The reason that you can see it is that
the particles of water are not as finely divided up as when the air is
clear. They are in little companies, as we may say, but there are not
enough of them together to make drops. If they were in companies
large enough to make drops, they would fall to the ground—that is,
we should have a rain.
Sometimes the fog is every where; sometimes it
hangs only just over the water. If you are on a very A beautiful scene.
high hill, where you can look off and see a river in
the distance, you can sometimes see in the morning a line of fog
stretching along where the river is, while it is nowhere else. I once
saw a very singular and beautiful scene made by the fog. I had been
out on horseback in the night to visit a sick person. As I returned,
just before sunrise, I saw from a very high hill a thick fog over all
the river below. From the river arose high hills, irregular in their
shape, and on the sides of these hills were houses at different
heights. The lower houses were all so covered by this dense fog that
I could not see them, while those that stood high up on the hills I
could see as plainly as ever. It looked as if a sea had come in while I
was gone on my visit, and had filled up the valley where the river
ran, for the fog rose to the same height on the sides of all the hills.
Many of the houses stood upon the very edge of this sea. The scene
was so beautiful that I waited to see the sun rise upon it. As it rose,
it shone over the tops of the hills, and lighted up this sea of fog,
which it in a little time scattered by its heat.
Very thick fogs often hang over large cities, while
all around in the country the air may be perfectly Dense fogs often
hanging over
clear. London is often covered with such a fog. large cities.
Sometimes it has been so dense that people could
not see to do any business. It is related that the
fog over the city of Paris was once so thick that persons who went
about with torches often ran against each other, because even lights
could not be seen unless they were very near. And in Amsterdam, in
a fog in the year 1790, there were over two hundred persons
drowned by falling in the darkness into the canals which run through
every part of that singular city.
Questions.—What becomes of the water when a cloth is
dried? Tell about the drying of ink on the paper. Tell about
water’s going up in the air after a shower. Can you
commonly see the water that is in the air? Does water go
into the air from things that do not appear wet? What is
said about its going from the skins of animals? Tell about
the experiment with the glass jar. What is said about
water’s being breathed out from the lungs? In what ways
do you see this shown? What is said about water’s being
in constant motion? When there is a fog, why is it that you
see the water that is in the air? Tell what is said about
fogs. Tell about the fogs that hang over large cities.
CHAPTER XX.
CLOUDS.

You see water in the air in another shape besides


fog. You see it in the clouds. A cloud is really fog, Clouds made of
fog.
but it is high up in the air, while what we
commonly call fog is near the ground.
Sometimes rain comes from the clouds, and
sometimes they give out no rain. Why is this? Mists.
When the clouds do not rain, the water in them
keeps in the state of fog. The particles are all in small companies;
but when the rain comes from the clouds, it is because the cold air
makes the particles gather into larger companies, so as to form
drops. Then they fall. A mist is different from rain in this way—the
companies of particles are not as large as in rain. On the other hand,
they are larger than they are in fogs or in clouds.
You remember what I have told you about the
gathering of water upon the tumblers in warm How the rain is
made to come
weather. It is the coldness of the tumbler that does from clouds.
this. It gathers, or condenses, as we commonly
say, the water in the air into companies or drops on
the tumbler, just as cold air coming upon a cloud condenses the
water into drops that fall to the earth in rain.
How swiftly these collections of water, the clouds, are sometimes
carried along by the wind! It seems as if they were chasing each
other across the sky.
How different are the shapes of the clouds!
Sometimes they lie along, stretched out like long Shapes of clouds.
straight stripes; and sometimes they are in heaps,
piled up one above another. Then, again, they are spread like
feathers. It seems strange that fog high up in the air should collect
into such different forms, when near the ground it always appears
very much the same.
At morning and evening the clouds are often
very beautiful. How do you think that the rich Their beauty.
bright colors are made? They are made by the sun
shining upon the little companies of water-particles of which the
clouds are made. I will tell you more about this when I come to
speak of Light.
The clouds are not so high up in the air as most people think they
are. Some clouds are higher than others, because they are lighter;
and sometimes you can see the clouds that are very high up going in
a different direction from those that are nearer to the earth. This is
because there are often currents of air very high up that do not go
the same way with the winds below. Persons that go up in balloons
have found this to be so, as I have before told you.
Clouds are often seen about the sides of high
mountains while the sun is shining upon their tops; Clouds about
mountains.
and persons that are on the top of a mountain may
sometimes see clouds below them, while the sky is
clear overhead. I was once on the top of Catskill Mountain when a
shower passed over. The cloud, after it had passed over the
mountain, spread over the country below, so that I looked down
upon it. As the cloud was rather a thin one, it was broken into parts.
The sun, therefore, shone through the openings here and there; and
I remember seeing through one opening in the cloud a beautiful
spot, where there was a farm-house and a pond near by, lighted up
by the bright sun shining through another opening.
It is the water that goes up from the earth into
the air that makes the clouds. I have told you from What goes up
from the earth to
what a variety of things this water comes. Even the make clouds.
perspiration from your skin and the moisture that is
breathed out from your lungs often help to form
the clouds that you see floating so high in the air.

You might also like