100% found this document useful (6 votes)
16 views

Math Adventures with Python An Illustrated Guide to Exploring Math with Code 1st Edition Peter Farrell pdf download

The document provides an overview of 'Math Adventures with Python,' a book by Peter Farrell that teaches math concepts through programming with Python. It emphasizes a hands-on, visual approach to learning mathematics, contrasting traditional methods with engaging projects that integrate art and technology. The book includes various chapters that cover basic to advanced programming concepts while applying them to mathematical problems, making math more relevant and enjoyable for learners.

Uploaded by

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

Math Adventures with Python An Illustrated Guide to Exploring Math with Code 1st Edition Peter Farrell pdf download

The document provides an overview of 'Math Adventures with Python,' a book by Peter Farrell that teaches math concepts through programming with Python. It emphasizes a hands-on, visual approach to learning mathematics, contrasting traditional methods with engaging projects that integrate art and technology. The book includes various chapters that cover basic to advanced programming concepts while applying them to mathematical problems, making math more relevant and enjoyable for learners.

Uploaded by

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

Math Adventures with Python An Illustrated Guide

to Exploring Math with Code 1st Edition Peter


Farrell pdf download

https://ebookname.com/product/math-adventures-with-python-an-
illustrated-guide-to-exploring-math-with-code-1st-edition-peter-
farrell/

Get Instant Ebook Downloads – Browse at https://ebookname.com


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

Math Starters 5 to 10 Minute Activities Aligned with


the Common Core Math Standards Grades 6 12 2nd Edition
Judith A. Muschla

https://ebookname.com/product/math-starters-5-to-10-minute-
activities-aligned-with-the-common-core-math-standards-
grades-6-12-2nd-edition-judith-a-muschla/

Programming and Mathematical Thinking A Gentle


Introduction to Discrete Math Featuring Python 1st
Edition Allan M. Stavely

https://ebookname.com/product/programming-and-mathematical-
thinking-a-gentle-introduction-to-discrete-math-featuring-
python-1st-edition-allan-m-stavely/

The Math Coach Field Guide 1st Edition Marilyn Burns

https://ebookname.com/product/the-math-coach-field-guide-1st-
edition-marilyn-burns/

Functions and Applications 11 1st Edition Chris


Kirkpatrick

https://ebookname.com/product/functions-and-applications-11-1st-
edition-chris-kirkpatrick/
Solid State Physics From the Material Properties of
Solids to Nanotechnologies Essentials of Physics Series
David Schmool (Author)

https://ebookname.com/product/solid-state-physics-from-the-
material-properties-of-solids-to-nanotechnologies-essentials-of-
physics-series-david-schmool-author/

Re treating religion deconstructing Christianity with


Jean Luc Nancy 1st Edition Nancy

https://ebookname.com/product/re-treating-religion-
deconstructing-christianity-with-jean-luc-nancy-1st-edition-
nancy/

Cell Penetrating Peptides Processes and Applications


1st Edition Ulo Langel

https://ebookname.com/product/cell-penetrating-peptides-
processes-and-applications-1st-edition-ulo-langel/

Strange Curves Counting Rabbits Other Mathematical


Explorations Keith Ball

https://ebookname.com/product/strange-curves-counting-rabbits-
other-mathematical-explorations-keith-ball/

Global Politics 9th Edition James Ray

https://ebookname.com/product/global-politics-9th-edition-james-
ray/
Unfolded Proteins 1st Edition George D. Rose (Eds.)

https://ebookname.com/product/unfolded-proteins-1st-edition-
george-d-rose-eds/
Playlists

History

Topics
MATH ADVENTURES WITH PYTHON
AN ILLUSTRATED GUIDE TO EXPLORING MATH WITH CODE
Tutorials
BY PETER FARRELL
Offers & Deals

Highlights

Settings

Support

SignSan
Out Francisco
Playlists
MATH ADVENTURES WITH PYTHON. Copyright © 2019 by Peter Farrell.
History
All rights reserved. No part of this work may be reproduced or transmitted in any form
or by any means, electronic or mechanical, including photocopying, recording, or by
Topics
any information storage or retrieval system, without the prior written permission of the
copyright owner and the publisher.
Tutorials

ISBN­10: 1­59327­867­5
Offers & Deals

ISBN­13: 978­1­59327­867­0
Highlights

Publisher: William Pollock


Settings

Production Editor: Meg Sneeringer


Support
Cover Illustration: Josh Ellingson
Sign Out
Developmental Editor: Annie Choi

Technical Reviewer: Patrick Gaunt

Copyeditor: Barton D. Reed

Compositors: David Van Ness and Meg Sneeringer

Proofreader: James Fraleigh

The following images are reproduced with permission:

Figure 10­2 by Acadac mixed from originals made by Avsa


