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

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

Math Adventures with Python is an illustrated guide that teaches readers how to use programming to explore mathematical concepts such as algebra, trigonometry, and fractals using Python. The book includes practical exercises and examples to visualize solutions and automate tasks, making math engaging and relevant. Author Peter Farrell, a math and computer science teacher, aims to enhance math education through technology.

Uploaded by

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

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

Math Adventures with Python is an illustrated guide that teaches readers how to use programming to explore mathematical concepts such as algebra, trigonometry, and fractals using Python. The book includes practical exercises and examples to visualize solutions and automate tasks, making math engaging and relevant. Author Peter Farrell, a math and computer science teacher, aims to enhance math education through technology.

Uploaded by

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

Math Adventures with Python An Illustrated Guide

to Exploring Math with Code 1st Edition Peter


Farrell pdf download

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

Download more ebook from https://textbookfull.com


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

Practical Business Math Procedures [with Business Math


Handbook] Jeffrey Slater

https://textbookfull.com/product/practical-business-math-
procedures-with-business-math-handbook-jeffrey-slater/

Doing Math with Python Use Programming to Explore


Algebra Statistics Calculus and More 1st Edition Amit
Saha

https://textbookfull.com/product/doing-math-with-python-use-
programming-to-explore-algebra-statistics-calculus-and-more-1st-
edition-amit-saha/

Math for Programmers: 3D Graphics, Machine Learning and


Simulations with Python 1st Edition Paul Orland

https://textbookfull.com/product/math-for-
programmers-3d-graphics-machine-learning-and-simulations-with-
python-1st-edition-paul-orland/

Math for Programmers 3D graphics machine learning and


simulations with Python 1st Edition Paul Orland

https://textbookfull.com/product/math-for-
programmers-3d-graphics-machine-learning-and-simulations-with-
python-1st-edition-paul-orland-2/
Begin to Code with Python Rob Miles

https://textbookfull.com/product/begin-to-code-with-python-rob-
miles/

Learn to program with Small Basic an introduction to


programming with games art science and math Early
Access 1st Edition Marji

https://textbookfull.com/product/learn-to-program-with-small-
basic-an-introduction-to-programming-with-games-art-science-and-
math-early-access-1st-edition-marji/

Help Your Kids with Math revised edition Dk

https://textbookfull.com/product/help-your-kids-with-math-
revised-edition-dk/

Math for Programmers 3D graphics machine learning and


simulations with Python MEAP V10 1st Edition Paul
Orland

https://textbookfull.com/product/math-for-
programmers-3d-graphics-machine-learning-and-simulations-with-
python-meap-v10-1st-edition-paul-orland/

Math smart the savvy student s guide to mastering basic


math Penguin Random House

https://textbookfull.com/product/math-smart-the-savvy-student-s-
guide-to-mastering-basic-math-penguin-random-house/
MAKE MATH

M AT H A D V E N T U R E S
COVERS
COME ALIVE
PYTHON 3
WITH PYTHON

WITH PY THON

M AT H A DV E N T UR E S W I T H PY T HON
A N I L L U S T R A T E D G U I D E T O
Math Adventures with Python will show you how to • Use recursion to create fractals like the Koch
harness the power of programming to keep math snowflake and the Sierpinski triangle E X P L O R I N G M A T H W I T H C O D E
relevant and fun. With the aid of the Python program-
• Generate virtual sheep that graze on grass and
ming language, you’ll learn how to visualize solutions
multiply autonomously
to a range of math problems as you use code to explore
key mathematical concepts like algebra, trigonometry, • Crack secret codes using genetic algorithms PETER FARRELL
matrices, and cellular automata.
As you work through the book’s numerous examples
Once you’ve learned programming basics like loops and increasingly challenging exercises, you’ll code
and variables, you’ll write your own programs to solve your own solutions, create beautiful visualizations,
equations quickly, make cool things like an interactive and see just how much more fun math can be!
rainbow grid, and automate tedious tasks like factoring
ABOUT THE AUTHOR
numbers and finding square roots. You’ll learn how to
write functions to draw and manipulate shapes, create Peter Farrell is a math and computer science teacher
oscillating sine waves, and solve equations graphically. with a passion for customizing (”hacking”) math
education and learning with technology. He lives in
You’ll also learn how to:
the San Francisco Bay Area with his wife and children.
• Draw and transform 2D and 3D graphics with
matrices

• Make colorful designs like the Mandelbrot and


Julia sets with complex numbers

T H E F I N E ST I N G E E K E N T E RTA I N M E N T ™
FARRELL

w w w.nostarch.com
$29.95 ($39.95 CDN)
LANGUAGES/PYTHON
SHELVE IN: PROGRAMMING

“ I L I E F L AT .”
This book uses a durable binding that won’t snap shut.
Math Adventures
with Python
Math
Adventu res
with Py thon
A n I llu s t r at e d G u i d e to
E x p l o r i n g M at h w it h C o d e

b y P e t e r Fa r r e ll

San Francisco
Math Adventures with Python. Copyright © 2019 by Peter Farrell.

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 any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.

ISBN-10: 1-59327-867-5
ISBN-13: 978-1-59327-867-0

Publisher: William Pollock


Production Editor: Meg Sneeringer
Cover Illustration: Josh Ellingson
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; [email protected]
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.
This book is dedicated to all my students,
from whom I’ve learned so much.
About the Author
Peter Farrell was a math teacher for eight years, starting first as
a Peace Corps volunteer in Kenya. He then worked as a computer
science teacher for three years. After reading Seymour Papert’s
Mindstorms and being introduced to Python by a student, he was
inspired to bring programming into math class. He is passionate
about using computers to make learning math more relevant, fun,
and challenging.

About the Technical Reviewer


Paddy Gaunt graduated in engineering within weeks of the birth
of the IBM PC and its associated MS DOS. Much of the rest of his
career has revolved around implementing mathematical or tech-
nical concepts in practical software. Recently, he reformed links
with Cambridge University (UK) when he became lead developer
of pi3d, a python module for 3D graphics initially designed to run
on the Raspberry Pi computer.
B ri e f Co nte nts

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

Part I: Hitchin' Up Your Python Wagon


Chapter 1: Drawing Polygons with the Turtle Module . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2: Making Tedious Arithmetic Fun with Lists and Loops . . . . . . . . . . . . . . . . . . 19
Chapter 3: Guessing and Checking with Conditionals . . . . . . . . . . . . . . . . . . . . . . . . . 37

Part 2: Riding into Math Territory


Chapter 4: Transforming and Storing Numbers with Algebra . . . . . . . . . . . . . . . . . . . . 53
Chapter 5: Transforming Shapes with Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Chapter 6: Creating Oscillations with Trigonometry . . . . . . . . . . . . . . . . . . . . . . . . . 103
Chapter 7: Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Chapter 8: Using Matrices for Computer Graphics and Systems of Equations . . . . . . . . 145

Part 3: Blazing Your Own Trail


Chapter 9: Building Objects with Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Chapter 10: Creating Fractals Using Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Chapter 11: Cellular Automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Chapter 12: Solving Problems Using Genetic Algorithms . . . . . . . . . . . . . . . . . . . . . . 247

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Co nte nts i n Detai l

Acknowledgments xv

Introduction xvii
The Problem with School Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Who Should Use This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
What's in This Book? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Downloading and Installing Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Starting IDLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Installing Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

Part I: Hitchin' Up Your Python Wagon

1
Drawing Polygons with the Turtle module 3
Python’s turtle Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Importing the turtle Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Moving Your Turtle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Changing Directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Repeating Code with Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Using the for Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Using a for Loop to Draw a Square . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Creating Shortcuts with Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Using Variables to Draw Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Using Variables in Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Variable Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Equilateral Triangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Writing the triangle() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Making Variables Vary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2
Making Tedious Arithmetic Fun
with Lists and Loops 19
Basic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Operating on Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Using Operators to Write the average() Function . . . . . . . . . . . . . . . . . . . . . . 21
Mind the Order of Operations! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Using Parentheses with Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Data Types in Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Integers and Floats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Booleans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Checking Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Using Lists to Store Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Adding Items to a List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Operating on Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Removing Items from a List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Using Lists in Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Accessing Individual Items with List Indices . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Accessing Index and Value with enumerate() . . . . . . . . . . . . . . . . . . . . . . . . . 29
Indices Start at Zero . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Accessing a Range of List Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Finding Out the Index of an Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Strings Use Indices, Too . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Summation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Creating the running_sum Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Writing the mySum() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Finding the Average of a List of Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