(https://commons.wikimedia.org/wiki/File:Britain­fractal­coastline­
100km.png#/media/File:Britain­fractalcoastline­combined.jpg; CC­BY­SA­3.0);

Figure 11­19 by Fabienne Serriere, https://knityak.com/.

For information on distribution, translations, or bulk sales, please contact No Starch


Press, Inc. directly:
No Starch Press, Inc.

245 8th Street, San Francisco, CA 94103

phone: 1.415.863.9900; info@nostarch.com

www.nostarch.com

A catalog record of this book is available from the Library of Congress.

No Starch Press and the No Starch Press logo are registered trademarks of No Starch
Press, Inc. Other product and company names mentioned herein may be the
trademarks of their respective owners. Rather than use a trademark symbol with every
occurrence of a trademarked name, we are using the names only in an editorial fashion
and to the benefit of the trademark owner, with no intention of infringement of the
trademark.

The information in this book is distributed on an “As Is” basis, without warranty. While
every precaution has been taken in the preparation of this work, neither the authors nor
No Starch Press, Inc. shall have any liability to any person or entity with respect to any
loss or damage caused or alleged to be caused directly or indirectly by the information
contained in it.
History INTRODUCTION
Topics

Tutorials

Offers & Deals

Highlights

Settings
Which approach shown in Figure 1 would you prefer? On the left, you see an example of
a traditional approach to teaching math, involving definitions, propositions, and proofs.
Support
This method requires a lot of reading and odd symbols. You’d never guess this had
anything to do with geometric figures. In fact, this text explains how to find the
Sign Out
centroid, or the center, of a triangle. But traditional approaches like this don’t tell us
why we should be interested in finding the center of a triangle in the first place.

Figure 1: Two approaches to teaching about the centroid

Next to this text, you see a picture of a dynamic sketch with a hundred or so rotating
triangles. It’s a challenging programming project, and if you want it to rotate the right
way (and look cool), you have to find the centroid of the triangle. In many situations,
making cool graphics is nearly impossible without knowing the math behind geometry,
for example. As you’ll see in this book, knowing a little of the math behind triangles,
like the centroid, will make it easy to create our artworks. A student who knows math
and can create cool designs is more likely to delve into a little geometry and put up with
a few square roots or a trig function or two. A student who doesn’t see any outcome,
and is only doing homework from a textbook, probably doesn’t have much motivation
to learn geometry.

In my eight years of experience as a math teacher and three years of experience as a


computer science teacher, I’ve met many more math learners who prefer the visual
approach to the academic one. In the process of creating something interesting, you
come to understand that math is not just following steps to solve an equation. You see
that exploring math with programming allows for many ways to solve interesting
problems, with many unforeseen mistakes and opportunities for
improvements along the way.

This is the difference between school math and real math.

THE PROBLEM WITH SCHOOL MATH


What do I mean by “school math” exactly? In the US in the 1860s, school math was
preparation for a job as a clerk, adding columns of numbers by hand. Today, jobs are
different, and the preparation for these jobs needs to change, too.

People learn best by doing. This hasn’t been a daily practice in schools, though, which
tend to favor passive learning. “Doing” in English and history classes might mean
students write papers or give presentations, and science students perform experiments,
but what do math students do? It used to be that all you could actively “do” in math
class was solve equations, factor polynomials, and graph functions. But now that
computers can do most of those calculations for us, these practices are no longer
sufficient.

Simply learning how to automate solving, factoring, and graphing is not the final goal.
Once a student has learned to automate a process, they can go further and deeper into a
topic than was ever possible before.

Figure 2 shows a typical math problem you’d find in a textbook, asking students to
define a function, “f(x),” and evaluate it for a ton of values.
Figure 2: A traditional approach to teaching functions

This same format goes on for 18 more questions! This kind of exercise is a trivial
problem for a programming language like Python. We could simply define the function
)and
f(x then plug in the values by iterating over a list, like this:

import math

def f(x):
return math.sqrt(x + 3) ­ x + 1

#list of values to plug in


for x in [0,1,math.sqrt(2),math.sqrt(2)­1]:
print("f({:.3f}) = {:.3f}".format(x,f(x)))

The last line just makes the output pretty while rounding all the solutions to three
decimal places, as shown here:

f(0.000) = 2.732
f(1.000) = 2.000
f(1.414) = 1.687
f(0.414) = 2.434

In programming languages like Python, JavaScript, Java, and so on, functions are a
vitally important tool for transforming numbers and other objects—even other
functions! Using Python, you can give a descriptive name to a function, so it’s easier to
understand what’s going on. For example, you can name a function that calculates the
area of a rectangle by calling it calculateArea(), like this:

def calculateArea(width,height):

A math textbook published in the 21st century, decades after Benoit Mandelbrot first
generated his famous fractal on a computer when working for IBM, shows a picture of
the Mandelbrot set and gushes over the discovery. The textbook describes the
Mandelbrot set, which is shown in Figure 3, as “a fascinating mathematical object
derived from the complex numbers. Its beautiful boundary illustrates chaotic behavior.”

Figure 3: The Mandelbrot set

The textbook then takes the reader through a painstaking “exploration” to show how to
transform a point in the complex plane. But the student is only shown how to do this on
a calculator, which means only two points can be transformed (iterated seven times) in
a reasonable amount of time. Two points.

In this book, you’ll learn how to do this in Python, and you’ll make the program
transform hundreds of thousands of points automatically and even create the
Mandelbrot set you see above!

ABOUT THIS BOOK


This book is about using programming tools to make math fun and relevant, while still
being challenging. You’ll make graphs to show all the possible outputs of a function.
You’ll make dynamic, interactive works of art. You’ll even make an ecosystem with
sheep that move around, eat grass, and multiply, and you’ll create virtual organisms
that try to find the shortest route through a bunch of cities while you watch!

You’ll do this using Python and Processing in order to supercharge what you can do in
math class. This book is not about skipping the math; it’s about using the newest,
coolest tools out there to get creative and learn real computer skills while discovering
the connections between math, art, science, and technology. Processing will provide the
graphics, shapes, motion, and colors, while Python does the calculating and follows
your instructions behind the scenes.

For each of the projects in this book, you’ll build the code up from scratch, starting
from a blank file, and checking your progress at every step. Through making mistakes
and debugging your own programs, you’ll get a much deeper understanding of what
each block of code does.

WHO SHOULD USE THIS BOOK


This book is for anyone who’s learning math or who wants to use the most modern tools
available to approach math topics like trigonometry and algebra. If you’re learning
Python, you can use this book to apply your growing programming skills to nontrivial
projects like cellular automata, genetic algorithms, and computational art.

Teachers can use the projects in this book to challenge their students or to make math
more approachable and relevant. What better way to teach matrices than to save a
bunch of points to a matrix and use them to draw a 3D figure? When you know Python,
you can do this and much more.

WHAT’S IN THIS BOOK?


This book begins with three chapters that cover basic Python concepts you’ll build on to
explore more complicated math. The next nine chapters explore math concepts and
problems that you can visualize and solve using Python and Processing. You can try the
exercises peppered throughout the book to apply what you learned and challenge
yourself.

Chapter 1: Drawing Polygons with Turtles teaches basic programming concepts like

loops, variables, and functions using Python’s built-in t


urt
lemodule.
Chapter 2: Making Tedious Arithmetic Fun with Lists and Loops goes deeper into

programming concepts like lists and Booleans.

Chapter 3: Guessing and Checking with Conditionals applies your growing Python

skills to problems like factoring numbers and making an interactive number-guessing

game.

Chapter 4: Transforming and Storing Numbers with Algebra ramps up from solving

simple equations to solving cubic equations numerically and by graphing.

Chapter 5: Transforming Shapes with Geometry shows you how to create shapes and

then multiply, rotate, and spread them all over the screen.

Chapter 6: Creating Oscillations with Trigonometry goes beyond right triangles and

lets you create oscillating shapes and waves.

Chapter 7: Complex Numbers teaches you how to use complex numbers to move points

around the screen, creating designs like the Mandelbrot set.

Chapter 8: Using Matrices for Computer Graphics and Systems of Equations takes

you into the third dimension, where you’ll translate and rotate 3D shapes and solve huge

systems of equations with one program.

Chapter 9: Building Objects with Classes covers how to create one object, or as many as

your computer can handle, with roaming sheep and delicious grass locked in a battle for

survival.

Chapter 10: Creating Fractals Using Recursion shows how recursion can be used as a

whole new way to measure distances and create wildly unexpected designs.

Chapter 11: Cellular Automata teaches you how to generate and program cellular

automata to behave according to rules you make.

Chapter 12: Solving Problems Using Genetic Algorithms shows you how to harness

the theory of natural selection to solve problems we couldn’t solve in a million years

otherwise!

DOWNLOADING AND INSTALLING PYTHON


The easiest way to get started is to use the Python 3 software distribution, which is
available for free at https://www.python.org/. Python has become one of the most
popular programming languages in the world. It’s used to create websites like Google,
YouTube, and Instagram, and researchers at universities all over the world use it to
crunch numbers in various fields, from astronomy to zoology. The latest version
released to date is Python 3.7. Go to https://www.python.org/downloads/ and choose
the latest version of Python 3, as shown in Figure 4.

Figure 4: The official website of the Python Software Foundation

Figure 5: Click the downloaded file to start the install

You can choose the version for your operating system. The site detected that I was using
Windows. Click the file when the download is complete, as shown in Figure 5.

Follow the directions, and always choose the default options. It might take a few
minutes to install. After that, search your system for “IDLE.” That’s the Python IDE, or
integrated development environment, which is what you’ll need to write Python code.
Why “IDLE”? The Python programming language was named after the Monty Python
comedy troupe, and one of the members is Eric Idle.

STARTING IDLE
Find IDLE on your system and open it.
Figure 6: Opening IDLE on Windows

A screen called a “shell” will appear. You can use this for the interactive coding
environment, but you’ll want to save your code. Click File▸New File or press ALT­N,
and a file will appear (see Figure 7).

Figure 7: Python’s interactive shell (left) and a new module (file) window, ready
for code!

This is where you’ll write your Python code. We will also use Processing, so let’s go over
how to download and install Processing next.

INSTALLING PROCESSING
There’s a lot you can do with Python, and we’ll use IDLE a lot. But when we want to do
some heavy­duty graphics, we’re going to use Processing. Processing is a professional­
level graphics library used by coders and artists to make dynamic, interactive artwork
and graphics.

Go to https://processing.org/download/ and choose your operating system, as shown


in Figure 8.
Figure 8: The Processing website

Figure 9: Where to find other Processing modes, like the Python mode we’ll be
using

Download the installer for your operating system by clicking it and following the
instructions. Double­click the icon to start Processing. This defaults to Java mode. Click
Java to open the drop­down menu, as shown in Figure 9, and then click Add Mode.

Select Python Mode▸Install. It should take a minute or two, but after this you’ll be
able to code in Python with Processing.

Now that you’ve set up Python and Processing, you’re ready to start exploring math!
aylists

story PART I
HITCHIN’ UP YOUR PYTHON WAGON
opics

utorials

ffers & Deals

ghlights

ettings

Support

Sign Out
Playlists

1
History

Topics
DRAWING POLYGONS WITH THE TURTLE MODULE
Centuries ago a Westerner heard a Hindu say the Earth rested on the back of a turtle.
Tutorials
When asked what the turtle was standing on, the Hindu explained, “It’s turtles all the
way
Offers down.”
& Deals

Highlights

Settings

Support

Sign Out

Before you can start using math to build all the cool things you see in this book, you’ll
need to learn how to give instructions to your computer using a programming language
called Python. In this chapter you’ll get familiar with some basic programming concepts
like loops, variables, and functions by using Python’s built­in turtle tool to draw
different shapes. As you’ll see, the turtle module is a fun way to learn about Python’s
basic features and get a taste of what you’ll be able to create with programming.

PYTHON’S TURTLE MODULE


The Python turtle tool is based on the original “turtle” agent from the Logo
programming language, which was invented in the 1960s to make computer
programming more accessible to everyone. Logo’s graphical environment made
interacting with the computer visual and engaging. (Check out Seymour Papert’s
brilliant book Mindstorms for more great ideas for learning math using Logo’s virtual
turtles.) The creators of the Python programming language liked the Logo turtles so
much that they wrote a module called turtle in Python to copy the Logo turtle
functionality.
Python’s turtle module lets you control a small image shaped like a turtle, just like a
video game character. You need to give precise instructions to direct the turtle around
the screen. Because the turtle leaves a trail wherever it goes, we can use it to write a
program that draws different shapes.

Let’s begin by importing the turtle module!

IMPORTING THE TURTLE MODULE


Open a new Python file in IDLE and save it as myturtle.py in the Python folder. You
should see a blank page. To use turtles in Python, you have to import the functions
from the turtle module first.

A function is a set of reusable code for performing a specific action in a program. There
are many built­in functions you can use in Python, but you can also write your own
functions (you’ll learn how to write your own functions later in this chapter).

A module in Python is a file that contains predefined functions and statements that you
can use in another program. For example, the turtle module contains a lot of useful
code that was automatically downloaded when you installed Python.

Although functions can be imported from a module in many ways, we’ll use a simple
one here. In the myturtle.py file you just created, enter the following at the top:

from turtle import *

The fromcommand indicates that we’re importing something from outside our file. We
then give the name of the module we want to import from, which is turtlein this case.
We use the importkeyword to get the useful code we want from the turtle module. We
use the asterisk (*) here as a wildcard command that means “import everything from
that module.” Make sure to put a space between importand the asterisk.

Save the file and make sure it’s in the Python folder; otherwise, the program will throw
an error.

WARNING

Do not save the file as turtle.py. This filename already exists and will cause a conflict
with the import from the turtle module! Anything else will work: myturtle.py,
turtle2.py, mondayturtle.py, and so on.

MOVING YOUR TURTLE


MOVING YOUR TURTLE
Now that you’ve imported the turtle module, you’re ready to enter instructions to move
the turtle. We’ll use the forward()function (abbreviated as fd) to move the turtle forward
a certain number of steps while leaving a trail behind it. Note that forward()is one of the
functions we just imported from the turtle module. Enter the following to make the
turtle go forward:

forward(100)

Here, we use the forward()function with the number 100 inside parentheses to indicate
how many steps the turtle should move. In this case, 100 is the argument we pass to
the forward()function. All functions take one or more arguments. Feel free to pass other
numbers to this function. When you press F5 to run the program, a new window should
open with an arrow in the center, as shown in Figure 1­1.

Figure 1­1: Running your first line of code!

As you can see, the turtle started in the middle of the screen and walked forward 100
steps (it’s actually 100 pixels). Notice that the default shape is an arrow, not a turtle,
and the default direction the arrow is facing is to the right. To change the arrow into a
turtle, update your code so that it looks like this:
myturtle.py
from turtle import *
forward(100)
shape('turtle')

As you can probably tell, shape()is another function defined in the turtle module. It lets
you change the shape of the default arrow into other shapes, like a circle, a square, or
an arrow. Here, the shape()function takes the string value 'turtle'as its argument, not a
number. (You’ll learn more about strings and different data types in the next chapter.)
Save and run the myturtle.py file again. You should see something like Figure 1­2.

Figure 1­2: Changing the arrow into a turtle!

Now your arrow should look like a tiny turtle!

CHANGING DIRECTIONS
The turtle can go only in the direction it’s facing. To change the turtle’s direction, you
must first make the turtle turn a specified number of degrees using the right()or left()
function and then go forward. Update your myturtle.py program by adding the last two
lines of code shown next:

myturtle.py
from turtle import *
forward(100)
shape('turtle')
right(45)
forward(150)

Here, we’ll use the right()function (or rt()for short) to make the turtle turn right 45
degrees before moving forward by 150 steps. When you run this code, the output should
look like Figure 1­3.

Figure 1­3: Changing turtle’s direction

As you can see, the turtle started in the middle of the screen, went forward 100 steps,
turned right 45 degrees, and then went forward another 150 steps. Notice that Python
runs each line of code in order, from top to bottom.

EXERCISE 1­1: SQUARE DANCE

Return to the myturtle.py program. Your first challenge is to modify the code
in the program using only the forwardand rightfunctions so that the turtle
draws a square.

REPEATING CODE WITH LOOPS


Every programming language has a way to automatically repeat commands a given
number of times. This is useful because it saves you from having to type out the same
code over and over and cluttering your program. It also helps you avoid typos that can
prevent your program from running properly.

USING THE FOR LOOP


In Python we use the forloop to repeat code. We also use the rangekeyword to specify
the number of times we go through the loop. Open a new program file in IDLE, save it
as for_loop.py, and then enter the following:

for_loop.py
for i in range(2):
print('hello')

Here, the range()function creates i, or an iterator, for each for loop. The iterator is a
value that increases each time it’s used. The number 2 in parentheses is the argument
we pass to the function to control its behavior. This is similar to the way we passed
different values to the forward()and right()functions in previous sections.

In this case, range(2)creates a sequence of two numbers, 0 and 1. For each of these two
numbers, the forcommand performs the action specified after the colon, which is to
print the word hello.

Be sure to indent all the lines of the code you want to repeat by pressing TAB (one tab is
four spaces). Indentation tells Python which lines are inside the loop so forknows
exactly what code to repeat. And don’t forget the colon at the end; it tells the computer
what’s coming up after it is in the loop. When you run the program, you should see the
following printed in the shell:

hello
hello

As you can see, the program prints hellotwice because range(2)creates a sequence
containing two numbers, 0 and 1. This means that the forcommand loops over the two
items in the sequence, printing “hello” each time. Let’s update the number in the
parentheses, like this:

for_loop.py
for i in range(10):
print('hello')

When you run this program, you should get helloten times, like this:

hello
hello
hello
hello
hello
hello
hello
hello
hello
hello

Let’s try another example since you’ll be writing a lot of forloops in this book:

for_loop.py
for i in range(10):
print(i)

Because counting begins at 0 rather than 1 in Python, foriinrange(10)gives us the


numbers 0 through 9. This sample code is saying “for each value in the range 0 to 9,
display the current number.” The forloop then repeats the code until it runs out of
numbers in the range. When you run this code, you should get something like this:

0
1
2
3
4
5
6
7
8
9

In the future you’ll have to remember that istarts at 0 and ends before the last number
in a loop using range, but for now, if you want something repeated four times, you can
use this:

for i in range(4):

It’s as simple as that! Let’s see how we can put this to use.

USING A FOR LOOP TO DRAW A SQUARE


USING A FOR LOOP TO DRAW A SQUARE
In Exercise 1­1 your challenge was to make a square using only the forward()and right()
functions. To do this, you had to repeat forward(100)and right(90)four times. But this
required entering the same code multiple times, which is time­consuming and can lead
to mistakes.

Let’s use a forloop to avoid repeating the same code. Here’s the myturtle.py program,
which uses a forloop instead of repeating the forward()and right()functions four times:

myturtle.py
from turtle import *
shape('turtle')
for i in range(4):
forward(100)
right(90)

Note that shape('turtle')should come right after you import the turtle module and
before you start drawing. The two lines of code inside this forloop tell the turtle to go
forward 100 steps and then turn 90 degrees to the right. (You might have to face the
same way as the turtle to know which way “right” is!) Because a square has four sides,
we use range(4)to repeat these two lines of code four times. Run the program, and you
should see something like Figure 1­4.

Figure 1­4: A square made with a forloop

You should see that the turtle moves forward and turns to the right a total of four times,
finally returning to its original position. You successfully drew a square using a forloop!

CREATING SHORTCUTS WITH FUNCTIONS


Now that we’ve written code to draw a square, we can save all that code to a magic
keyword that we can call any time we want to use that square code again. Every
programming language has a way to do this, and in Python it’s called a function, which
is the most important feature of computer programming. Functions make code
compact and easier to maintain, and dividing a problem up into functions often allows
you to see the best way of solving it. Earlier you used some built­in functions that come
with the turtle module. In this section you learn how to define your own function.

To define a function you start by giving it a name. This name can be anything you want,
as long as it’s not already a Python keyword, like list, range, and so on. When you’re
naming functions, it’s better to be descriptive so you can remember what they’re for
when you use them again. Let’s call our function square()because we’ll be using it to
make a square:

myturtle.py
def square():
for i in range(4):
forward(100)
right(90)

The defcommand tells Python we’re defining a function, and the word we list afterward
will become the function name; here, it’s square(). Don’t forget the parentheses after
squ ! They’re
are a sign in Python that you’re dealing with a function. Later we’ll put
values inside them, but even without any values inside, the parentheses need to be
included to let Python know you are defining a function. Also, don’t forget the colon at
the end of the function definition. Note that we indent all the code inside the function
to let Python know which code goes inside it.

If you run this program now, nothing will happen. You’ve defined a function, but you
didn’t tell the program to run it yet. To do this, you need to call the function at the end
of the myturtle.py file after the function definition. Enter the code shown in Listing 1­1.

myturtle.py
from turtle import *
shape('turtle')
def square():
for i in range(4):
forward(100)
right(90)
square()

Listing 1­1: The square()function is called at the end of the file.


When you call square()at the end like this, the program should run properly. Now you
can use the square()function at any point later in the program to quickly draw another
square.

You can also use this function in a loop to build something more complicated. For
example, to draw a square, turn right a little, make another square, turn right a little,
and repeat those steps multiple times, putting the function inside a loop makes sense.

The next exercise shows an interesting­looking shape that’s made of squares! It might
take your turtle a while to create this shape, so you can speed it up by adding the speed()
function to myturtle.py after shape('turtle'). Using speed(0)makes the turtle move the
fastest, whereas speed(1)is the slowest. Try different speeds, like speed(5)and speed(10), if
you want.

EXERCISE 1­2: A CIRCLE OF SQUARES

Write and run a function that draws 60 squares, turning right 5 degrees after
each square. Use a loop! Your result should end up looking like this:

USING VARIABLES TO DRAW SHAPES


So far all our squares are the same size. To make squares of different sizes, we’ll need to
vary the distance the turtle walks forward for each side. Instead of changing the
definition for the square()function every time we want a different size, we can use a
variable, which in Python is a word that represents a value you can change. This is
similar to the way x in algebra can represent a value that can change in an equation.

In math class, variables are single letters, but in programming you can give a variable
Random documents with unrelated
content Scribd suggests to you:
"Murderer!" he exclaimed, "my brother's blood calls aloud for
vengeance. May Providence make me its instrument!"
Dominique replied not. Under the same conditions as before, the two
young men took their stations. But the chances were not equal.
Dominique retained all his coolness; his opponent's whole frame
quivered with passionate emotion. This time, neither was in haste to
fire. Advancing slowly, their eyes fixed on each other, they reached
at the same moment the limits of their walk. Then their pistols were
gradually raised, and, as if by word of command, simultaneously
discharged. This time both balls took effect. The one that struck
Dominique went through his arm, without breaking the bone, and
lodged in his back, inflicting a severe but not a dangerous wound.
But Martial Noell was shot through the head.
The news of this bloody business soon got wind, and the very same
day it was the talk of all Toulouse. Martial Noell had died upon the
spot; his brother expired within forty-eight hours. The seconds got
out of the way, till they should see how the thing was likely to go.
Dominique's wound prevented his following their example, if he were
so disposed; and when it no longer impeded his movements, he was
already in the hands of justice. Frantic with grief on learning the fate
of his beloved sons, Anthony Noell hurried to Toulouse, and
vigorously pushed a prosecution. He hoped for a very severe
sentence, and was bitterly disappointed when Dominique escaped, in
consideration of his wounds and of his having been the insulted
party, with the lenient doom of five years' imprisonment.

FIVE YEARS LATER.


Five years of absence from home may glide rapidly enough away,
when passed in pursuit of pleasure or profit; dragged out between
prison walls, they appear an eternity, a chasm between the captive
and the world. So thought Dominique as he re-entered Montauban,
at the expiration of his sentence. During the whole time, not a word
of intelligence had reached him from his home, no friendly voice had
greeted his ear, no line of familiar handwriting had gladdened his
tearless eyes. Arrived in his native town, his first inquiry was for his
father. Pascal Lafon was dead. The fate of his wife and son had
preyed upon his health; the prison air had poisoned the springs of
life in the strong, free-hearted man. The physician declared drugs
useless in his case, for that the atmosphere of liberty alone could
save him; and he recommended, if unconditional release were
impossible, that the prisoner should be guarded in his own house.
The recommendation was forwarded to Paris, but the same post
took a letter from Anthony Noell, and a few days brought the
physician's dismissal and an order for the close confinement of
Lafon. Examinations followed each other in rapid succession, but
they served only to torment the prisoner, without procuring his
release; and after some months he died, his innocence
unrecognised. The cause of his death, and the circumstances
attending it, were loudly proclaimed by the indignant physician; and
Dominique, on his return to Montauban, had no difficulty in
obtaining all the details, aggravated probably by the unpopularity of
the judge. He heard them with unchanging countenance; none could
detect a sign of emotion on that cheek of marble paleness, or in that
cold and steadfast eye. He then made inquiries concerning Anthony
Noell. That magistrate, he learned, had been promoted, two years
previously, and now resided in his native town of Marseilles. At that
moment, however, he happened to be at an hotel in Montauban. He
had never recovered the loss of his sons, which had aged him
twenty years in appearance, and had greatly augmented the
harshness and sour severity of his character. He seemed to find his
sole consolation in the society of his daughter, now a beautiful girl of
seventeen, and in intense application to his professional duties. A
tour of inspection, connected with his judicial functions, had now
brought him to Montauban. During his compulsory absences from
home, which were of annual occurrence and of some duration, his
daughter remained in the care of an old female relation, her habitual
companion, whose chief faults were her absurd vanity, and her too
great indulgence of the caprices of her darling niece.
Dominique showed singular anxiety to learn every particular
concerning Anthony Noell's household, informing himself of the
minutest details, and especially of the character of his daughter, who
was represented to him as warmhearted and naturally amiable, but
frivolous and spoiled by over-indulgence. On the death of his sons,
Noell renounced his project of sending her from home, and the
consequence was, that her education had been greatly neglected.
Madame Verlé, the old aunt already mentioned, was a well-meaning,
but very weak widow, who, childless herself, had no experience in
bringing up young women. In her own youth she had been a great
coquette, and frivolity was still a conspicuous feature in her
character. As M. Noell, since his sons' death, had shown a sort of
aversion for society, the house was dull enough, and Madame Verlé's
chief resource was the circulating library, whence she obtained a
constant supply of novels. Far from prohibiting to her niece the
perusal of this trash, she made her the companion of her
unwholesome studies. The false ideas and highflown romance with
which these books teemed, might have made little impression on a
character fortified by sound principles and a good education, but
they sank deep into the ardent and uncultivated imagination of
Florinda Noell, to whose father, engrossed by his sorrows and by his
professional labours, it never once occurred to check the current of
corruption thus permitted to flow into his daughter's artless mind.
He saw her gay, happy, and amused, and he inquired no further;
well pleased to find her support so cheerfully the want of society to
which his morose regrets and gloomy eccentricity condemned her.
One of Dominique's first cares, on his return to Montauban, was to
visit his parents' grave. Although his father died in prison, and his
memory had never been cleared from the slur of accusation, his
friends had obtained permission, with some difficulty, to inter his
corpse beside that of his wife. The day was fading into twilight when
Dominique entered the cemetery, and it took him some time to find
the grave he sought. The sexton would have saved him the trouble,
but the idea seemed a profanation; in silence and in solitude he
approached the tomb of his affections and happiness. Long he sat
upon the mound, plunged in reverie, but with dry eyes, for the
source of tears appeared exhausted in his heart. Night came; the
white tombstones looked ghastly pale in the moonlight, and cast
long black shadows upon the turf. Dominique arose, plucked a wild-
flower from his mother's grave, and left the place. He had taken but
three steps when he became aware he was not alone in the
churchyard. A tall figure rose suddenly from an adjacent grave.
Although separated but by one lofty tombstone, the two mourners
had been too absorbed and silent in their grief to notice each other's
presence. Now they gazed at one another. The moon, for a moment
obscured, emerged from behind a cloud, and shone upon their
features. The recognition was mutual and instantaneous. Both
started back. Between the graves of their respective victims,
Anthony Noell and Dominique Lafon confronted each other.
A dusky fire gleamed in the eyes of Dominique, and his features,
worn and emaciated from captivity, were distorted with the grimace
of intense hatred. His heart throbbed as though it would have burst
from his bosom.
"May your dying hour be desolate!" he shrieked. "May your end be in
misery and despair!"
The magistrate gazed at his inveterate foe with a fixed stare of
horror, as though a phantom had suddenly risen before him. Then,
slowly raising his hand, till it pointed to the grave of his sons, his eye
still fixed, as if by fascination, upon that of Dominique, a single
word, uttered in a hollow tone, burst from his quivering lips.
"Murderer!" he exclaimed.
Dominique laughed. It was a hideous sound, a laugh of
unquenchable hatred and savage exultation. He approached Noell till
their faces were but a few inches apart, and spoke in a voice of
suppressed fierceness.
"My father and my mother," he said, "expired in grief, and shame,
and misery. By your causeless hate and relentless persecution, I was
made an orphan. The debt is but half paid. You have still a child. You
still find happiness on earth. But you yet shall lose all—all! Yet shall
you know despair and utter solitude, and your death shall be
desolate, even as my father's was. Remember! We shall meet
again."
And passing swiftly before the magistrate, with a gesture of solemn
menace, Dominique left the cemetery. Noell sank, pale and
trembling, upon his children's grave. His enemy had found him, and
security had fled. Dominique's last words, "We shall meet again!"
rang in his ears, as if uttered by the threatening voice of hostile and
irresistible destiny. Slowly, and in great uneasiness, he returned into
the town, which he left early the next day for Marseilles. To his
terrified fancy, his daughter was safe only when he watched over
her. So great was his alarm, that he would have resigned his
lucrative and honourable office sooner than have remained longer
absent from the tender flower whom the ruthless spoiler threatened
to trample and destroy.

THE HORSE-RIDERS.
Months passed away, and spring returned. On a bright morning of
May—in parched Provence the pleasantest season of the year—a
motley cavalcade approached Marseilles by the Nice road. It
consisted of two large waggons, a score of horses, and about the
same number of men and women. The horses were chiefly white,
cream-coloured, or piebald, and some of them bore saddles of
peculiar make and fantastical colours, velvet-covered and decorated
with gilding. One was caparisoned with a tiger-skin, and from his
headstall floated streamers of divers-coloured horsehair. The women
wore riding-habits, some of gaudy tints, bodices of purple or crimson
velvet, with long flaunting robes of green or blue. They were
sunburned, boldfaced damsels, with marked features and of
dissipated aspect, and they sat firmly on their saddles, jesting as
they rode along. Their male companions were of corresponding
appearance; lithe vigorous fellows, from fifteen to forty, attired in
various hussar and jockey costumes, with beards and mustaches
fantastically trimmed, limbs well developed, and long curling hair.
Various nations went to the composition of the band. French,
Germans, Italians, and Gipsies made up the equestrian troop of Luigi
Bartolo, which, after passing the winter in southern Italy, had
wandered north on the approach of spring, and now was on its way
to give a series of representations at Marseilles.
A little behind his comrades, upon a fine gray horse, rode a young
Florentine named Vicenzo, the most skilful rider of the troop.
Although but five-and-twenty years old, he had gone through many
vicissitudes and occupations. Of respectable family, he had studied
at Pisa, had been expelled for misconduct, had then enlisted in an
Austrian regiment, whence his friends had procured his discharge,
but only to cast him off for his dissolute habits. Alternately a
professional gambler, a stage player, and a smuggler on the Italian
frontier, he had now followed, for upwards of a year, the vagabond
life of a horse-rider. Of handsome person and much natural
intelligence, he covered his profligacy and taste for low associations
with a certain varnish of good breeding. This had procured him in
the troop the nickname of the Marchese, and had made him a great
favourite with the female portion of the strollers, amongst whom
more than one fierce quarrel had arisen for the good graces of the
fascinating Vicenzo.
The Florentine was accompanied by a stranger, who had fallen in
with the troop at Nice, and had won their hearts by his liberality. He
had given them a magnificent supper at their albergo, had made
them presents of wine and trinkets—all apparently out of pure
generosity and love of their society. He it was who had chiefly
determined them to visit Marseilles, instead of proceeding north, as
they had originally intended, by Avignon to Lyons. He marched with
the troop, on horseback, wrapped in a long loose coat, and with a
broad hat slouched over his brow, and bestowed his companionship
chiefly on Vicenzo, to whom he appeared to have taken a great
affection. The strollers thought him a strange eccentric fellow, half
cracked, to say the least; but they cared little whether he were sane
or mad, so long as his society proved profitable, his purse well filled,
and ever in his hand.
The wanderers were within three miles of Marseilles when they
came to one of the bastides, or country-houses, so thickly scattered
around that city. It was of unusual elegance, almost concealed
amongst a thick plantation of trees, and having a terrace, in the
Italian style, overlooking the road. Upon this terrace, in the cool
shade of an arbour, two ladies were seated, enjoying the sweet
breath of the lovely spring morning. Books and embroidery were on
a table before them, which they left on the appearance of the horse-
riders, and, leaning upon the stone parapet, looked down on the
unusual spectacle. The elder of the two had nothing remarkable,
except the gaudy ribbons that contrasted with her antiquated
physiognomy. The younger, in full flush of youth, and seen amongst
the bright blossoms of the plants that grew in pots upon the
parapet, might have passed for the goddess of spring in her most
sportive mood. Her hair hung in rich clusters over her alabaster
neck; her blue eyes danced in humid lustre; her coral lips, a little
parted, disclosed a range of sparkling pearls. The sole fault to be
found with her beauty was its character, which was sensual rather
than intellectual. One beheld the beautiful and frivolous child of clay,
but the ray of the spirit that elevates and purifies was wanting. It
was the beauty of a Bacchante rather than of a Vestal—Aurora
disporting herself on the flower banks, and awaiting, in frolic mood,
the advent of Cupid.
The motley cavalcade moved on, the men assuming their smartish
seat in the saddle as they passed under the inspection of the bella
biondina. When Vicenzo approached the park wall, his companion
leaned towards him and spoke something in his ear. At the same
moment, as if stung by a gadfly, the spirited gray upon which the
Florentine was mounted, sprang with all four feet from the ground,
and commenced a series of leaps and curvets that would have
unseated a less expert rider. They only served to display to the
greatest advantage Vicenzo's excellent horsemanship and slender
graceful figure. Disdaining the gaudy equipments of his comrades,
the young man was tastefully attired in a dark closely-fitting jacket.
Hessian boots and pantaloons exhibited the Antinöus-like
proportions of his comely limbs. He rode like a centaur, he and his
steed seemingly forming but one body. As he reached, gracefully
caracoling, the terrace on whose summit the ladies were stationed,
he looked up with a winning smile, and removing his cap, bowed to
his horse's mane. The old lady bridled and smiled; the young one
blushed as the Florentine's ardent gaze met hers, and in her
confusion she let fall a branch of roses she held in her hand. With
magical suddenness Vicenzo's fiery horse stood still, as if carved of
marble. With one bound the rider was on foot, and had snatched up
the flowers; then placing a hand upon the shoulder of his steed, who
at once started in a canter, he lightly, and without apparent effort,
vaulted into the saddle. With another bow and smile he rode off with
his companion.
"'Twas well done, Vicenzo," said the latter.
"What an elegant cavalier!" exclaimed Florinda Noell pensively,
following with her eyes the accomplished equestrian.
"And so distinguished in his appearance!" chimed in her silly aunt.
"And how he looked up at us! One might fancy him a nobleman in
disguise, bent on adventures, or seeking intelligence of a lost lady-
love."
Florinda smiled, but the stale platitude, borrowed from the absurd
romances that crammed Madame Verlé's brain, abode in her
memory. Whilst the handsome horse-rider remained in sight, she
continued upon the parapet and gazed after him. On his part,
Vicenzo several times looked back, and more than once he pressed
to his lips the fragrant flowers of which accident had made him the
possessor.
A small theatre, which happened then to be unoccupied, was hired
by the equestrians for their performances, the announcement of
which was soon placarded from one end to the other of Marseilles.
At the first representation, Florinda and her aunt were amongst the
audience. They had no one to cheek their inclinations, for Mr Noell,
after passing many months with his daughter without molestation
from Dominique, who had disappeared from Montauban the day
after their meeting in the churchyard, had forgotten his
apprehensions, and had departed on his annual tour of professional
duty. At the circus, the honours of the night were for Vicenzo. His
graceful figure, handsome face, skilful performance, and
distinguished air, were the theme of universal admiration. Florinda
could not detach her gaze from him as he flew round the circle,
standing with easy negligence upon his horse's back; and she could
scarcely restrain a cry of horror and alarm at the boldness of some
of his feats. Vicenzo had early detected her presence in the theatre;
and the expression of his eyes, when he passed before her box,
made her conscious that he had done so.
Several days elapsed, during which Florinda and her aunt had more
than once again visited the theatre. Vicenzo had become a subject
of constant conversation between the superannuated coquette and
her niece, the old lady indulging the most extravagant conjectures as
to who he could be, for she had made up her mind he was now in
an assumed character. Florinda spoke of him less, but thought of
him more. Nor were her visits to the theatre her only opportunities
of seeing him. Vicenzo, soon after his arrival at Marseilles, had
excited his comrades' wonder and envy by appearing in the elegant
costume of a private gentleman, and by taking frequent rides out of
the town, at first accompanied by Fontaine, the stranger before
mentioned, but afterwards more frequently alone. These rides were
taken early in the morning, or by moonlight, on evenings when there
was no performance. The horse-riders laughed at the airs the
Marchese gave himself, attributed his extravagance to the generosity
of Fontaine, and twitted him with some secret intrigue, which he,
however, did not admit, and they took little pains to penetrate. Had
they followed his horse's hoof-track, they would have found that it
led, sometimes by one road, sometimes by another, to the bastide of
Anthony Noell the magistrate. And after a few days they would have
seen Vicenzo, his bridle over his arm, conversing earnestly, at a
small postern-gate of the garden, with the charming biondina,
whose bright countenance had greeted, like a good augury, their
first approach to Marseilles.
At last a night came when this stolen conversation lasted longer than
usual. Vicenzo was pressing, Florinda irresolute. Fontaine had
accompanied his friend, and held his horse in an adjacent lane,
whilst the lovers (for such they now were to be considered)
sauntered in a shrubbery walk within the park.
"But why this secrecy?" said the young girl, leaning tenderly upon
the arm of the handsome stroller. "Why not at once inform your
friends you accede to their wishes, in renouncing your present
derogatory pursuit? Why not present yourself to my father under
your real name and title? He loves his daughter too tenderly to
refuse his consent to a union on which her happiness depends."
"Dearest Florinda!" replied Vicenzo, "how could my ardent love abide
the delays this course would entail? How can you so cruelly urge me
thus to postpone my happiness? See you not how many obstacles to
our union the step you advise would raise up? Your father, unwilling
to part with his only daughter, (and such a daughter!) would
assuredly object to our immediate marriage—would make your
youth, my roving disposition, fifty other circumstances, pretexts for
putting it off. And did we succeed in overruling these, there still
would be a thousand tedious formalities to encounter,
correspondence between your father and my family, who are proud
as Lucifer of their ancient name and title, and would be wearisomely
punctilious. By my plan, we would avoid all long-winded
negotiations. Before daylight we are across the frontier; and before
that excellent Madame Verlé has adjusted her smart cap, and
buttered her first roll, my adored Florinda is Marchioness of
Monteleane. A letter to papa explains all; then away to Florence, and
in a month back to Marseilles, where you shall duly present me to
my respected father-in-law, and I, as in humility bound, will drop
upon my knees and crave pardon for running off with his treasure.
Papa gives his benediction, and curtain drops, leaving all parties
happy."
How often, with the feeble and irresolute, does a sorry jest pass for
a good argument! As Vicenzo rattled on, his victim looked up in his
face, and smiled at his soft and insidious words. Fascinated by
silvery tones and gaudy scales, the woman, as of old, gave ear to
the serpent.
"'Tis done," said the stroller, with a heartless smile, as he rode off
with Fontaine, half an hour later—"done. A post-chaise at midnight.
She brings her jewels—all the fortune she will ever bring me, I
suppose. No chance of drawing anything from the old gentleman?"
"Not much," replied Fontaine drily.
"Well, I must have another thousand from you, besides expenses.
And little enough too. Fifty yellow-boys for abandoning my place in
the troop. I was never in better cue for the ring. They are going to
Paris, and I should have joined Franconi."
"Oh!" said Fontaine, with a slight sneer, "a man of your abilities will
never lack employment. But we have no time to lose, if you are to
be back at midnight."
The two men spurred their horses, and galloped back to Marseilles.
A few minutes before twelve o'clock, a light posting-carriage was
drawn up, by the road-side, about a hundred yards beyond Anthony
Noell's garden. Vicenzo tapped thrice with his knuckles at the
postern door, which opened gently, and a trembling female form
emerged from the gloom of the shrubbery into the broad moonlight
without. Through the veil covering her head and face, a tear might
be seen glistening upon her cheek. She faltered, hesitated; her good
genius whispered her to pause. But an evil spirit was at hand, luring
her to destruction. Taking in one hand a casket, the real object of his
base desires, and with the other arm encircling her waist, the
seducer, murmuring soft flatteries in her ear, hurried Florinda down
the slope leading to the road. Confused and fascinated, the poor
weak girl had no power to resist. She reached the carriage, cast one
look back at her father's house, whose white walls shone amidst the
dark masses of foliage; the Florentine lifted her in, spoke a word to
the postilion, and the vehicle dashed away in the direction of the
Italian frontier.
So long as the carriage was in sight, Fontaine, who had
accompanied Vicenzo, sat motionless upon his saddle, watching its
career as it sped, like a large black insect, along the moonlit road.
Then, when distance hid it from his view, he turned his horse's head
and rode rapidly into Marseilles.

FOES AND FRIENDS.


Upon the second day after Florinda's elopement with her worthless
suitor, the large coffee-room of the Hotel de France, at Montauban,
was deserted, save by two guests. One of these was a man of about
fifty-five, but older in appearance, whose thin gray hair and stooping
figure, as well as the deep, anxious wrinkles and mournful
expression of his countenance, told a tale of cares and troubles,
borne with a rebellious rather than with a resigned spirit. The other
occupant of the apartment, who sat at its opposite extremity, and
was concealed, except upon near approach, by a sort of high
projecting counter, was much younger, for his age could hardly
exceed thirty years. A certain sober reserved expression, (hardly
amounting to austerity,) frequently observable in Roman Catholic
priests, and which sat becomingly enough upon his open intelligent
countenance, betrayed his profession as surely as some slight
clerical peculiarities of costume.
Suddenly a waiter entered the room, and approaching the old man
with an air of great respect, informed him that a gentleman,
seemingly just come off a journey, desired particularly to speak with
him. The person addressed raised his eyes, whose melancholy
expression corresponded with the furrows of his cheek, from the
Paris newspaper he was reading, and, in a voice at once harsh and
feeble, desired the stranger should be shown in. The order was
obeyed; and a person entered, wrapped in a cloak, whose collar was
turned up, concealing great part of his face. His countenance was
further obscured by the vizard of a travelling-cap, from beneath
which his long hair hung in disorder. Splashed and unshaven, he had
all the appearance of having travelled far and fast. The gentleman
whom he had asked to see rose from his seat on his approach, and
looked at him keenly, even uneasily, but evidently without
recognition. The waiter left the room. The stranger advanced to
within three paces of him he sought, and stood still and silent, his
features still masked by his cloak collar.
"Your business with me, sir?" said the old man quickly. "Whom have
I the honour to address?"
"I am an old acquaintance, Mr Anthony Noell," said the traveller, in a
sharp ironical tone, as he turned down his collar and displayed a
pale countenance, distorted by a malignant smile. "An old debtor
come to discharge the balance due. My errand to-day is to tell you
that you are childless. Your daughter Florinda, your last remaining
darling, has fled to Italy with a nameless vagabond and stroller."
At the very first word uttered by that voice, Noell had started and
shuddered, as at the sudden pang of exquisite torture. Then his
glassy eyes were horribly distended, his mouth opened, his whole
face was convulsed, and with a yell like that of some savage denizen
of the forest suddenly despoiled of its young, he sprang upon his
enemy and seized him by the throat.
"Murderer!" he cried. "Help! help!"
The waiters rushed into the room, and with difficulty freed the
stranger from the vice-like grasp of the old man, to whose feeble
hands frenzy gave strength. When at last they were separated, Noell
uttered one shriek of impotent fury and despair, and fell back
senseless in the servants' arms. The stranger, who himself seemed
weak and ailing, and who had sunk upon a chair, looked curiously
into his antagonist's face.
"He is mad," said he, with horrible composure and complacency;
"quite mad. Take him to his bed."
The waiters lifted up the insensible body, and carried it away. The
stranger leaned his elbows upon a table, and, covering his face with
his hands, remained for some minutes absorbed in thought. A slight
noise made him look up. The priest stood opposite to him, and
uttered his name.
"Dominique Lafon," he said, calmly but severely, "what is this thing
you have done? But you need not tell me. I know much, and can
conjecture the rest. Wretched man, know you not the word of God,
to whom is all vengeance, and who repayeth in his own good time?"
Dominique seemed surprised at hearing his name pronounced by a
stranger. He looked hard at the priest. And presently a name
connected with days of happiness and innocence broke from the lips
of the vindictive and pitiless man.
"Henry la Chapelle!"
It was indeed his former fellow-student, whom circumstances and
disposition had induced to abandon the study of the law and enter
the church. They had not met since Dominique departed from Paris
to receive the last sigh of his dying mother.
Who shall trace the secret springs whence flow the fountains of the
heart? For seven years Dominique Lafon had not wept. His captivity
and many sufferings, his father's death, all had been borne with a
bitter heart, but with dry eyes. But now, at sight of the comrade of
his youth, some hidden chord, long entombed, suddenly vibrated. A
sob burst from his bosom, and was succeeded by a gush of tears.
Henry la Chapelle looked sadly and kindly at his boyhood's friend.
"He who trusteth in himself," he said in low and gentle tones, "let
him take heed, lest his feet fall into the snares they despise. Alas!
Dominique, that you so soon forgot our last conversation! Alas! that
you have laid this sin to your soul! But those tears give me hope:
they are the early dew of penitence. Come, my friend, and seek
comfort where alone it may be found. Verily there is joy in heaven
over one repentant sinner, more than over many just men."
And the good priest drew his friend's arm through his, and led him
from the room.
Dominique's exclamation was prophetic. When Anthony Noell rose
from the bed of sickness to which grief consigned him, his intellects
were gone. He never recovered them, but passed the rest of his life
in helpless idiocy at his country-house, near Marseilles. There he was
sedulously and tenderly watched by the unhappy Florinda, who,
after a few miserable months passed with her reprobate seducer,
was released from farther ill-usage by the death of Vicenzo, stabbed
in Italy in a gambling brawl.
Not long after 1830, there died in a Sardinian convent, noted for its
ascetic observances and for the piety of its inmates, a French monk,
who went by the name of brother Ambrose. His death was
considered to be accelerated by the strictness with which he
followed the rigid rules of the order, from some of which his failing
health would have justified deviation, and by the frequency and
severity of his self-imposed penances. His body, feeble when first he
entered the convent, was no match for his courageous spirit. In
accordance with his dying request, his beads and breviary were sent
to a vicar named la Chapelle, then resident at Lyons. When that
excellent priest opened the book, he found the following words
inscribed upon a blank page:—
"Blessed be the Lord, for in Him have I peace and hope!"
And Henry la Chapelle kneeled down, and breathed a prayer for the
soul of his departed friend, Dominique Lafon.
PESTALOZZIANA.
"Etiam illud adjungo, sæpius ad laudem atque virtutem naturam
sine doctrinâ, quam sine naturâ valuisse doctrinam."—Cicero,
pro. Arch., 7.
"Que vous ai-je donc fait, O mes jeunes années!
Pour m'avoir fui si vite, me croyant satisfait?"

Victor Hugo, Odes.


For the abnormal, and, we must think, somewhat faulty education of
our later boyhood—a few random recollections of which we here
purpose to lay before the reader—our obligations, quantulœcunquœ
sint, are certainly due to prejudices which, though they have now
become antiquated and obsolete, were in full force some thirty years
ago, against the existing mode of education in England. Not that the
public—quâ public—were ever very far misled by the noisy
declamations of the Whigs on this their favourite theme: people for
the most part paid very little attention to the inuendoes of the
peripatetic schoolmaster, so carefully primed and sent "abroad" to
disabuse them; while not a few smiled to recognise under that
imposing misnomer a small self-opinionated clique—free traders in
everything else, but absolute monopolists here—who sought by its
aid to palm off on society the jocosa imago of their own crotchets,
as though in sympathetic response to a sentiment wholly proceeding
from itself. When much inflammatory "stuff" had been discharged
against the walls of our venerable institutions, not only without
setting Isis or Cam on fire, but plainly with some discomfitures to the
belligerents engaged, from the opposite party, who returned the
salute, John Bull began to open his eyes a little, and, as he opened
them, to doubt whether, after all, the promises and programmes he
had been reading of a spic-and-span new order of everything,
particularly of education, might not turn out a flam; and the authors
of them, who certainly showed off to most advantage on Edinburgh
Review days, prove anything but the best qualified persons to make
good their own vaticinations, or to bring in the new golden age they
had announced. Still, the crusade against English public seminaries,
though abortive in its principal design—that of exciting a general
defection from these institutions—was not quite barren of results. It
was so far successful, at least, as completely to unsettle for a time
the minds of not a few over-anxious parents, who, taught to regard
with suspicion the credentials of every schoolmaster "at home," were
beginning to make diligent inquiries for his successor among their
neighbours "abroad." To all who were in this frame of mind, the first
couleur de rose announcements of Pestalozzi's establishment at
Yverdun were news indeed! offering as they did—or at least seeming
to offer—the complete solution of a problem which could scarcely
have been entertained without much painful solicitude and anxiety.
"Here, then," for so ran the accounts of several trustworthy
eyewitnesses, educational amateurs, who had devoted a whole
morning to a most prying and probing dissection of the system
within the walls of the chateau itself, and putting down all the results
of their carefully conducted autopsy, "here was a school composed
of boys gathered from all parts of the habitable globe, where each,
by simply carrying over a little of his mother tongue, might, in a
short time, become a youthful Mezzofante, and take his choice of
many in return; a school which, wisely eschewing the routine service
of books, suffered neither dictionary, gradus, grammar, nor spelling-
book to be even seen on the premises; a school for morals, where,
in educating the head, the right training of the heart was never for a
moment neglected; a school for the progress of the mind, where
much discernment, blending itself with kindness, fostered the first
dawnings of the intellect, and carefully protected the feeble powers
of memory from being overtaxed—where delighted Alma, in the
progress of her development, might securely enjoy many privileges
and immunities wholly denied to her at home—where even
philosophy, stooping to conquer, had become sportive the better to
persuade; where the poet's vow was actually realised—the bodily
health being as diligently looked after as that of the mind or the
affections; lastly, where they found no fighting nor bullying, as at
home, but agriculture and gymnastics instituted in their stead." To
such encomiums on the school were added, and with more justice
and truth, a commendation on old Pestalozzi himself, the real
liberality of whose sentiments, and the overflowings of whose
paternal love, could not, it was argued, and did not, fail to prove
beneficial to all within the sphere of their influence. The weight of
such supposed advantages turned the scale for not a few just
entering into the pupillary state, and settled their future destination.
Our own training, hitherto auspiciously enough carried on under the
birchen discipline of Westminster, was suddenly stopt; the last silver
prize-penny had crossed our palm; the last quarterly half-crown tax
for birch had been paid into the treasury of the school; we were
called on to say an abrupt good-by to our friends, and to take a
formal leave of Dr P——. That ceremony was not a pleasing one;
and had the choice of a visit to Polyphemus in his cave, or to Dr P
—— in his study, been offered to us, the first would certainly have
had the preference; but as the case admitted neither evasion nor
compromise, necessity gave us courage to bolt into the august
presence of the formidable head-master, after lessons; and finding
presently that we had somehow managed to emerge again safe from
the dreaded interview, we invited several class-fellows to celebrate
so remarkable a day at a tuck-shop in the vicinity of Dean's Yard.
There, in unrestricted indulgence, did the party get through, there
was no telling how many "lady's-fingers," tarts, and cheese-cakes,
and drank—there was no counting the corks of empty ginger-beer
bottles. When these delicacies had lost their relish—και ἑξ ἑρον ἑντο
—the time was come for making a distribution of our personal
effects. First went our bag of "taws" and "alleys," pro bono publico,
in a general scramble, and then a Jew's-harp for whoever could
twang it; and out or one pocket came a cricket-ball for A, and out of
another a peg-top for B; and then there was a hockey-stick for M,
and a red leathern satchel, with book-strap, for N, and three books
a-piece to two class-chums, who ended with a toss-up for Virgil. And
now, being fairly cleaned out, after reiterated good-bys and shakes
of the hand given and taken at the shop door, we parted, (many of
us never to meet again,) they to enjoy the remainder of a half-
holiday in the hockey-court, while we walked home through the
park, stopping in the midst of its ruminating cows, ourself to
ruminate a little upon the future, and to wonder, unheard, what sort
of a place Switzerland might be, and what sort of a man Pestalozzi!
These adieus to old Westminster took place on a Saturday; and the
following Monday found us already en route with our excellent father
for the new settlement at Yverdun. The school to which we were
then travelling, and the venerable man who presided over it, have
both been long since defunct—de mortuis nil nisi bonum; and
gratitude itself forbids that we should speak either of one or of the
other with harshness or disrespect; of a place where we certainly
spent some very happy, if not the happiest, days of life; of him who
—rightly named the father of the establishment—ever treated us,
and all with whom he had to do, with a uniform gentleness and
impartiality. To tell ill-natured tales out of school—of such a school,
and after so long a period too—would indeed argue ill for any one's
charity, and accordingly we do not intend to try it. But though the
feeling of the alumnus may not permit us to think unfavourably of
the Pensionat Pestalozzi, we shall not, on that account, suppress the
mention of some occasional hardships and inconveniences
experienced there, much less allow a word of reproach to escape our
pen. The reader, with no such sympathies to restrain his curiosity,
will no doubt expect, if not a detailed account, some outline or
general ground-plan of the system, which, alas! we cannot give him;
our endeavour to comprehend it as a digested whole—proceeding on
certain data, aiming at certain ends, and pursuing them by certain
means—has been entirely unsuccessful; and therefore, if pressed for
more than we can tell, our answer must be, in the words of Cicero,
Deprecor ne me tanquam philosophum putet scholam sibi istam,
explicaturum.[14] But though unable to make out—if, indeed, there
were any spirit of unity to be made out—in Pestalozzi's scheme,
there were certain manifest imperfections in the composition of his
plan of education—improprieties to which the longest familiarity
could scarcely reconcile, nor the warmest partiality blind even the
most determined partisan. In the first place—to state them at once,
and have done with the unpleasing office of finding fault—it always
struck us as a capital error, in a school where books were not
allowed, to suffer almost the whole teaching of the classes to
devolve upon some leading member of each; for what, in fact, could
self-taught lads be expected to teach, unless it were to make a ring
or a row—to fish, to whistle, or to skate? Of course, any graver kind
of information, conveyed by an infant prodigy to his gaping pupils,
must have lacked the necessary precision to make it available to
them: first, because he would very seldom be sufficiently possessed
of it himself; and secondly, because a boy's imperfect vocabulary
and inexperience render him at all times a decidedly bad interpreter
even of what he may really know. In place of proving real lights,
these little Jack-o'-Lanterns of ours tended rather to perplex the path
of the inquiring, and to impede their progress; and when an appeal
was made to the master, as was sometimes done, the master—
brought up in the same vague, bookless manner, and knowing
nothing more accurately, though he might know more than his
puzzle-pated pupils—was very seldom able to give them a lift out of
the quagmire, where they accordingly would stick, and flounder
away till the end of the lesson. It was amusing to see how a boy, so
soon as he got but a glimpse of a subject before the class, and could
give but the ghost of a reason for what he was eager to prelect
upon, became incontinent of the bright discovery, till all his
companions had had the full benefit of it, with much that was
irrelevant besides. The mischiefs which, it would occur to any one's
mind, were likely to result in after life from such desultory habits of
application in boyhood, actually did result to many of us a few years
later at college. It was at once painful and difficult to indoctrinate
indocile minds like ours into the accurate and severe habits of
university discipline. On entering the lists for honours with other
young aspirants, educated in the usual way at home, we were as a
herd of unbroken colts pitted against well-trained racers: neither had
yet run for the prize—in that single particular the cases were the
same; but when degree and race day came, on whose side lay the
odds? On theirs who had been left to try an untutored strength in
scampering over a wild common, at will, for years, or with those
who, by daily exercise in the manège of a public school, had been
trained to bear harness, and were, besides, well acquainted with the
ground? Another unquestionable error in the system was the
absence of emulation, which, from some strange misconception and
worse application of a text in St Paul, was proscribed as an
unchristian principle; in lieu of which, we were to be brought—
though we never were brought, but that was the object aimed at—to
love learning for its own sake, and to prove ourselves anxious of
excelling without a motive, or to be good for nothing, as Hood has
somewhere phrased it.

"Nunquam præponens se aliis, ITA facillime


Sine invidia invenias laudem,"

says Terence, and it will be so where envy and conceit have


supplanted emulation: yet are the feelings perfectly distinct; and we
think it behoves all those who contend that every striving for the
mastery is prohibited by the gospel, to show how communism in
inferiority, or socialism in dulness, are likely to improve morals or
mend society. Take from a schoolboy the motive of rewards and
punishments, and you deprive him of that incentive by which your
own conduct through life is regulated, and that by which God has
thought fit, in the moral government of his rational creatures, to
promote the practice of good works, and to discourage and dissuade
from evil. Nor did that which sounds thus ominously in theory
succeed in its application better than it sounded. In fact, nothing
more unfortunate could have been devised for all parties, but
especially for such as were by nature of a studious turn or of quicker
parts than the rest; who, finding the ordinary stimulus to exertion
thus removed, and none other to replace it, no longer cared to do
well, (why should they, when they knew that their feeblest efforts
would transcend their slow-paced comrades' best?) but, gradually
abandoning themselves to the vis inertiæ of sloth, incompetence,
and bad example, did no more than they could help; repressing the
spirit of rivalry and emulation, which had no issue in the school, to
show it in some of those feats of agility or address, which the
rigorous enactment of gymnastic exercises imposed on all alike, and
in the performance of which we certainly did pride ourselves, and
eagerly sought to eclipse each other in exhibiting any natural or
acquired superiority we might possess. The absence of all
elementary books of instruction throughout the school, presented
another barrier in the way of improvement still more formidable than
even the bétise of boy pedagogues, the want of sufficient stimulus
to exertion, or the absurd respect paid sometimes to natural
incapacity, and sometimes even to idleness. Those who had no rules
to learn had of course none to apply when they wanted them; no
masters could have adequately supplied this deficiency, and those of
the chateau were certainly not the men to remedy the evil. As might
therefore have been anticipated, the young Pestalozzian's ideas,
whether innate or acquired, and on every subject, became sadly
vague and confused, and his grammar of a piece with his
knowledge. We would have been conspicuous, even amongst other
boys, for what seemed almost a studied impropriety of language;
but it was, in fact, nothing more than the unavoidable result of
natural indolence and inattention, uncoerced by proper discipline.
The old man's slouching gait and ungraceful attire afforded but too
apt an illustration of the intellectual nonchalance of his pupils. As to
the modern languages, of which so much has been said by those
who knew so little of the matter, they were in parlance, to be sure—
but how spoken? Alas! besides an open violation of all the concords,
and a general disregard of syntax, they failed where one would have
thought them least likely to fail, in correctness of idiom and accent.
The French—this was the language of the school—abounded in
conventional phrases, woven into its texture from various foreign
sources, German, English, or Italian, and in scores of barbarous
words—not to be found in the Dictionnaire de l'Academie, certainly,
but quite current in the many-tongued vernacular of the chateau.
Our pronunciation remained unequivocally John Bullish to the end—
not one of us ever caught or thought of catching the right
intonation; and, whether the fault originated merely in want of ear,
or that we could not make the right use of our noses, it is quite
certain that all of us had either no accent or a wrong one. The
German was as bad as the French: it was a Swiss, not a German,
abounding in patois phrases and provincialisms—in short, a most
hybrid affair, to say nothing of its being as much over-guttural as the
last was sub-nasal. With regard to Spanish and Italian, as the
English did not consort with either of these nations, all they ever
acquired of their languages were such oaths and mauvais mots as
parrots pick up from sailors aboard ship, which they repeated with
all the innocence of parrots. Thus, then, the opportunities offered for
the acquisition of modern languages were plainly defective; and
when it is further considered that the dead languages remained
untaught—nay, were literally unknown, except to a small section of
the school, for whom a kind Providence had sent a valued friend and
preceptor in Dr M——, (whose neat Greek characters were stared at
as cabalistical by the other masters of the Pensionat,)—and finally,
that our very English became at last defiled and corrupted, by the
introduction of a variety of foreign idioms, it will be seen that for any
advantage likely to accrue from the polyglot character of the
institution, the Tower of Babel would, in fact, have furnished every
whit as good a school for languages as did our turreted chateau.
And now, if candour has compelled this notice of some, it must be
admitted, serious blemishes in the system of old Pestalozzi, where is
the academy without them?

"Whoever hopes a faultless school to see,


Hopes what ne'er was, nor is, nor is to be."

Meanwhile the Swiss Pension was not without solid advantages, and
might justly lay claim to some regard, if not as a school for learning,
at least as a moral school; its inmates for the most part spoke truth,
respected property, eschewed mischief, were neither puppies, nor
bullies, nor talebearers. There were, of course, exceptions to all this,
but then they were exceptions; nor was the number at any time
sufficient to invalidate the general rule, or to corrupt the better
principle. Perhaps a ten hours' daily attendance in class, coarse
spare diet, hardy and somewhat severe training, may be considered
by the reader as offering some explanation of our general propriety
of behaviour. It may be so; but we are by no means willing to admit,
that the really high moral tone of the school depended either upon
gymnastic exercises or short commons, nor yet arose from the want
of facilities for getting into scrapes, for here, as elsewhere, where
there is the will, there is ever a way. We believe it to have originated
from another source—in a word, from the encouragement held out
to the study of natural history, and the eagerness with which that
study was taken up and pursued by the school in consequence.
Though Pestalozzi might not succeed in making his disciples
scholars, he certainly succeeded in making many among them
naturalists; and of the two—let us ask it without offence—whether is
he the happier lad (to say nothing of the future man) who can
fabricate faultless pentameters and immaculate iambics to order; or
he who, already absorbed in scanning the wonders of creation,
seeks with unflagging diligence and zeal to know more and more of
the visible works of the great Poet of Nature? "Sæpius sane ad
laudem atque virtutem naturam sine doctrinâ, quam sine naturâ
valuisse doctrinam;" which words being Cicero's, deny them, sir, if
you please.
The Pension, during the period of our sojourn at Yverdun, contained
about a hundred and eighty élèves, natives of every European and
of some Oriental states, whose primitive mode of distribution into
classes, according to age and acquirements, during school hours,
was completely changed in playtime, when the boys, finding it easier
to speak their own tongue than to acquire a new one, divided
themselves into separate groups according to their respective
nations. The English would occasionally admit a German or a
Prussian to their coterie; but that was a favour seldom conferred
upon any other foreigner: for the Spaniards, who were certainly the
least well-conducted of the whole community, did not deserve it:
among them were to be found the litigious, the mischief-makers, the
quarrellers, and—for, as has been hinted, we were not all honest—
the exceptional thieves. The Italians we could never make out, nor
they us: we had no sympathy with Pole or Greek; the Swiss we
positively did not like, and the French just as positively did not like
us; so how could it be otherwise? The ushers, for the most part
trained up in the school, were an obliging set of men, with little
refinement, less pretension, and wholly without learning. A distich
from Crabbe describes them perfectly—
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like