3
Guessing and Checking with Conditionals 37
Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Making Decisions with if and else Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Using Conditionals to Find Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Writing the factors.py Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
The Wandering Turtle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Creating a Number-Guessing Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Making a Random Number Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Taking User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Converting User Input to Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Using Conditionals to Check for a Correct Guess . . . . . . . . . . . . . . . . . . . . . . 45
Using a Loop to Guess Again! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Tips for Guessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Finding Square Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Applying the Number-Guessing Game Logic . . . . . . . . . . . . . . . . . . . . . . . . . 48
Writing the squareRoot() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

x   Contents in Detail
Part 2: Riding into Math Territory

4
Transforming and Storing Numbers
with Algebra 53
Solving First-Degree Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Finding the Formula for First-Degree Equations . . . . . . . . . . . . . . . . . . . . . . . . 55
Writing the equation() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Using print() Instead of return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Solving Higher-Degree Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Using quad() to Solve Quadratic Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Using plug() to Solve a Cubic Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Solving Equations Graphically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Getting Started with Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Creating Your Own Graphing Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Graphing an Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Using Guess and Check to Find the Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Writing the guess() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

5
Transforming Shapes with Geometry 77
Drawing a Circle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Specifying Location Using Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Transformation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Translating Objects with translate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Rotating Objects with rotate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Drawing a Circle of Circles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Drawing a Circle of Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Animating Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Creating the t Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Rotating the Individual Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Saving Orientation with pushMatrix() and popMatrix() . . . . . . . . . . . . . . . . . . 88
Rotating Around the Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Creating an Interactive Rainbow Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Drawing a Grid of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Adding the Rainbow Color to Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Drawing Complex Patterns Using Triangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
A 30-60-90 Triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Drawing an Equilateral Triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Drawing Multiple Rotating Triangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Phase-Shifting the Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Finalizing the Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

Contents in Detail   xi
6
Creating Oscillations with Trigonometry 103
Using Trigonometry for Rotations and Oscillations . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Writing Functions to Draw Polygons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Drawing a Hexagon with Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Drawing an Equilateral Triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Making Sine Waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Leaving a Trail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Using Python’s Built-in enumerate() Function . . . . . . . . . . . . . . . . . . . . . . . . . 114
Creating a Spirograph Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Drawing the Smaller Circle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Rotating the Smaller Circle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Making Harmonographs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Writing the harmonograph Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Filling the List Instantly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Two Pendulums Are Better Than One . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

7
Complex Numbers 127
The Complex Coordinate System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Adding Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Multiplying a Complex Number by i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Multiplying Two Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Writing the magnitude() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Creating the Mandelbrot Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Writing the mandelbrot() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Adding Color to the Mandelbrot Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Creating the Julia Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Writing the julia() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

8
Using Matrices for Computer Graphics
and Systems of Equations 145
What Is a Matrix? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Adding Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Multiplying Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Order Matters in Matrix Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Drawing 2D Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Transforming Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Transposing Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Rotating Matrices in Real Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Creating 3D Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Creating the Rotation Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Solving Systems of Equations with Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Gaussian Elimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Writing the gauss() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

xii   Contents in Detail
Part 3: Blazing Your Own Trail

9
Building Objects with Classes 175
Bouncing Ball Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Making the Ball Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Making the Ball Bounce Off the Wall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Making Multiple Balls Without Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Creating Objects Using Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Grazing Sheep Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Writing the Class for the Sheep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Programming Sheep to Move Around . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Creating the energy Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Creating Grass Using Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Making the Grass Brown when Eaten . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Giving Each Sheep a Random Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Programming Sheep to Reproduce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Letting the Grass Regrow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Providing an Evolutionary Advantage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

10
Creating Fractals Using Recursion 201
The Length of a Coastline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
What Is Recursion? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Writing the factorial() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Building a Fractal Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Koch Snowflake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Writing the segment() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Sierpinski Triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Square Fractal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Dragon Curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

11
Cellular Automata 225
Creating a Cellular Automaton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Writing a Cell Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Resizing Each Cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Making a CA Grow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Putting the Cells into a Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Creating the Cell List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Python Lists Are Strange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
List Index Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Letting Your CA Grow Automatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Playing the Game of Life . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
The Elementary Cellular Automaton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246

Contents in Detail   xiii
12
Solving Problems Using Genetic Algorithms 247
Using a Genetic Algorithm to Guess Phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Writing the makeList() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Testing the makeList() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Writing the score() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Writing the mutate() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Generating a Random Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Solving the Traveling Salesperson Problem (TSP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Using Genetic Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Writing the calcLength() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Testing the calcLength() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Random Routes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Applying the Phrase-Guessing Mutation Idea . . . . . . . . . . . . . . . . . . . . . . . . 265
Mutating Two Numbers in a List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Crossing Over to Improve Routes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271

Index 273

xiv   Contents in Detail
Ackn owle dg m e nts

I’d like to thank Don “The Mathman” Cohen for showing me how fun and
challenging learning real math can be; Seymour Papert for proving that
coding belongs in math class; Mark Miller for giving me a chance to put
my ideas into action; Hansel Lynn and Wayne Teng of theCoderSchool,
who let me continue to have fun coding with students; and Ken Hawthorn
for sharing my projects at his school. Thank you to my No Starch editors,
Annie Choi, Liz Chadwick, and Meg Sneeringer, for all your help making
this a much better book, and to Paddy Gaunt, whose input is visible all
over this book. This book wouldn’t exist without you all. Thank you to
everybody who said no—you gave me the energy to keep going. Finally,
thank you to Lucy for always believing in me.
I ntro du ctio n

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.
This method requires a lot of reading and odd sym-
bols. You’d never guess this had anything to do with
geometric figures. In fact, this text explains how to
find the centroid, or the center, of a triangle. But tradi-
tional approaches like this don’t tell us why we should
be interested in finding the center of a t­ riangle 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 geom-
etry 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 explor-
ing math with programming allows for many ways to solve interesting
problems, with many unforeseen mistakes and opportunities for improve-
ments 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 his-
tory classes might mean students write papers or give presentations, and
science students perform experiments, but what do math students do? It

xviii   Introduction
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 sim-
ply define the function f(x) and 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 solu-
tions 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,

Introduction   xix
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 discov-
ery. 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 rel-
evant, while still being challenging. You’ll make graphs to show all the pos-
sible 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!

xx   Introduction
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 alge-
bra. 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
turtle module.
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.

Introduction   xxi
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 num-
bers 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 pro-
gram 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

xxii   Introduction
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
Figure 5: Click the down­
shown in Figure 5.
loaded file to start the
Follow the directions, and always choose the install
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.

Introduction   xxiii
Go to https://processing.org/download/ and choose your operating system,
as shown in Figure 8.

Figure 8: The Processing website

Download the installer for


your operating system by click-
ing it and following the instruc-
tions. 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!

Figure 9: Where to find other Processing


modes, like the Python mode we’ll be using

xxiv   Introduction
Part I
Hitchin' Up
Your Python
Wagon
Dr awi n g Po lyg o n s with
1
th e Tu rtle m o du le

Centuries ago a Westerner heard a Hindu say the Earth


rested on the back of a turtle. When asked what the turtle was
standing on, the Hindu explained, “It’s turtles all the way down.”

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, vari-
ables, 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 fea-
tures and get a taste of what you’ll be able to create
with programming.
Discovering Diverse Content Through
Random Scribd Documents
stands. Then it runs for another five miles on a high plateau till it
ends at the hill city of Volseni, which stands on the edge of the
plateau, looking down on Lake Talti and across to Dobrava in the
plain opposite.
Beyond Volseni there is no road in the proper sense, but only cart or
bridle-tracks. Of these the principal and most frequented runs
diagonally across the valley in which Lake Talti lies, is interrupted by
the lake (at that point about a mile and a half wide), and then meets
the road from Dobrava half-way up St. Peter's Pass, and about
twenty miles across-country from Volseni. It thus forms the base of
a rough and irregular triangle of country, with the point where the
Slavna road bisects, the Pass and Volseni marking its three angles.
Lake Talti is set in the middle, backed by a chain of hills continuous
everywhere except at the indentation of the Pass.
Though so near to Slavna in actual distance, the country is very
different from the fertile river-valley which surrounds the capital; it is
bleak and rough, a land of hill pastures and mountain woods. Its
natural features are reflected in the character of the inhabitants. The
men who count Volseni a local capital are hardier than the men of
Slavna, less given to luxury, less addicted to quarrels and riots, but
considerably more formidable opponents if once they take up arms.
For this reason, no less than on account of their devotion to him, the
Prince did well to choose this country as the recruiting-ground for his
new force of gunners.
The Prince had been at Praslok for a week when Sophy set out to
join him there. At the last moment, Zerkovitch decided to remain in
Slavna, at least until the Court made its promised move to Dobrava:
reassuring as Dr. Natcheff was, it would do no harm to have a
friendly pair of eyes and ears in the capital so long as the King
remained in residence. Thus the two ladies were accompanied only
by Peter Vassip, whom the Prince had sent to escort them. They set
out in a heavy travelling-carriage at ten in the morning, reckoning to
reach the Castle before evening fell; their progress would never be
rapid, and for the last five miles exceedingly slow. They left the
capital in complete tranquillity, and when Sophy settled her bill at
the sign of the Silver Cock, and bade farewell to old Meyerstein, her
landlord, he expressed the hope that she would soon be back,
though, indeed, his poor house was, he feared, no fit quarters for
the Baroness Dobrava.
"I don't know whether I shall come back here, but I can never forget
your house. I shall always love it in my memory," said Sophy.
Max von Hollbrandt had obtained leave of absence from his
Legation, and had accompanied the Prince to Praslok. The two were
friends, having many tastes in common, and not least the taste for
soldiering. Besides having the pleasure of his company, the Prince
looked to obtain valuable aid from Max in the task on which he was
engaged. The young German was amused and delighted with his
expedition. Praslok is a primitive old place. It stands on an abrupt
mound, or knob, of ground by the road-side. So steep and sudden is
the ascent, that it was necessary to build a massive causeway of
wood—an inclined plane—to lead up from the road to the gate of
the square tower which forms the front of the building; the
causeway has cross-bars at short intervals, to give foothold to the
horses which, in old days, were stabled within the walls. Recently,
however, modern stables had been built on the other side of the
road, and it had become the custom to mount the causeway and
enter the Castle on foot.
Within, the arrangements were quaint and very simple. Besides the
tower already mentioned, which contained the dining-room and two
bedrooms above it, the whole building, strictly conditioned by the
shape of the hill on which it stood, consisted of three rows of small
rooms on the ground-floor. In one row lived the Prince and his male
guests, in the second the servants, in the third the guard. The ladies
were to be accommodated in the tower above the dining-room. The
rows of rooms opened on a covered walk or cloister, which ran round
the inner court of the Castle. The whole was solidly built of gray
stone—a business-like old hill-fortress, strong by reason of its
massive masonry and of the position in which it stood. Considered
as a modern residence—it had to be treated humorously—so Max
declared, and found much pleasure in it from that point of view. The
Prince, always indifferent to physical comfort, and ever averse from
luxury, probably did not realize how much his ancestral stronghold
demanded of his guests' indulgence. Old Vassip, Peter's father, was
major-domo—always in his sheepskin coat and high boots. His old
wife was cook. Half a dozen servants completed the establishment,
and of these three were grooms. The horses, in fact, seemed to Max
the only creatures whose comforts were at all on a modern footing.
But the Prince was entirely satisfied, and never so happy anywhere
as at Praslok. He loved the simple, hardy life; he loved even more,
though perhaps less consciously, the sense of being among friends.
He would not yield an inch to court popularity in Slavna; but his
heart went out to meet the unsought devotion of Volseni, the
mountain town, and its surrounding villages. Distant and self-
restrained in Slavna, here he was open, gay, and full of an almost
boyish ardor.
"It's worth coming here, just to see its effect on you," Max told him,
as the two rode back together from Volseni on the day of Sophy's
arrival. They had been at work, and the recruiting promised well.
The Prince laughed gayly. "Coming here from Slavna is like fresh air
after an oven," he said. "No need to watch your tongue—or other
people's! You can laugh when you like, and frown when you like,
without a dozen people asking what's your motive for doing it."
"But, really, you shouldn't have chosen a diplomatist for your
companion, sir, if you feel like that."
"I haven't," he smiled. "I've left the diplomatist down there and
brought the soldier up. And now that the ladies are coming—"
"Ah, now we must watch our tongues a little bit! Madame Zerkovitch
is very pretty—and the Baroness might make me absolutely
poetical!"
Least prying of men, yet Max von Hollbrandt could not resist sending
with this speech a glance at his companion—the visit of the
Baroness compelled this much tribute to curiosity. But the Prince's
face was a picture of unembarrassed pleasure.
"Then be poetical! We'll all be poetical!" he cried, merrily. "In the
intervals of drilling, be it understood!" he added, with a laugh.
Into this atmosphere, physical and moral—the exhilaration of keen
mountain breezes, the brightness of a winter sun, the play of high
hopes and of high spirit—came Sophy, with all her power of enjoying
and her ardor in imagining. Her mind leaped from the sad embraces
of the past, to fly to the arms of the present, to beckon gladly to the
future. No more than this had yet emerged into consciousness; she
was not yet asking how, for good or evil, she stood or was to stand
towards the Prince. Fortune had done wonderful things for her, and
was doing more yet. That was enough, and beyond that, for the
moment, she was not driven.
The mixture of poetry and drilling suited her to perfection. She got
both when she rode over to Volseni with the Prince. Crisp snow
covered the ground, and covered, too, the roofs of the old, gray, hill-
side city—long, sloping roofs, with here and there a round-tower
with a snow-clad extinguisher atop. The town was no more than one
long street, which bayed out at the farther end into a market-place.
It stood with its back against a mountain-side, defended on the
other three sides by a sturdy wall, which only now, after five
centuries, began to crumble away at the top.
At the city-gate bread and salt were brought to the Bailiff and his
companion, and she and he rode side by side down the long street
to the market-place. Here were two or three hundred, tall, fine
fellows, waiting their leader. Drill had not yet brought formality; on
the sight of him they gave a cheer and ran to form a ring about him.
Many caught his hand and pressed or kissed it. But Sophy, too,
claimed their eyes. It was very cold; she wore a short jacket of sable
over her habit, and a round cap of the same fur—gifts of Lady Meg's
in the days of her benevolence. She was at the pitch of pleasure and
excitement.
In a moment, a quick-witted fellow divined who she was. "The lady
who saved him! The lady who saved him!" he cried, at the full pitch
of his voice. The Prince drew himself up in the saddle and saluted
her. "Yes, the lady who saved me," he said. Sophy had the cheers
now, and they mounted to her head with fumes of intoxication. It
may be guessed how the Red Star glowed!
"And you'll save him, if need be?" she cried—quite indiscreetly. The
Prince smiled and shook his head, but the answer was an enraptured
cheer. The hatred of Slavna was a recommendation to Volseni's
increased regard, the hint of danger a match to its fiery enthusiasm.
"A favor, Bailiff, a favor!" cried a young man of distinguished
appearance. He seemed to be well known and to carry weight, for
there were shouts of "Hear Lukovitch! Hear Lukovitch!"—and one
called, with a laugh: "Ay, listen to the Wolf!"
"What is it, Lukovitch?" asked the Prince.
"Make the lady of our company, Bailiff." New cheers were raised.
"Make her a lieutenant of our artillery."
Sophy laughed gayly.
"I have His Majesty's authority to choose my officers," said the
Prince, smiling. "Baroness, will you be a lieutenant, and wear our
sheepskins in place of your sables there?"
"It is your uniform, Monseigneur," Sophy answered, bowing her
head.
Lukovitch sprang forward and kissed her hand.
"For our Bailiff's preserver as for our Bailiff, men of Volseni!" he
cried, loudly. The answering cheer brought tears to Sophy's sparkling
eyes. For a moment she could not see her Prince nor the men who
thus took her to their hearts.
Suddenly, in the midst of her exultation, she saw a face on the
outskirts of the throng. A small, spare man stood there, dressed in
unobtrusive tweeds, but making no effort to conceal himself; he was
just looking on, a stranger to the town, interested in the picturesque
little scene. The face was that of Lieutenant Rastatz.
She watched the drilling of the gunners, and then rode back with the
Prince, escorted beyond the gates by a cheering throng, which had
now been joined by many women. Dusk was falling, and the old,
gray city took on a ghostly look; the glory of the sunshine had
departed. Sophy shivered a little beneath her furs.
"Monseigneur, did you see Rastatz?" she asked.
"No, I didn't see him; but I knew he was here. Lukovitch told me
yesterday."
"And not in uniform!"
"He has leave, no doubt, and his uniform wouldn't make his stay in
Volseni any more pleasant."
"What's he there for?" she asked, fretfully.
"Ah, Baroness, you must inquire of those who sent him, I think." His
tone was light and merry.
"To spy on you, I suppose! I hate his being there. He—he isn't
worthy to be in dear Volseni."
"You and Volseni have fallen in love with each other, I see! As for
spying, all I'm doing I do openly, and all I shall do. But I don't blame
Stenovics for keeping an eye on me, or Stafnitz either. I do my best
to keep an eye on them, you know. We needn't be afraid of Rastatz,
we who have beaten Hercules Mistitch in open fight!"
"Oh, well, away with him!" cried Sophy. "The snow's not frozen—
shall we canter home, Monseigneur?"
Merrily they cantered through the fast falling evening, side by side.
Rastatz was out of mind now; all was out of mind save the
fascination of the crisp air, the silent suggestion of gathering night,
her Prince who rode beside her. The dark mass of the tower of
Praslok rose too soon before her unwilling eyes. She drew rein,
sighing.
"If life were just all that and nothing else!" she said, as he helped
her to dismount and the grooms took the horses. She stopped half-
way up the steep wooden causeway and turned to look back
towards Volseni. The Prince stood close by her.
"That's good, but life has better things," he said, softly. "To ride
together is good, and to play together. But to work together is better
still, Baroness."
For a moment Sophy was silent. Then she laughed in joy.
"Well, I'm to wear your uniform henceforth, Monseigneur!"
He took her hand and kissed it. Very slowly and gradually she drew
it away, her eyes meeting his as he raised his head. The heavy door
at the top of the causeway opened; Marie Zerkovitch stood there,
holding a lamp high in her hand; the sudden light flooded their
faces. For a moment more he looked at her, then went down again
on his way to the stables. Sophy ran up to where Marie Zerkovitch
stood.
"You heard our horses?" she asked, gayly.
But there was no responsive smile on Marie's lips. For her, too, the
light had shone on those two faces, and she was sorely troubled.
The next day again they rode together, and the next. On the third
day, Sophy rode into Volseni in the sheepskin cap and tunic, a short
habit of blue hiding her leather breeches and coming half-way over
her long boots. The Prince gave her his hand as they rode into the
market-place.
Marie Zerkovitch trembled, Max von Hollbrandt shrugged his
shoulders with a laugh—and little Rastatz drove back to Slavna
through the night. He thought that he had seen enough for his
purposes; his report might be useful in the city on the Krath.
IX
COUNTESS ELLENBURG PRAYS
In Slavna, Dr. Natcheff continued his reassuring reports until the
public at large was so reassured as to ask for no more reports even
of the most optimistic description. But the state of mind of the few
people behind the scenes was very different. Stafnitz's conclusion
held sway there. The time was short! That was the ruling thought
and the governing fact. It might be very short; and the end might
come without warning. The secret was well kept, but to those to
whom he spoke at all Natcheff spoke openly. The King's life hung on
a thread, which the least accident might break. With perfect quiet
and tranquillity he might live a year, possibly two years; any shock or
overstrain would precipitate the end. Countess Ellenburg and her
confidential friends knew this, the King knew it himself, and Lepage
his valet, knew it. There the possession of the secret stopped.
The King was gay and courageous; courage, at least, he had never
lacked. He seemed almost indifferent. The best years were over, he
said, and why not an end? An end swift, without pain, without
waiting! There was much to be said for it. Lepage agreed with his
master and told him so in his usual blunt fashion; they agreed
together not to cry about it, and the King went fishing still. But the
time was short, and he pushed on his one great idea with a zeal and
an earnestness foreign to his earlier habit. He would see his son
married, or at least betrothed, before he died; he would see the
great marriage in train—the marriage which was to establish forever
the rank and prestige of the House of Stefanovitch. The Prince of
Slavna must set forth on his travels, seeking a wife; the King even
designated a Princess of most unquestionable exaltedness, as the
first object of his son's attentions or pursuit. With an unusual
peremptoriness, and an unusual independence, he sent Stenovics
orders to communicate his wishes directly to the Prince. Stenovics
received the royal memorandum on the day on which Lieutenant
Rastatz returned to Slavna with the fruits of his observation at
Volseni in his hand.
At first sight the King's commands were totally at variance with the
interests of the Ellenburg coterie, and with the progress of their
great plan. They did not want the House of Stefanovitch
strengthened and glorified in the person of its present Heir
Apparent. But the matter was more complicated than a first glance
showed. There were the guns to be considered as well—and the
gunners training at Volseni; these would be sources of strength and
prestige to the Prince, not less valuable, more tangible, than even a
great match. And now the Prince was on the spot. Send him on his
travels! The time was short; when the short time ended, he might be
far away. Finally, he might go and yet take nothing by his journey;
the exalted Princess would be hard to win; the King's family pride
might defeat itself by making him pitch his hopes and his claims too
high.
On the whole the matter was difficult. The three chief conspirators
showed their conviction of this in their characteristic ways. Countess
Ellenburg became more pious than ever; General Stenovics more
silent—at least more prone to restrict his conversation to grunts;
Colonel Stafnitz more gay and interested in life; he, too, was fishing,
and in his favorite waters, and he had hopes of a big rise.
There was one contingency impossible to overlook. In spite of his
father's orders, the Prince might refuse to go. A knowledge of the
state of the King's health would afford him a very strong excuse, a
suspicion of the plans of the coterie an overpowering motive. The
King himself had foreseen the former danger and feared its effect on
his dominant hopes; by his express command the Prince was kept in
ignorance; he had been amply reassured by Dr. Natcheff. On the
latter point the coterie had, they flattered themselves, nothing to
fear. On what ground, then, could the Prince justify a refusal? His
gunners? That would be unwarrantable; the King would not accept
the plea. Did Rastatz's report suggest any other ground for refusal?
If it did, it was one which, to the King's mind, would seem more
unwarrantable still.
There is no big game without its risk; but after full consideration,
Stenovics and Stafnitz decided that the King's wishes were in their
interest, and should be communicated to the Prince without delay.
They had more chances for them than against them. If their game
had its dangers—well, the time might be very short.
In these days Countess Ellenburg made a practice of shutting herself
up in her private rooms for as much as two additional hours every
day. She told the King that she sought a quiet time for meditation
and prayer. King Alexis shrugged his shoulders; meditation wouldn't
help matters, and, in face of Dr. Natcheff's diagnosis of the condition
of his heart, he must confess to a serious doubt even about prayer.
He had outlived his love for the Countess, but to the end he found in
her a source of whimsical amusement; divining, if not her ambitions,
at least her regrets; understanding how these regrets, when they
became very acute, had to be met by an access of piety. Naturally
they would be acute now, in view of Natcheff's diagnosis. He
thanked her for her concern, and bade her by all means go and pray.
What was the stuff of her prayers—the stuff behind the words? No
doubt she prayed for her husband's life. No doubt she prayed for her
son's well-being. Very likely she even prayed that she might not be
led into temptation, or to do anything wrong, by her love for her
son; for it was her theory that the Prince himself would ruin his own
chances, and throw the Crown away. It is not easy always to be sure
of conscious insincerity.
Yet the devil's advocate would have had small difficulty in placing a
fresh face on her prayers, in exhibiting what lay below the words, in
suggesting how it was that she came forth from her secret
devotions, not happy and tranquillized, but with weary eyes, and her
narrow lips close-set in stern self-control. Her prayer that she might
do nothing wrong was a prayer that the Prince might do nothing
right. If that prayer were granted, sin on her part would become
superfluous. She prayed not to be led into temptation—that sounded
quite orthodox; was she to presume to suggest to Heaven the
means by which temptation should be avoided?
Stenovics skilfully humored this shade of hypocrisy. When he spoke
to her, there were in his mouth no such words as plans or schemes
or hopes or ambitions—no, nor claims nor rights. It was always, "the
possibilities we are compelled to contemplate"—"the steps we may
be forced into taking"—"the necessities of mere self-defence"—"the
interests of the kingdom"—"the supreme evil of civil strife"—which
last most respectable phrase meant that it was much better to
jockey the Prince out of his throne than to fight him for it. Colonel
Stafnitz bit his lip and gnawed his mustache during these interviews.
The Countess saw—and hated him. She turned back to Stenovics's
church-going phrases and impassive face. Throughout the whole
affair the General probably never once mentioned to her in plain
language the one and only object of all their hopes and efforts. In
the result business took rather longer to transact—the church-going
phrases ran to many syllables; but concessions must be made to
piety. Nor was the Countess so singular; we should often forego
what we like best if we were obliged to define it accurately and
aloud.
After one of these conferences the Countess always prayed; it may
be presumed that she prayed against the misfortune of a cast-iron
terminology. Probably she also urged her views—for prayer is in
many books and mouths more of an argument than a petition—that
all marriages were on one and the same footing, and that Heaven
knew naught of a particular variety named in some countries
morganatic. Of the keeping of contracts, made contrary to the
presumed views of Heaven, we are all aware that Churches—and
sometimes States, too—are apt to know or count nothing.
Such were the woman and her mind. Some pity may go out to her.
In the end, behind all her prayers, and inspiring them—nay, driving
her to her knees in fear—was the conviction that she risked her soul.
When she felt that, she pleaded that it was for her son's sake. Yet
there lay years between her son and man's estate; the power was
for some one during those years.
"If I had the Countess's views and temperament, I should grow
potatoes—and, if possible, grow them worse than my neighbors,"
said Colonel Stafnitz. "If I lived dully, I should at least die in peace!"
The King held a very confidential conference. It was to sign his will.
The Countess was there; the little boy, who moved in happy
unconsciousness of all the schemes which centred round him, was
sent into the next room to play with Lepage. Stenovics and Stafnitz
were present as witnesses, and Markart as secretary. The King
touched lightly on his state of health, and went on to express his
conviction of the Prince of Slavna's distinguished consideration for
Countess Ellenburg and fraternal affection for little Alexis. "I go the
happier for being sure of this, gentlemen," he said, to his two
counsellors. "But in any case the Countess and my son are well
secured. There will be enough for you, Charlotte, to live in suitable
style, here or abroad, as you please. My son I wish to stay here and
enter my army. I've settled on him the estate of Dobrava, and he will
have means equal to his station. It's well to have this arranged; from
day to day I am in the hands of God."
As with another King, nothing in life became him like the leaving of
it. There was little more work to do—he had but to wait with
courage and with dignity. The demand now was on what he had in
abundance, not on a faculty which he had always lacked. He signed
the document, and bade the General and Stafnitz witness it. In
silence they obeyed him, meaning to make waste-paper of the thing
to which they set their names.
That business done—and the King alone seemed happy in the doing
of it (even Stafnitz had frowned)—the King turned suddenly to
Stenovics.
"I should like to see Baroness Dobrava. Pray let her be sent for this
afternoon."
The shock was sudden, but Stenovics's answer came steady, if slow.
"Your Majesty desires her presence?"
"I want to thank her once again, Stenovics. She's done much for us."
"The Baroness is not in Slavna, sir, but I can send for her."
"Not in Slavna? Where is she, then?"
He asked what the whole kingdom knew. Save himself, nobody was
ignorant of Sophy's whereabouts.
"She is on a visit to his Royal Highness at Praslok, sir." Stenovics's
voice was a triumph of neutrality.
"On a visit to the Prince?" Surprise sounded in his voice.
"Madame Zerkovitch is there too, sir," Stenovics added. "The ladies
have been there during the whole of the Prince of Slavna's stay."
The King shot a glance at Countess Ellenburg; she was looking prim
and grim. He looked, also, at Stafnitz, who bit his mustache, without
quite hiding an intentional but apparently irrepressible smile. The
King did not look too grave—and most of his gravity was for
Countess Ellenburg.
"Is that—hum—at this moment, quite desirable?" he asked.
His question met with silence; the air of all three intimated that the
matter was purely one for His Majesty. The King sat a moment with
a frown on his brow—the frown which just supplants a smile when a
thing, generally amusing and not unnatural, happens by chance to
occur inconveniently.
Across this silence came a loud voice from the next room—Lepage's
voice. "Take care, take care! You'll upset the flowers, Prince!"
The King started; he looked round at his companions. Then he
struck a hand-bell on the table before him. Lepage appeared.
"Lepage, whom did you address as 'Prince' just now?"
"Count Alexis, sir."
"Why?"
"The Count insisted."
"Don't do it again. It's absurd! Go away!"
A dull red patched Countess Ellenburg's cheeks. Lids brooded low
over the eyes of Stafnitz and of Stenovics. It was a very awkward
little scene—the King's irritation had got the better of him for the
moment. What would the kindred of the exalted Princess have said?
The King turned to Countess Ellenburg and forced a smile.
"The question of reproof is one for you, Countess," he said, frigidly.
"And now about the Baroness—No, I mean, I wanted to ask if my
wishes have been communicated to the Prince of Slavna."
"The Prince has received them, sir. He read them in the presence of
my messenger, and requested leave to send his answer in writing,
unless he might wait on Your Majesty."
"There are reasons why I had better not see him just now. Ask him
to write—but very soon. The matter isn't one for delay." The King
rose from his seat.
"Your Majesty still wishes me to send for Baroness Dobrava?"
The King reflected for a moment, and answered simply: "No."
His brief word broke up the conference—it had already lasted longer
than suave and reassuring Dr. Natcheff would have advised. The
men went away with a smile, all of them—the King, Stenovics,
Stafnitz, round-faced Markart—each smiling according to the quality
of each, their smiles answering to Max von Hollbrandt's shrug of the
shoulders. There are things which bring men to what painful youth
was taught to call the least common denominator. A horse-race does
it, a prize-fight, a cricket-match, a battle, too, in some sort. Equally
efficacious, very often, though it is to be recorded with reluctance, is
a strong flirtation with no proper issue obvious.
The matter was grave, yet all the men laughed. The matter was
grave, and Countess Ellenburg did not laugh. Was that what Stafnitz
called her views and her temperament? In part, no doubt. Besides,
men will laugh at the side-issues of the gravest affairs; it is not
generally the case with woman. Added again to this, perhaps
Countess Ellenburg knew more, or divined more. Among glaring
diversity there was, perhaps, something—an atom—of similarity
between her and Sophy—not the something which refuses, but the
something which couples high conditions with assent. The
thousandth chance is to most men negligible; to most women it is
no worse than the tenth; their sense of mathematical odds is sorely
—and sometimes magnificently—imperfect.
It had flashed across Countess Ellenburg's mind that maybe Sophy,
too, played for a big stake—or, rather, lived for it and so would die.
The men had not thought of that; to them, the violent flirtation had
its obvious end and its passing inconvenience. It might delay the
Prince's departure for a while; it might make his marriage more
entirely an affair of duty and of state. With this idea they smiled and
shrugged; the whole business came under the head which, in their
thoughts and their confidential conversations, they would style
nonsense.
It was not so with the Countess. Disconcerted by that episode of
Lepage and young Alexis, more moved by the sudden appearance of
Baroness Dobrava as a factor in the game, she returned to prayer.
What now was the form and matter of her prayer? The form must go
unformulated—and the words unconjectured. Yet she prayed so long
that she must have succeeded in putting a good face on her
petitions. Without a plausible plea nobody could have rested on their
knees so long.
It is probable that she prayed for others as she prayed for herself—
she prayed that the Prince of Slavna and the Baroness Dobrava
might escape temptation.
Or that, if they fell—? Again it was not for her to dictate to Heaven.
Heaven had its ways of dealing with such sinners.
Yet through all her prayers must have echoed the words: "It's
absurd!" She prayed again, most likely, against being suspected of
wishing that the man who uttered them—her husband—might soon
be dead.
The King dead—and the Prince a slave to love—to the idle hours of
an unprofitable love! It was a fine vision, and needed a vast deal of
covering with the veil of prayer.
X
THE SOUND OF A TRUMPET
The Prince of Slavna's answer to the intimation of his father's wishes
was dutiful, courteous, and discreetly diplomatic. The Prince was
much occupied with his drills and other occupations; he availed
himself of Max von Hollbrandt's practised pen—the guest was glad to
do his royal host this favor.
They talked over the sense of the reply; Max then draughted it. The
Prince did no more than amend certain expressions which the young
diplomatist had used. Max wrote that the Prince cordially
sympathized with the King's wishes; the Prince amended to the
effect that he thoroughly understood them. Max wrote that the
Prince was prepared cordially and energetically to co-operate in their
realization; the Prince preferred to be prepared to consider them in a
benevolent spirit. Max suggested that two or three months'
postponement of the suggested journey would not in itself be fatal;
the Prince insisted that such a delay was essential, in order that
negotiations might be set on foot to ensure his being welcomed with
due empressement. Max added that the later date would have an
incidental advantage, since it would obviate the necessity of the
Prince's interrupting the important labors on which he was engaged;
the Prince said instead that, in his judgment, it was essential, in the
interests of the kingdom, that the task of training the artillery should
not be interfered with by any other object, however well worthy of
consideration that object might be.
In the result, the draught as amended, though not less courteous or
dutiful than Max's original, was noticeably more stiff. Translate them
both into the terse and abrupt speech of every-day life, and one
said: "I'd rather not, please," while the other came at least very near
to a blank "I won't!" Max's was acquiescence, coupled with a prayer
for postponement; the Prince's was postponement first, with an
accompanying assurance of respectful consideration.
Max was not hurt, but he felt a professional disapproval; the Prince
had said more, and shown more of his mind, than was needful; it
was throwing more cards on the table than the rules of the game
demanded.
"Mine would have done just as well," he complained to Marie
Zerkovitch. "If mine had been rejected, his could have followed. As it
is, he's wasted one or other of them. Very foolish, since just now
time's his main object!" He did not mean saving time, but protracting
it.
Marie did no more than toss her head peevishly. The author of the
original draught persevered.
"Don't you think mine would have been much wiser—to begin with?"
"I don't see much difference. There's little enough truth in either of
them!" she snapped.
Max looked at her with an amused and tolerant smile. He knew quite
well what she meant. He shook his head at her with a humorous
twinkle. "Oh, come, come, don't be exacting, madame! There's a
very fair allowance of truth. Quite half the truth, I should think. He is
really very anxious about the gunners!"
"And about what else?"
Max spread out his hands with a shrug, but passed the question by.
"So much truth, in fact, that it would have served amply for at least
two letters," he remarked, returning to his own special point of
complaint.
Marie might well amuse the easy-going, yet observant and curious,
young man; he loved to watch his fellow-creatures under the stress
of feelings from which he himself was free, and found in the
opportunities afforded him in this line the chief interest both of his
life and of his profession.
But Marie had gradually risen to a high, nervous tension. She was no
puritan—puritans were not common in Kravonia, nor had Paris
grafted such a slip onto her nature. Had she thought as the men in
the Palace thought when they smiled, had she thought that and no
more, it is scarcely likely that she would have thus disturbed herself;
after all, such cases are generally treated as in some sense outside
the common rules; exceptional allowances are, in fact, whether
properly or not, made for exceptional situations. Another feeling was
in her mind—an obsession which had come almost wholly to possess
her. The fateful foreboding which had attacked her from the first had
now full dominion over her; its rule was riveted more closely on her
spirit day by day, as day by day the Prince and Sophy drew closer
together. Even that Sophy had once saved his life could now no
longer shake Marie's doleful prepossession. Unusual and unlooked-
for things take color from the mind of the spectator; the strange
train of events which had brought Sophy to Praslok borrowed
ominous shadows from a nervous, apprehensive temperament.
No such gloom brooded over Sophy. She gave herself up to the
hour: the past forgotten, the future never thought of. It was the
great time of her life. Her feelings, while not less spontaneous and
fresh, were more mature and more fully satisfied than when Casimir
de Savres poured his love at her feet. A cry of happiness almost
lyrical runs through her scanty record of these days—there was little
leisure for diary or letters.
Winter was melting into spring, snow dwelled only on the hill-tops,
Lake Talti was unbound and sparkled in the sun; the days grew
longer, yet were far too short. To ride with him to Volseni, to hear
the cheers, to see the love they bore him, to watch him at work, to
seem to share the labor and the love—then to shake off the kindly
clinging friends and take to a mountain-path, or wander, the reins on
the horses' necks, by the margin of the lake, and come home
through the late dusk, talking often, silent often, always together in
thought as in bodily presence—was not this enough? "If I had to die
in a month, I should owe life a tremendous debt already"—that is
her own summing up; it is pleasant to remember.
It would be enough to say—love; enough with a nature ardent as
hers. Yet, with love much else conspired. There was the thought of
what she had done, of the things to which she was a party; there
was the sense of power, the satisfaction of ambition, a promise of
more things; there was the applause of Volseni as well as the
devotion of the Prince; there was, too—it persisted all through her
life—the funny, half-childish, and (to a severe eye) urchin-like
pleasure in the feeling that these were fine doings for Sophy Grouch,
of Morpingham in Essex! "Fancy me!" is the indefensibly primitive
form in which this delight shows in one of the few letters bearing
date from the Castle of Praslok.
Yet it is possible to find this simple, gracious surprise at Fortune's
fancies worthy of love. Her own courage, her own catching at
Fortune's forelock, seem to have been always unconscious and
instinctive. These she never hints at, nor even begins to analyze. Of
her love for the Prince she speaks once or twice—and once in
reference to what she had felt for Casimir. "I loved him most when
he left me, and when he died," she writes. "I love him not less now
because I love Monseigneur. But I can love Monseigneur more for
having loved Casimir. God bade the dear dead die, but He bade me
live, and death helped to teach me how to do it." Again she reflects:
"How wonderfully everything is worth while—even sorrows!"
Following which reflection, in the very next line (she is writing to
Julia Robins), comes the naïve outburst: "I look just splendid in my
sheepskin tunic—and he's given me the sweetest toy of a revolver;
that's in case they ever charge, and try and cut us up behind our
guns!" She is laughing at herself, but the laugh is charged with an
infectious enjoyment. So she lived, loved, and laughed through
those unequalled days, trying to soothe Marie Zerkovitch, bantering
Max von Hollbrandt, giving her masculine mind and her feminine
soul wholly to her Prince. "She was like a singularly able and
energetic sunbeam," Max says quaintly, himself obviously not
untouched by her attractions.
The Prince's mind was simple. He was quite sincere about his guns;
he had no wish to go on his travels until they had arrived, and he
could deliver them into the safe custody of his trained and trusty
Volsenians, and of Lukovitch their captain. Less than that was not
safety, with Stenovics in office and Colonel Stafnitz on duty at the
capital. But Marie Zerkovitch was right, too, even though over-
exacting, as Max had told her. The letter to the King held but half
the truth, and that half not the more significant. He could not go
from Sophy's side to seek a wife. The desire of his heart and the
delight of his eyes—she was here in Praslok.
Her charm was not only for his heart and eyes, her fascination not
solely for his passion; on his intellect also she laid her powerful hold,
opening the narrow confines of his mind to broader views, and
softening the rigor of his ideals. He had seen himself only as the
stern master, the just chastiser of a turbulent capital and an unruly
soldiery. But was there not a higher aim? Might he not be loved in
the plains as on the hills, at Slavna as at Volseni?
By himself he could not achieve that; his pride—nay, his obstinacy—
forbade the first step. But what his sensitive dignity rejected for
himself, he could see her sunny graciousness accomplish without
loss of self-respect, naturally, all spontaneously. He was a soldier;
hers were the powers of peace, of that instinctive statesmanship of
the emotions by which hearts are won and kingdoms knit together
by a tie stronger than the sword. Because in his mind's eye he saw
her doing this, the idea at which the men in the Palace had smiled,
and which even Marie Zerkovitch would have accepted as the lesser
evil, never came into his head. In the future years she was to be
openly at his side, doing these things for him and for the land of his
love and labor. Would she not be a better partner than some
stranger, to whom he must go cap in hand, to whom his country
would be a place of exile and his countrymen seem half-barbarians,
whose life with him would be one long tale of forced and unwilling
condescension? A pride more subtle than his father's rose in revolt.
If he could make the King see that! There stood the difficulty. Right
in the way of his darling hope was the one thing on which the King
insisted. The pride of family—the great alliance—the single point
whereon the easy King was an obstacle so formidable! Yet had he
despaired, he would have been no such lover as he was.
His answer had gone to the King; there was no news of its reception
yet. But on the next day, in the evening, great tidings came from
Slavna, forwarded by Zerkovitch, who was in charge of the Prince's
affairs there. The Prince burst eagerly into the dining-room in the
tower of Praslok, where Sophy sat alone. He seemed full of
triumphant excitement, almost boyish in his glee. It is at such
moments that hesitations are forgotten and the last reserves broken
down.
"My guns!" he cried. "My guns! They've started on their way. They're
due in Slavna in a month!"
"In a month!" she murmured softly. "Ah, then—"
"Our company will be ready, too. We'll march down to Slavna and
meet the guns!" He laughed. "Oh, I'll be very pleasant to Slavna now
—just as you advise me. We'll meet them with smiles on our faces."
He came up to her and laid his hand on hers. "You've done this for
me," he said, smiling still, yet growing more grave.
"It'll be the end of this wonderful time, of this our time together!"
"Of our time at Praslok—not of our time together. What, won't
Lieutenant Baroness Dobrava march with her battery?"
She smiled doubtfully, gently shaking her head. "Perhaps! But when
we get to Slavna—? Oh, I'm sorry that this time's so nearly done!"
He looked at her gravely for a few moments, making, perhaps, a last
quick calculation—undergoing, perhaps, a last short struggle. But
the Red Star glowed against the pallor of her face; her eyes were
gleaming beacons.
"Neither the guns, nor the men, nor Slavna—no, nor the Crown,
when that time comes—without you!" he said.
She rose slowly, tremblingly, from her chair, and stretched out her
hands in an instinctive protest: "Monseigneur!" Then she clasped her
hands, setting her eyes on his, and whispering again, yet lower:
"Monseigneur!"
"Marie Zerkovitch says Fate sent you to Kravonia. I think she's right.
Fate did—my fate. I think it's fated that we are to be together to the
end, Sophy."
A step creaked on the old stairs. Marie Zerkovitch was coming down
from her room on the floor above. The door of the dining-room
stood open, but neither of them heard the step; they were
engrossed, and the sound passed unheeded.
Standing there with hands still clasped, and eyes still bound to his,
she spoke again—and Marie Zerkovitch stood by the door and heard
the quick yet clear words, herself fascinated, unable to move or
speak.
"I've meant nothing of it. I've thought nothing of it. I seem to have
done nothing towards it. It has just come to me." Her tone took on a
touch of entreaty, whether it were to him, or to some unseen power
which ruled her life, and to which she might have to render an
account.
"Yet it is welcome?" he asked quietly. She was long in answering; he
waited without impatience, in a confidence devoid of doubt. She
seemed to seek for the whole truth and to give it to him in gravest,
fullest words.
"It is life, Monseigneur," she said. "I can't see life without it now."
He held out his hands, and very slowly she laid hers in them.
"It is enough—and nothing less could have been enough from you to
me and from me to you," he said gently. "Unless we live it together,
I think it can be no life for us now."
The chain which had held Marie Zerkovitch motionless suddenly
snapped. She rushed into the room, and, forgetful of everything in
her agitation, seized the Prince by the arm.
"What do you mean?" she cried. "What do you mean? Are you
mad?"
He was very fond of little Marie. He looked down at her now with an
affectionate, indulgent smile.
"Come, you've heard what I said, I suppose—though it wasn't meant
for your ears, you know! Well, then, I mean just what I said, Marie."
"But what do you mean by it?" she persisted in a feverish, almost
childish, excitement. She turned on Sophy, too. "And what do you
mean by it, Sophy?" she cried.
Sophy passed a hand across her brow. A slow smile relieved the
enchanted tension of her face; she seemed to smile in a whimsical
surprise at herself. Her answer to Marie came vague and almost
dreamy. "I—I thought of nothing, dear Marie," she said; then with a
sudden low murmur of delighted laughter she laid her hands in the
Prince's again. She had thought of nothing but of that life together
and their love.
"She'll share my life, Marie, and, when the time comes, my throne,"
the Prince said softly: he tried to persuade and soothe her with his
gentle tones.
Marie Zerkovitch would not have it. Possessed by her old fear, her
old foreboding, she flung away the arm she held with an angry
gesture. "It's ruin!" she cried. "Ruin, ruin!" Her voice rang out
through the old room and seemed to fill all the Castle of Praslok with
its dirgeful note.
"No," said he firmly. "Ruin will not come through me, nor through
her. It may be that ruin—what you call ruin—will come. It may be
that I shall lose my life or my throne." He smiled a little. "Such
changes and chances come as nothing new to a Stefanovitch. I have
clever and bold men against me. Let them try! We'll try, too. But ruin
will not be by her fault, nor through this. And if it were, don't I owe
her my life already? Should I refuse to risk for her the life she has
given?" He dropped his voice to homelier, more familiar tones, and
ended, with a half-laugh: "Come, little friend, you mustn't try to
frighten Sergius Stefanovitch. It's better the House should end than
live on in a coward, you know."
The plea was not perfect—there was wisdom as well as courage in
question. Yet he would have maintained himself to be right in point
of wisdom, too, had Marie pressed him on it. But her force was
spent; her violence ended, and with it her expostulations. But not
her terror and dismay. She threw herself into a chair and covered
her face with her hands, sobbing bitterly.
The Prince gently caressed her shaking shoulder, but he raised his
eyes to Sophy, who had stood quiet through the scene.
"Are you ready for what comes, Sophy?" he asked.
"Monseigneur, I am ready," she said, with head erect and her face
set. But the next instant she broke into a low yet rich and ringing
laugh; it mingled strangely with Marie's sobs, which were gradually
dying away, yet sounded still, an undertone of discord with Sophy's
mirth. She stretched out her hands towards him again, whispering in
an amused pity: "Poor child—she thought that we should be afraid!"
Out from the dusk of the quiet evening came suddenly the blare of a
trumpet, blown from Volseni by a favoring breeze. It sounded every
evening, at nightfall, to warn the herdsmen in the hills of the closing
of the gates, and had so sounded from time beyond man's memory.
The Prince raised his hand to bid her listen.
"In good Volseni there is watch and ward for us!"
The echoes of the blast rang for an instant round the hills.
"And there is watch and ward, and the glad sound of a trumpet, in
my heart, Monseigneur," she said.
The sobs were still, laughter was hushed, the echoes died away. In
utter silence their hands and their eyes met. Only in their hearts
love's clarion rang indomitable and marvellously glad.
XI
M. ZERKOVITCH'S BEDROOM FIRE
Often there are clever brains about us of whose workings we care
nothing, save so far as they serve to the defter moving of our dishes
or the more scientific brushing and folding of our clothes. Humorists
and philosophers have described or conjectured or caricatured the
world of those who wait on us, inviting us to consider how we may
appear to the inward gaze of the eyes which are so obediently cast
down before ours or so dutifully alert to anticipate our orders. As a
rule, we decline the invitation; the task seems at once difficult and
unnecessary. Enough to remember that the owners of the eyes have
ears and mouths also! A small leak, left unstanched, will empty the
largest cask at last; it is well to keep that in mind both in private
concerns and in affairs of public magnitude.
The King's body-servant, Emile Lepage, had been set a-thinking.
This was the result of the various and profuse scoldings which he
had undergone for calling young Count Alexis "Prince." The King's
brief, sharp words at the conference had been elaborated into a
reproof both longer and sterner than his Majesty was wont to
trouble himself to administer; he had been very strong on the utter
folly of putting such ideas into the boy's head. Lepage was pretty
clear that the idea had come from the boy's head into his, but he
said nothing more of that. The boy himself scolded Lepage—first for
having been overheard, secondly (and, as Lepage guessed, after
being scolded himself very roundly) for using the offending title at
all. Meekly Lepage bore this cross also—indeed, with some
amusement, and a certain touch of pity for young Alexis, who was
not a prince and obviously could not make out why: in the books a
king's sons were always princes, even though there were (as in
those glorious days there often were) fifty or threescore of them.
Then Countess Ellenburg scolded him: the King's "It's absurd!" was
rankling sorely in her mind. Her scolding was in her heaviest manner
—very religious: she called Heaven to witness that never, by word or
deed, had she done anything to give her boy such a notion. The
days are gone by when Heaven makes overt present answer;
nothing happened! She roundly charged Lepage with fostering the
idea for his own purposes; he wanted to set the Prince of Slavna
against his little brother, she supposed, and to curry favor with the
rising sun at the poor child's cost.
She was very effective, but she angered Lepage almost beyond
endurance. By disposition he was thoroughly good-natured, if
sardonic and impassive; he could not suffer the accusation of
injuring the pretty boy for his own ends; it was both odious and
absurd. He snapped back smartly at her: "I hope nobody will do
more to put wrong ideas in his head than I have done, Madame la
Comtesse." In a fury she drove him from the room. But she had
started ever so slightly. Lepage's alert brain jumped at the signal.
Finally, Stenovics himself had a lecture for poor, much-lectured
Lepage. It was one of the miscalculations to which an over-cautious
cunning is prone. Stenovics was gentle and considerate, but he was
very urgent—urgent, above all, that nothing should be said about
the episode, neither about it, nor about the other reprimands.
Silence, silence, silence was his burden. Lepage thought more and
more. It is better to put up with gossip than to give the idea that the
least gossip would be a serious offence. People gossip without
thinking, it's easy come and gone, easy speaking and easy
forgetting; but stringent injunctions not to talk are apt to make men
think. References to the rising sun, also, may breed reflection in the
satellites of a setting orb. Neither Countess Ellenburg nor General
Stenovics had been as well advised as usual in this essentially
trumpery matter.
In short, nervousness had been betrayed. Whence came it? What
did it mean? If it meant anything, could Lepage turn that thing to
account? The King's favorite attendant was no favorite with Countess
Ellenburg. For Lepage, too, the time might be very short! He would
not injure the boy, as the angry mother had believed, or at least
suggested; but, without question of that, there was no harm in a
man's looking out for himself; or if there were, Lepage was clear in
thinking that the Countess and the General were not fit preachers of
such a highly exacting gospel.
Lepage concluded that he had something to sell. His wares were a
suspicion and a fact. Selling the suspicion wronged nobody—he
would give no warranty with it—Caveat emptor. Selling the fact was
disobedience to the King his master. "Disobedience, yes; injury, no,"
said Lepage with a bit of casuistry. Besides, the King, too, had
scolded him.
Moreover, the Prince of Slavna had always treated Monsieur Emile
Lepage with distinguished consideration. The Bourbon blood, no
doubt, stretched out hands to la belle France in Monsieur Lepage's
person.
Something to sell! Who was his buyer? Whose interest could be won
by his suspicion, whose friendship bought with his fact? The ultimate
buyer was plain enough. But Lepage could not go to Praslok, and he
did not approve of correspondence, especially with Colonel Stafnitz
in practical control of the Household. He sought a go-between—and
a personal interview. At least he could take a walk; the servants
were not prisoners. Even conspirators must stop somewhere—on
pain of doing their own cooking and the rest! At a quarter past eight
in the evening, having given the King his dinner and made him
comfortable for the next two hours, Lepage sallied forth and took
the road to Slavna. He was very carefully dressed, wore a flower in
his buttonhole, and had dropped a discreet hint about a lady, in
conversation with his peers. If ladies often demand excuses, they
may furnish them too; present seriousness invoked aid from bygone
frivolity.
At ten o'clock he returned, still most spruce and orderly, and with a
well satisfied air about him. He had found a purchaser for his
suspicion and his fact. His pocket was the better lined, and he had
received flattering expressions of gratitude and assurances of favor.
He felt that he had raised a buttress against future assaults of
Fortune. He entered the King's dressing-room in his usual noiseless
and unobtrusive manner. He was not aware that General Stenovics
had quitted it just a quarter of an hour before, bearing in his hand a
document which he had submitted for his Majesty's signature. The
King had signed it and endorsed the cover "Urgent."
"Ah, Lepage, where have you been?" asked the King.
"Just to get a little air and drink a glass at the Golden Lion."
"You look gayer than that!" smiled the King. Evidently his anger had
passed; perhaps he wished to show as much to an old servant
whom he liked and valued.
Conscience-stricken—or so appearing—Lepage tore the flower from
his coat. "I beg Your Majesty's pardon. I ought to have removed it
before entering your Majesty's presence. But I was told you wished
to retire at once, sir, so I hurried here immediately."
The King gave a weary yawn. "Yes, I'll go to bed at once, Lepage;
and let me sleep as long as I can. This fag-end of life isn't very
amusing." He passed his hand wearily across his brow. "My head
aches. Isn't the room very close, Lepage? Open the window."
"It has begun to rain, sir."
"Never mind, let's have the rain, too. At least, it's fresh."
Lepage opened a window which looked over the Krath. The King
rose: Lepage hastened to offer his arm, which his Majesty accepted.
They went together to the window. A sudden storm had gathered;
rain was pelting down in big drops.
"It looks like being a rough night," remarked the King.
"I'm afraid it does, sir," Lepage agreed.
"We're lucky to be going to our beds."
"Very, sir," answered Lepage, wondering whose opposite fate his
Majesty was pitying.
"I shouldn't care, even if I were a young man and a sound one, to
ride to Praslok to-night."
"To Praslok, sir?" There was surprise in Lepage's voice. He could not
help it. Luckily it sounded quite natural to the King. It was certainly
not a night to ride five and twenty miles, and into the hills, unless
your business was very urgent.
"Yes, to Praslok. I've had my breath of air—you can shut the
window, Lepage."
The King returned to the fireplace and stood warming himself.
Lepage closed the window, drew the curtains, and came to the
middle of the room, where he stood in respectful readiness—and,
underneath that, a very lively curiosity.
"Yes," said the King slowly, "Captain Markart goes to Praslok to-night
—with a despatch for his Royal Highness, you know. Business,
Lepage, urgent business! Everything must yield to that." The King
enunciated this virtuous maxim as though it had been the rule of his
life. "No time to lose, Lepage, so the Captain goes to-night. But I'm
afraid he'll have a rough ride—very rough."
"I'm afraid so, sir," said Lepage, and added, strictly in his thoughts:
"And so will Monsieur Zerkovitch!"
Captain Markart was entirely of his Majesty's opinion as he set out
on his journey to Praslok. His ride would be rough, dark, and solitary
—the last by Stenovics's order. Markart was not afraid, he was well
armed; but he expected to be very bored, and knew that he would
be very wet, by the time he reached the Castle. He breathed a
fervent curse on the necessities of State, of which the Minister had
informed him, as he buttoned up his heavy cavalry overcoat, and
rode across the bridge on to the main road on the right bank, an
hour before midnight.
Going was very heavy, so was the rain, so was the darkness; he and
his horse made a blurred, laboring shape on the murky face of night.
But his orders were to hasten, and he pushed on at a sharp trot and
soon covered his first stage, the five miles to the old wooden bridge,
where the road leaves the course of the Krath, is carried over the
river, and strikes northeast, towards the hills.
At this point he received the first intimation that his journey was not
to be so solitary as he had supposed. When he was half-way across
the bridge, he heard what sounded like an echo of the beat of his
horse's hoofs on the timbers behind him. The thing seemed odd. He
halted a moment to listen. The sound of his horse's hoofs stopped—
but the echo went on. It was no echo, then; he was not the only
traveller that way! He pricked his horse with the spur; regaining the
road, he heard the timbers of the bridge still sounding. He touched
his horse again and went forward briskly. He had no reason to
associate his fellow-traveller's errand with his own, but he was sure
that when General Stenovics ordered despatch, he would not be
pleased to learn that his messenger had been passed by another
wayfarer on the road.
But the stranger, too, was in a hurry, it seemed; Markart could not
shake him off. On the contrary, he drew nearer. The road was still
broad and good. Markart tried a canter. The stranger broke into a
canter. "At any rate, it makes for good time," thought Markart,
smiling uneasily. In fact, the two found themselves drawn into a sort
of race. On they went, covering the miles at a quick, sustained trot,
exhilarating to the men, but rather a strain on their horses. Both
were well mounted. Markart wondered who the stranger with such a
good horse was. He turned his head, but could see only the same
sort of blur as he himself made; part of the blur, however, seemed of
a lighter color than his dark overcoat and bay horse produced.
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!

textbookfull.com

You might also like