100% found this document useful (9 votes)
59 views

Full download (Ebook) Discovering Computer Science: Interdisciplinary Problems, Principles, and Python Programming by Jessen Havill ISBN 9781482254143, 148225414X pdf docx

The document provides information about the ebook 'Discovering Computer Science: Interdisciplinary Problems, Principles, and Python Programming' by Jessen Havill, including multiple ISBNs and download links. It also outlines the aims and scope of the Chapman & Hall/CRC Textbooks in Computing series, which covers various computing topics. Additionally, it includes a detailed table of contents for the book, highlighting its chapters and key concepts.

Uploaded by

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

Full download (Ebook) Discovering Computer Science: Interdisciplinary Problems, Principles, and Python Programming by Jessen Havill ISBN 9781482254143, 148225414X pdf docx

The document provides information about the ebook 'Discovering Computer Science: Interdisciplinary Problems, Principles, and Python Programming' by Jessen Havill, including multiple ISBNs and download links. It also outlines the aims and scope of the Chapman & Hall/CRC Textbooks in Computing series, which covers various computing topics. Additionally, it includes a detailed table of contents for the book, highlighting its chapters and key concepts.

Uploaded by

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

Download Full Version ebook - Visit ebooknice.

com

(Ebook) Discovering Computer Science:


Interdisciplinary Problems, Principles, and Python
Programming by Jessen Havill ISBN 9781482254143,
148225414X
https://ebooknice.com/product/discovering-computer-science-
interdisciplinary-problems-principles-and-python-
programming-5743478

Click the button below to download

DOWLOAD EBOOK

Discover More Ebook - Explore Now at ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Discovering Computer Science : Interdisciplinary


Problems, Principles, and Python Programming by Jessen
Havill ISBN 9781315381756, 1315381753
https://ebooknice.com/product/discovering-computer-science-
interdisciplinary-problems-principles-and-python-programming-10833944

ebooknice.com

(Ebook) Discovering Computer Science: Interdisciplinary


Problems, Principles, and Python Programming by Jessen
Havill ISBN 9780367472498, 036747249X
https://ebooknice.com/product/discovering-computer-science-
interdisciplinary-problems-principles-and-python-programming-11909344

ebooknice.com

(Ebook) Discovering Computer Science: Interdisciplinary


Problems, Principles, and Python Programming by Jessen
Havill ISBN 9780367472498, 036747249X
https://ebooknice.com/product/discovering-computer-science-
interdisciplinary-problems-principles-and-python-programming-24229672

ebooknice.com

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason;


Viles, James ISBN 9781459699816, 9781743365571,
9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

ebooknice.com
(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena
Alfredsson, Hans Heikne, Sanna Bodemyr ISBN 9789127456600,
9127456609
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312

ebooknice.com

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT


II Success) by Peterson's ISBN 9780768906677, 0768906679

https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018

ebooknice.com

(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master


the SAT Subject Test: Math Levels 1 & 2) by Arco ISBN
9780768923049, 0768923042
https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-
arco-master-the-sat-subject-test-math-levels-1-2-2326094

ebooknice.com

(Ebook) Cambridge IGCSE and O Level History Workbook 2C -


Depth Study: the United States, 1919-41 2nd Edition by
Benjamin Harrison ISBN 9781398375147, 9781398375048,
1398375144, 1398375047
https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044

ebooknice.com

(Ebook) Python Programming: An Introduction to Computer


Science by John M. Zelle

https://ebooknice.com/product/python-programming-an-introduction-to-
computer-science-7343896

ebooknice.com
DISCOVERING
COMPUTER
SCIENCE
Interdisciplinary Problems,
Principles, and Python
Programming
CHAPMAN & HALL/CRC
TEXTBOOKS IN COMPUTING

Series Editors

John Impagliazzo Andrew McGettrick


Professor Emeritus, Hofstra University Department of Computer
and Information Sciences
University of Strathclyde

Aims and Scope

This series covers traditional areas of computing, as well as related technical areas, such as
software engineering, artificial intelligence, computer engineering, information systems, and
information technology. The series will accommodate textbooks for undergraduate and gradu-
ate students, generally adhering to worldwide curriculum standards from professional societ-
ies. The editors wish to encourage new and imaginative ideas and proposals, and are keen to
help and encourage new authors. The editors welcome proposals that: provide groundbreaking
and imaginative perspectives on aspects of computing; present topics in a new and exciting
context; open up opportunities for emerging areas, such as multi-media, security, and mobile
systems; capture new developments and applications in emerging fields of computing; and
address topics that provide support for computing, such as mathematics, statistics, life and
physical sciences, and business.

Published Titles

Paul Anderson, Web 2.0 and Beyond: Principles and Technologies


Henrik Bærbak Christensen, Flexible, Reliable Software: Using Patterns and Agile Development
John S. Conery, Explorations in Computing: An Introduction to Computer Science
John S. Conery, Explorations in Computing: An Introduction to Computer Science and Python
Programming
Jessen Havill, Discovering Computer Science: Interdisciplinary Problems, Principles, and
Python Programming
Ted Herman, A Functional Start to Computing with Python
Pascal Hitzler, Markus Krötzsch, and Sebastian Rudolph, Foundations of Semantic Web
Technologies
Mark J. Johnson, A Concise Introduction to Data Structures using Java
Mark J. Johnson, A Concise Introduction to Programming in Python
Lisa C. Kaczmarczyk, Computers and Society: Computing for Good
Mark C. Lewis, Introduction to the Art of Programming Using Scala
Bill Manaris and Andrew R. Brown, Making Music with Computers: Creative Programming in
Python
Uvais Qidwai and C.H. Chen, Digital Image Processing: An Algorithmic Approach with MATLAB®
David D. Riley and Kenny A. Hunt, Computational Thinking for the Modern Problem Solver
Henry M. Walker, The Tao of Computing, Second Edition
Chapman & Hall/CRC
TEXTBOOKS IN COMPUTING

DISCOVERING
COMPUTER
SCIENCE
Interdisciplinary Problems,
Principles, and Python
Programming

Jessen Havill
Denison University
Granville, Ohio, USA
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
© 2016 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government works


Version Date: 20150318

International Standard Book Number-13: 978-1-4822-5416-7 (eBook - PDF)

This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been
made to publish reliable data and information, but the author and publisher cannot assume responsibility for the valid-
ity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright
holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this
form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may
rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or uti-
lized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopy-
ing, microfilming, and recording, or in any information storage or retrieval system, without written permission from the
publishers.

For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://
www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923,
978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For
organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for
identification and explanation without intent to infringe.
Visit the Taylor & Francis Web site at
http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
Contents

Preface xv

Acknowledgments xxiii

About the author xxv

Chapter 1  What is computation? 1


1.1 PROBLEMS AND ABSTRACTION 2
1.2 ALGORITHMS AND PROGRAMS 4
1.3 EFFICIENT ALGORITHMS 11
Organizing a phone tree 11
A smoothing algorithm 13
A better smoothing algorithm 17
1.4 COMPUTERS ARE DUMB 20
Inside a computer 20
Machine language 21
Everything is bits 22
The universal machine 26
1.5 SUMMARY 29
1.6 FURTHER DISCOVERY 30

Chapter 2  Elementary computations 31


2.1 WELCOME TO THE CIRCUS 31
2.2 ARITHMETIC 32
Finite precision 34
Division 34
Order of operations 35
Complex numbers 37
2.3 WHAT’S IN A NAME? 38
2.4 USING FUNCTIONS 45

v
vi  Contents

Built-in functions 45
Strings 47
Modules 51
*2.5 BINARY ARITHMETIC 54
Finite precision 55
Negative integers 56
Designing an adder 57
Implementing an adder 58
2.6 SUMMARY 62
2.7 FURTHER DISCOVERY 62

Chapter 3  Visualizing abstraction 65


3.1 DATA ABSTRACTION 66
3.2 VISUALIZATION WITH TURTLES 70
Drawing with iteration 72
3.3 FUNCTIONAL ABSTRACTION 76
Function parameters 78
Let’s plant a garden 84
3.4 PROGRAMMING IN STYLE 89
Program structure 89
Documentation 91
Descriptive names and magic numbers 95
3.5 A RETURN TO FUNCTIONS 97
Return vs. print 100
3.6 SCOPE AND NAMESPACES 103
Local namespaces 104
The global namespace 107
3.7 SUMMARY 111
3.8 FURTHER DISCOVERY 112

Chapter 4  Growth and decay 113


4.1 DISCRETE MODELS 114
Managing a fishing pond 114
Measuring network value 121
Organizing a concert 124
4.2 VISUALIZING POPULATION CHANGES 136
4.3 CONDITIONAL ITERATION 140
Contents  vii

*4.4 CONTINUOUS MODELS 145


Difference equations 145
Radiocarbon dating 148
Tradeoffs between accuracy and time 150
Propagation of errors 152
Simulating an epidemic 153
*4.5 NUMERICAL ANALYSIS 159
The harmonic series 159
Approximating π 162
Approximating square roots 164
4.6 SUMMING UP 167
4.7 FURTHER DISCOVERY 171
4.8 PROJECTS 171
Project 4.1 Parasitic relationships 171
Project 4.2 Financial calculators 173
*Project 4.3 Market penetration 177
*Project 4.4 Wolves and moose 180

Chapter 5  Forks in the road 185


5.1 RANDOM WALKS 185
A random walk in Monte Carlo 192
Histograms 195
*5.2 PSEUDORANDOM NUMBER GENERATORS 200
Implementation 201
Testing randomness 203
*5.3 SIMULATING PROBABILITY DISTRIBUTIONS 205
The central limit theorem 206
5.4 BACK TO BOOLEANS 209
Short circuit evaluation 212
Complex expressions 214
*Using truth tables 216
Many happy returns 218
5.5 A GUESSING GAME 224
5.6 SUMMARY 233
5.7 FURTHER DISCOVERY 234
5.8 PROJECTS 234
viii  Contents

Project 5.1 The magic of polling 234


Project 5.2 Escape! 237

Chapter 6  Text, documents, and DNA 241


6.1 COUNTING WORDS 242
6.2 TEXT DOCUMENTS 250
Reading from text files 250
Writing to text files 253
Reading from the web 254
6.3 ENCODING STRINGS 259
Indexing and slicing 259
Creating modified strings 261
Encoding characters 263
6.4 LINEAR-TIME ALGORITHMS 270
Asymptotic time complexity 274
6.5 ANALYZING TEXT 279
Counting and searching 279
A concordance 284
6.6 COMPARING TEXTS 289
*6.7 GENOMICS 297
A genomics primer 297
Basic DNA analysis 301
Transforming sequences 302
Comparing sequences 304
Reading sequence files 306
6.8 SUMMARY 312
6.9 FURTHER DISCOVERY 313
6.10 PROJECTS 313
Project 6.1 Polarized politics 313
*Project 6.2 Finding genes 316

Chapter 7  Designing programs 321


7.1 HOW TO SOLVE IT 322
Understand the problem 323
Design an algorithm 324
Implement your algorithm as a program 327
Analyze your program for clarity, correctness, and efficiency 330
Contents  ix

*7.2 DESIGN BY CONTRACT 331


Preconditions and postconditions 331
Checking parameters 332
Assertions 334
*7.3 TESTING 340
Unit testing 340
Regression testing 342
Designing unit tests 343
Testing floating point values 347
7.4 SUMMARY 350
7.5 FURTHER DISCOVERY 350

Chapter 8  Data analysis 351


8.1 SUMMARIZING DATA 351
8.2 CREATING AND MODIFYING LISTS 360
List accumulators, redux 360
Lists are mutable 361
Tuples 365
List operators and methods 366
*List comprehensions 368
8.3 FREQUENCIES, MODES, AND HISTOGRAMS 373
Tallying values 373
Dictionaries 374
8.4 READING TABULAR DATA 384
*8.5 DESIGNING EFFICIENT ALGORITHMS 390
A first algorithm 391
A more elegant algorithm 399
A more efficient algorithm 400
*8.6 LINEAR REGRESSION 403
*8.7 DATA CLUSTERING 409
Defining similarity 410
A k-means clustering example 411
Implementing k-means clustering 414
Locating bicycle safety programs 416
8.8 SUMMARY 421
8.9 FURTHER DISCOVERY 421
x  Contents

8.10 PROJECTS 422


Project 8.1 Climate change 422
Project 8.2 Does education influence unemployment? 425
Project 8.3 Maximizing profit 427
Project 8.4 Admissions 428
*Project 8.5 Preparing for a 100-year flood 430
Project 8.6 Voting methods 435
Project 8.7 Heuristics for traveling salespeople 438

Chapter 9  Flatland 443


9.1 TWO-DIMENSIONAL DATA 443
9.2 THE GAME OF LIFE 449
Creating a grid 451
Initial configurations 452
Surveying the neighborhood 453
Performing one pass 454
Updating the grid 457
9.3 DIGITAL IMAGES 461
Colors 461
Image filters 463
Transforming images 467
9.4 SUMMARY 471
9.5 FURTHER DISCOVERY 471
9.6 PROJECTS 471
Project 9.1 Modeling segregation 471
Project 9.2 Modeling ferromagnetism 473
Project 9.3 Growing dendrites 474

Chapter 10  Self-similarity and recursion 477


10.1 FRACTALS 477
A fractal tree 479
A fractal snowflake 481
10.2 RECURSION AND ITERATION 488
Solving a problem recursively 491
Palindromes 492
Guessing passwords 495
10.3 THE MYTHICAL TOWER OF HANOI 500
Contents  xi

*Is the end of the world nigh? 502


10.4 RECURSIVE LINEAR SEARCH 503
Efficiency of recursive linear search 505
10.5 DIVIDE AND CONQUER 508
Buy low, sell high 508
Navigating a maze 512
*10.6 LINDENMAYER SYSTEMS 518
Formal grammars 518
Implementing L-systems 522
10.7 SUMMARY 525
10.8 FURTHER DISCOVERY 526
10.9 PROJECTS 526
*Project 10.1 Lindenmayer’s beautiful plants 526
Project 10.2 Gerrymandering 531
Project 10.3 Percolation 536

Chapter 11  Organizing data 541


11.1 BINARY SEARCH 542
Efficiency of iterative binary search 546
A spelling checker 548
Recursive binary search 549
Efficiency of recursive binary search 550
11.2 SELECTION SORT 553
Implementing selection sort 553
Efficiency of selection sort 557
Querying data 558
11.3 INSERTION SORT 563
Implementing insertion sort 564
Efficiency of insertion sort 566
11.4 EFFICIENT SORTING 570
Internal vs. external sorting 574
Efficiency of merge sort 574
*11.5 TRACTABLE AND INTRACTABLE ALGORITHMS 577
Hard problems 579
11.6 SUMMARY 580
11.7 FURTHER DISCOVERY 581
xii  Contents

11.8 PROJECTS 581


Project 11.1 Creating a searchable database 581
Project 11.2 Binary search trees 581

Chapter 12  Networks 587


12.1 MODELING WITH GRAPHS 588
Making friends 590
12.2 SHORTEST PATHS 594
Finding the actual paths 598
12.3 IT’S A SMALL WORLD. . . 601
Clustering coefficients 603
Scale-free networks 605
12.4 RANDOM GRAPHS 608
12.5 SUMMARY 611
12.6 FURTHER DISCOVERY 611
12.7 PROJECTS 612
Project 12.1 Diffusion of ideas and influence 612
Project 12.2 Slowing an epidemic 614
Project 12.3 The Oracle of Bacon 616

Chapter 13  Abstract data types 621


13.1 DESIGNING CLASSES 622
Implementing a class 625
Documenting a class 632
13.2 OPERATORS AND SPECIAL METHODS 637
String representations 637
Arithmetic 638
Comparison 640
Indexing 642
13.3 MODULES 645
Namespaces, redux 646
13.4 A FLOCKING SIMULATION 648
The World ADT 649
The Boid ADT 655
13.5 A STACK ADT 665
13.6 A DICTIONARY ADT 671
Hash tables 672
Contents  xiii

Implementing a hash table 673


Implementing indexing 676
ADTs vs. data structures 678
13.7 SUMMARY 682
13.8 FURTHER DISCOVERY 682
13.9 PROJECTS 683
Project 13.1 Tracking GPS coordinates 683
Project 13.2 Economic mobility 687
Project 13.3 Slime mold aggregation 690
Project 13.4 Boids in space 692

Appendix A  Installing Python 697


A.1 AN INTEGRATED DISTRIBUTION 697
A.2 MANUAL INSTALLATION 697

Appendix B  Python library reference 701


B.1 MATH MODULE 701
B.2 TURTLE METHODS 702
B.3 SCREEN METHODS 703
B.4 MATPLOTLIB.PYPLOT MODULE 704
B.5 RANDOM MODULE 704
B.6 STRING METHODS 705
B.7 LIST METHODS 706
B.8 IMAGE MODULE 706
B.9 SPECIAL METHODS 707

Bibliography 709

Index 713
This page intentionally left blank
Preface

n my view, an introductory computer science course should strive to accomplish


I three things. First, it should demonstrate to students how computing has become
a powerful mode of inquiry, and a vehicle of discovery, in a wide variety of disciplines.
This orientation is also inviting to students of the natural and social sciences, who
increasingly benefit from an introduction to computational thinking, beyond the
limited “black box” recipes often found in manuals. Second, the course should engage
students in computational problem solving, and lead them to discover the power of
abstraction, efficiency, and data organization in the design of their solutions. Third,
the course should teach students how to implement their solutions as computer
programs. In learning how to program, students more deeply learn the core principles,
and experience the thrill of seeing their solutions come to life.
Unlike most introductory computer science textbooks, which are organized
around programming language constructs, I deliberately lead with interdisciplinary
problems and techniques. This orientation is more interesting to a more diverse
audience, and more accurately reflects the role of programming in problem solv-
ing and discovery. A computational discovery does not, of course, originate in a
programming language feature in search of an application. Rather, it starts with
a compelling problem which is modeled and solved algorithmically, by leveraging
abstraction and prior experience with similar problems. Only then is the solution
implemented as a program.
Like most introductory computer science textbooks, I introduce programming
skills in an incremental fashion, and include many opportunities for students to prac-
tice them. The topics in this book are arranged to ease students into computational
thinking, and encourage them to incrementally build on prior knowledge. Each
chapter focuses on a general class of problems that is tackled by new algorithmic
techniques and programming language features. My hope is that students will leave
the course, not only with strong programming skills, but with a set of problem
solving strategies and simulation techniques that they can apply in their future
work, whether or not they take another computer science course.
I use Python to introduce computer programming for two reasons. First, Python’s
intuitive syntax allows students to focus on interesting problems and powerful
principles, without unnecessary distractions. Learning how to think algorithmically
is hard enough without also having to struggle with a non-intuitive syntax. Second,
the expressiveness of Python (in particular, low-overhead lists and dictionaries)
expands tremendously the range of accessible problems in the introductory course.
Teaching with Python over the last ten years has been a revelation; introductory
computer science has become fun again.

xv
xvi  Preface

Web resources
The text, exercises, and projects often refer to files on the book’s accompanying
web site, which can be found at

http://discoverCS.denison.edu .

This web site also includes pointers for further exploration, links to additional
documentation, and errata.

To students
Learning how to solve computational problems and implement them as computer
programs requires daily practice. Like an athlete, you will get out of shape and fall
behind quickly if you skip it. There are no shortcuts. Your instructor is there to
help, but he or she cannot do the work for you.
With this in mind, it is important that you type in and try the examples
throughout the text, and then go beyond them. Be curious! There are numbered
“Reflection” questions throughout the book that ask you to stop and think about, or
apply, something that you just read. Often, the question is answered in the book
immediately thereafter, so that you can check your understanding, but peeking
ahead will rob you of an important opportunity.
There are many opportunities to delve into topics more deeply. Boxes scattered
throughout the text briefly introduce related, but more technical, topics. For the
most part, these are not strictly required to understand what comes next, but I
encourage you to read them anyway. In the “Further discovery” section of each
chapter, you can find additional pointers to explore chapter topics in more depth.
At the end of most sections are several programming exercises that ask you
to further apply concepts from that section. Often, the exercises assume that you
have already worked through all of the examples in that section. All later chapters
conclude with a selection of more involved interdisciplinary projects that you may
be asked by your instructor to tackle.
The book assumes no prior knowledge of computer science. However, it does
assume a modest comfort with high school algebra and mathematical functions.
Occasionally, trigonometry is mentioned, as is the idea of convergence to a limit,
but these are not crucial to an understanding of the main topics in this book.

To instructors
This book may be appropriate for a traditional CS1 course for majors, a CS0 course
for non-majors (at a slower pace and omitting more material), or an introductory
computing course for students in the natural and/or social sciences.
As suggested above, I emphasize computer science principles and the role of
abstraction, both functional and data, throughout the book. I motivate functions
as implementations of functional abstractions, and point out that strings, lists,
and dictionaries are all abstract data types that allow us to solve more interesting
problems than would otherwise be possible. I introduce the idea of time complexity
Preface  xvii

Chapter 1 Chapter 2 Chapter 3


Chapter 4
What is Elementary Visualizing
Growth and decay
computation? computations abstraction

Chapter 7 Chapter 6
Chapter 8 Chapter 5
Designing Text, documents,
Data analysis Forks in the road
programs and DNA

Chapter 10
Chapter 9 Chapter 11
Self-similarity and
Flatland Organizing data
recursion

Chapter 13
Chapter 12
Abstract data
Networks
types

Figure 1 An overview of chapter dependencies.

intuitively, without formal definitions, in the first chapter and return to it several
times as more sophisticated algorithms are developed. The book uses a spiral
approach for many topics, returning to them repeatedly in increasingly complex
contexts. Where appropriate, I also weave into the book topics that are traditionally
left for later computer science courses. A few of these are presented in boxes that
may be covered at your discretion. None of these topics is introduced rigorously, as
they would be in a data structures course. Rather, I introduce them informally and
intuitively to give students a sense of the problems and techniques used in computer
science. I hope that the tables below will help you navigate the book, and see where
particular topics are covered.
This book contains over 600 end-of-section exercises and over 300 in-text reflection
questions that may be assigned as homework or discussed in class. At the end of
most chapters is a selection of projects (about 30 in all) that students may work on
independently or in pairs over a longer time frame. I believe that projects like these
are crucial for students to develop both problem solving skills and an appreciation
for the many fascinating applications of computer science.
Because this book is intended for a student who may take additional courses in
computer science and learn other programming languages, I intentionally omit some
features of Python that are not commonly found elsewhere (e.g., simultaneous swap,
chained comparisons, enumerate in for loops). You may, of course, supplement
with these additional syntactical features.
There is more in this book than can be covered in a single semester, giving an
instructor the opportunity to tailor the content to his or her particular situation and
interests. Generally speaking, as illustrated in Figure 1, Chapters 1–6 and 8 form the
core of the book, and should be covered sequentially. The remaining chapters can be
covered, partially or entirely, at your discretion, although I would expect that most
instructors will cover at least parts of Chapters 7, 10, 11, and 13. Chapter 7 contains
xviii  Preface

additional material on program design, including design by contract, assertions and


unit testing that may be skipped without consequences for later chapters. Chapters
9–13 are, more or less, independent of each other. Sections marked with an asterisk
are optional, in the sense that they are not assumed for future sections in that
chapter. When projects depend on optional sections, they are also marked with an
asterisk, and the dependency is stated at the beginning of the project.

Chapter outlines
The following tables provide brief overviews of each chapter. Each table’s three
columns, reflecting the three parts of the book’s subtitle, provide three lenses through
which to view the chapter. The first column lists a selection of representative problems
that are used to motivate the material. The second column lists computer science
principles that are introduced in that chapter. Finally, the third column lists Python
programming topics that are either introduced or reinforced in that chapter to
implement the principles and/or solve the problems.

Chaper 1. What is computation?


Sample problems Principles Programming
• digital music • problems, input/output —
• search engines • abstraction
• GPS devices • algorithms and programs
• smoothing data • computer architecture
• phone trees • binary representations
• time complexity
• Turing machine

Chapter 2. Elementary computations


Sample problems Principles Programming
• wind chill • finite precision • int and float numeric types
• geometry • names as references • arithmetic and the math module
• compounding • using functional • variable names and assignment
interest abstractions • calling built-in functions
• Mad Libs • binary addition • using strings, + and * operators
• print and input

Chapter 3. Visualizing abstraction


Sample problems Principles Programming
• visualizing an • using abstract data types • using classes and objects
archaeological dig • creating functional • turtle module
• random walks abstractions • basic for loops
• ideal gas • basic functional • writing functions
• groundwater flow decomposition • namespaces
• demand functions • docstrings and comments
Preface  xix

Chapter 4. Growth and decay


Sample problems Principles Programming
• network value • accumulators • for loops
• demand and profit • list accumulators • format strings
• loans and investing • difference equations • range
• bacterial growth • approximating continuous • matplotlib
• radiocarbon dating models • appending to lists
• diffusion models • accuracy vs. time • while loops
– SIR, SIS, Bass • error propagation
• competition models • numerical approximation
– Nicholson-Bailey • classes of growth
– Lotka-Volterra
– indirect

Chapter 5. Forks in the road


Sample problems Principles Programming
• random walks • Monte Carlo simulation • random module
• guessing games • pseudorandom number • if/elif/else
• polling and generators • comparison operators
sampling • simulating probabilities • Boolean operators
• particle escape • flag variables • matplotlib histograms
• using uniform and normal • while loops
distributions
• DeMorgan’s laws

Chapter 6. Text, documents, and DNA


Sample problems Principles Programming
• word count • ASCII, Unicode • str class and methods
• textual analysis • linear-time algorithms • iterating over strings
• parsing XML • asymptotic time complexity • indexing and slices
• checksums • linear search • iterating over indices
• concordances • dot plots • reading and writing text files
• detecting plagiarism • string accumulators • nested loops
• congressional votes
• genomics

Chapter 7. Designing programs


Sample problems Principles Programming
• word frequency • problem solving • assert statement
analysis • top-down design • conditional execution
• pre and postconditions of main
• assertions • writing modules
• unit testing
xx  Preface

Chapter 8. Data analysis


Sample problems Principles Programming
• 100-year floods • histograms • list class
• traveling salesman • hash tables • iterating over lists
• Mohs scale • tabular data files • indexing and slicing
• meteorite sites • efficient algorithms • list operators and methods
• zebra migration • linear regression • lists in memory; mutability
• tumor diagnosis • k-means clustering • list parameters
• education levels • heuristics • tuples
• supply and demand • list comprehensions
• voting methods • dictionaries

Chapter 9. Flatland
Sample problems Principles Programming
• earthquake data • 2-D data • 2-D data in list of lists
• Game of Life • cellular automata • nested loops
• image filters • digital images • 2-D data in a dictionary
• racial segregation • color models
• ferromagnetism
• dendrites

Chapter 10. Self-similarity and recursion


Sample problems Principles Programming
• fractals • self-similarity • writing recursive functions
• cracking passwords • recursion
• Tower of Hanoi • linear search
• maximizing profit • recurrence relations
• path through a maze • divide and conquer
• Lindenmayer system • depth-first search
• electoral districting • grammars
• percolation

Chapter 11. Organizing data


Sample problems Principles Programming
• spell check • binary search • nested loops
• querying data sets • recurrence relations • writing recursive functions
• basic sorting algorithms
• quadratic-time algorithms
• parallel lists
• merge sort
• intractability
• P=NP (intuition)
• Moore’s law
• binary search trees
Preface  xxi

Chapter 12. Networks


Sample problems Principles Programming
• Facebook, Twitter, • graphs • dictionaries
web graphs • adjacency list
• diffusion of ideas • adjacency matrix
• epidemics • breadth-first search
• Oracle of Bacon • distance and shortest paths
• depth-first search
• small-world networks
• scale-free networks
• clustering coefficient
• uniform random graphs

Chapter 13. Abstract data types


Sample problems Principles Programming
• data sets • abstract data types • writing classes
• genomic sequences • data structures • special methods
• rational numbers • stacks • overriding operators
• flocking behavior • hash tables • modules
• slime mold • agent-based simulation
aggregation • swarm intelligence

Software assumptions
To follow along in this book and complete the exercises, you will need to have installed
Python 3.4 (or later) on your computer, and have access to IDLE or another
programming environment. The book also assumes that you have installed the
matplotlib and numpy modules. Please refer to Appendix A for more information.

Errata
While I (and my students) have ferreted out many errors, readers will inevitably
find more. You can find an up-to-date list of errata on the book web site. If
you find an error in the text or have another suggestion, please let me know at
havill@denison.edu.
This page intentionally left blank
Acknowledgments

was extraordinarily naı̈ve when I embarked on this project two years ago. “How
I hard can it be to put these ideas into print?” Well, much harder than I thought,
as it turns out. I owe debts of gratitude to many who saw me through to the end.
First and foremost, my family not only tolerated me during this period, but
offered extraordinary support and encouragement. Thank you Beth, for your patience
and strength, and all of the time you have made available to me to work on the
book. I am grateful to my in-laws, Roger and Nancy Vincent, who offered me their
place in Wyoming for a month-long retreat in the final stretch. And, to my four
children, Nick, Amelia, Caroline, and Lillian, I promise to make up for lost time.
My colleagues Matt Kretchmar, Ashwin Lall, and David White used drafts in
their classes, and provided invaluable feedback. They have been fantastic sounding
boards, and have graciously provided many ideas for exercises and projects. Students
in Denison University’s CS 111 and 112 classes caught many typos, especially Gabe
Schenker, Christopher Castillo, Christine Schmittgen, Alivia Tacheny, Emily Lamm,
and Ryan Liedke. Dana Myers read much of the book and offered an abundance of
detailed suggestions. Joan Krone also read early chapters and offered constructive
feedback. I am grateful to Todd Feil for his support, and his frank advice after
reading the almost-final manuscript.
I have benefitted tremendously from many conversations about computational
science, geology, and life with my friend and colleague David Goodwin. Project 8.1
is based on an assignment that he has used in his classes. I have also learned a great
deal from collaborations with Jeff Thompson. Jeff also advised me on Section 6.7
and Project 6.2. Frank Hassebrock enthusiastically introduced me to theories of
problem solving in cognitive psychology. And Dee Ghiloni, the renowned cat herder,
has supported me and my work in more ways than I can count.
I am indebted to the following reviewers, who read early chapters and offered
expert critiques: Terry Andres (University of Manitoba), John Impagliazzo (Qatar
University), Daniel Kaplan (Macalester College), Nathaniel Kell (Duke University),
Andrew McGettrick (University of Strathclyde); Hamid Mokhtarzadeh (University
of Minnesota), George Novacky (University of Pittsburgh), and J. F. Nystrom (Ferris
State University).
I could not have completed this book without the Robert C. Good Fellowship
awarded to me by Denison University.
Finally, thank you to Randi Cohen, for believing in this project, and for her
advice and patience throughout.

xxiii
This page intentionally left blank
About the author

Jessen Havill is a Professor of Computer Science and the Benjamin Barney Chair
of Mathematics at Denison University, where he has been on the faculty since 1998.
Dr. Havill teaches courses across the computer science curriculum, as well as an
interdisciplinary elective in computational biology. He was awarded the college’s
highest teaching honor, the Charles A. Brickman Teaching Excellence Award, in
2013.
Dr. Havill is also an active researcher, with a primary interest in the development
and analysis of online algorithms. In addition, he has collaborated with colleagues
in biology and geosciences to develop computational tools to support research
and teaching in those fields. Dr. Havill earned his bachelor’s degree from Bucknell
University and his Ph.D. in computer science from The College of William and
Mary.

xxv
This page intentionally left blank
CHAPTER 1

What is computation?

We need to do away with the myth that computer science is about computers. Computer
science is no more about computers than astronomy is about telescopes, biology is about
microscopes or chemistry is about beakers and test tubes. Science is not about tools, it is
about how we use them and what we find out when we do.

Michael R. Fellows and Ian Parberry


Computing Research News (1993)

omputers are the most powerful tools ever invented, but not because of their
C versatility and speed, per se. Computers are powerful because they empower
us to innovate and make unprecedented discoveries.
A computer is a machine that carries out a computation, a sequence of simple
steps that transforms some initial information, an input, into some desired result,
the output. Computer scientists harness the power of computers to solve complex
problems by designing solutions that can be expressed as computations. The output
of a computation might be a more efficient route for a spacecraft, a more effective
protocol to control an epidemic, or a secret message hidden in a digital photograph.
Computer science has always been interdisciplinary, as computational problems
arise in virtually every domain imaginable. Social scientists use computational models
to better understand social networks, epidemics, population dynamics, markets,
and auctions. Scholars working in the digital humanities use computational tools to
curate and analyze classic literature. Artists are increasingly incorporating digital
technologies into their compositions and performances. Computational scientists
work in areas related to climate prediction, genomics, particle physics, neuroscience,
and drug discovery.
In this book, we will explore the fundamental problem solving techniques of
computer science, and discover how they can be used to model and solve a variety of
interdisciplinary problems. In this first chapter, we will provide an orientation and
lay out the context in which to place the rest of the book. We will further develop
all of these ideas throughout, so don’t worry if they are not all crystal clear at first.

1
2  What is computation?

mp3 music player

music recording sound

search engine
search terms
search results

Buxton Inn
313 E Broadway GPS device
Granville, OH 43023

address directions

Figure 1.1 Some examples of computational problems.

1.1 PROBLEMS AND ABSTRACTION


Every useful computation solves a problem of some sort. A problem is fundamentally
defined by the relationship between its input and its output, as illustrated in Fig-
ure 1.1. For each problem, we have an input entering on the left and a corresponding
output exiting on the right. In between, a computation transforms the input into a
correct output. When you listen to a song, the music player performs a computation
to convert the digital music file (input) into a sound pattern (output). When you
submit a web search request (input), your computer, and many others across the
Internet, perform computations to get you results (outputs). And when you use GPS
navigation, a device computes directions (output) based on your current position,
your destination, and its stored maps (inputs).
Inputs and outputs are probably also familiar to you from high school algebra.
When you were given an expression like

y = 18x + 31

or
f (x) = 18x + 31,
you may have thought about the variable x as a representation of the input and
y, or f (x), as a representation of the output. In this example, when the input is
x = 2, the output is y = 67, or f (x) = 67. The arithmetic that turns x into y is a
very simple (and boring) example of a computation.

Reflection 1.1 What kinds of problems are you interested in? What are their inputs
and outputs? Are the inputs and outputs, as you have defined them, sufficient to
define the problem completely?
Random documents with unrelated
content Scribd suggests to you:
The Project Gutenberg eBook of Placebo
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.

Title: Placebo

Author: David Mason

Release date: February 5, 2022 [eBook #67324]

Language: English

Original publication: United States: Royal Publications, Inc

Credits: Greg Weeks, Mary Meehan and the Online Distributed


Proofreading Team at http://www.pgdp.net

*** START OF THE PROJECT GUTENBERG EBOOK PLACEBO ***


PLACEBO
By DAVID MASON

Each 1955 was worse than the last!

[Transcriber's Note: This etext was produced from


Infinity Science Fiction, November 1955.
Extensive research did not uncover any evidence that
the U.S. copyright on this publication was renewed.]
The object appeared in the middle of Main Way, about fifty feet from
the statue of Vachel Lindsay, and at least a hundred from anything
else. It was much too big and complicated to have been hidden
anywhere, and it hadn't any wheels, tracks, wings, or other visible
means of movement.
Corrigan, looking the object over, decided that it could not have
come from any logical place in the world. Not being prejudiced, he
then thought a little about the illogical places, and the places that
weren't in the world. Corrigan decided that it must be another
attempt at time travel, and he clucked his tongue sympathetically.
Well, someone had to break the news. Corrigan arose from the grass
and walked toward the object.
There was a young man sitting in the object, on a sort of high
saddle. He looked a little wild-eyed, and he seemed to be talking to
himself, as he pulled and twisted at the rows of controls in front of
him. Corrigan, looking up at him, decided that he couldn't be very
healthy, and that the stiff gray garments he wore must be extremely
uncomfortable.
"Greetings, traveler," Corrigan called.
"You're speaking Anglish!" the young man exclaimed. "Good! Maybe
I can get some help here. What year is this?"
"1955, by most systems."
The young man turned a little paler.
"I've just left 1955," he said unhappily. "Four times, in fact. Four
different 1955's. And each one's a bit worse. Now the machine won't
work."
"Your theory's wrong," Corrigan said calmly. "Hasn't it occurred to
you yet that time travel might be impossible?"
The young man made a choked sound. He began to climb down
from his perch, keeping his eyes fixed suspiciously on Corrigan as he
did so. He saw Corrigan as a small brown man, dressed in loose blue
trousers, barefooted, and with a puff of white hair that seemed
never to have been properly cut. The lawns and grassy roads, the
bright and impermanent-looking buildings, and Corrigan himself, all
added up to one thing in the young man's mind.
"You're wrong," Corrigan said. "I'm not a lunatic, and this isn't an
asylum. We don't have them."
The young man, on the ground now, stared at Corrigan in evident
horror.
"Mind reading?"
"More or less," Corrigan said. "It saves time. For instance, you're
Darwin Lenner, and you'd like very much to get back to wherever
you started from. In fact, you have to, or something unpleasant
might happen to you, by your standards."
"I'd be absent without permission," Lenner admitted. "I ... I wish
you wouldn't do that."
"Only when absolutely necessary," Corrigan smiled. "I'm a
philosopher by trade, myself, not a mind reader. My name's Philip
Corrigan, and I'd be very glad to help you on your way ... but I think
it might be a little difficult. We aren't really a very mechanically-
minded people here."
Lenner ran his hands through his hair. "I've got to get back. Isn't
there anybody who knows something about time machines?"
Corrigan had been thinking swiftly. He had also been carrying on a
conversation which Lenner could not possibly hear, with a man who
was several miles away.
"Burwell, he wants to go home."
"Fine. He ought to. Why doesn't he?"
"He lost his confidence. He thinks his machine's broken down."
"That kind, eh? I suppose the thing never really did work very well."
"Most of them don't. They go traveling around hit-or-miss through
probability under the operator's own mental steam—but this fellow
probably comes from a world where an idea like that's illegal."
"Sounds like it. Corrigan, take him on a guided tour or something,
and keep him busy. I'll be over as soon as I can. I'm going to do
something for his self-confidence. Here's the story to give him...."

Corrigan had always enjoyed conducting guided tours, and he was


enjoying this one especially well. He had a slightly wicked taste for
complicated teasing, and Lenner was a perfect object. He had
evidently come from one of the more unpleasant probabilities, a
world full of complex rules and harshly restrictive; everything that he
saw bothered him. The handsome girls, wearing unstrategically
placed flowers and very little else; the flocks of children, as plentiful
as pigeons and apparently as free of supervision; the almost total
absence of anybody actually performing useful work ... all of it
contributed to Lenner's increasing nervousness.
The guided tour went in a wide circle, and Lenner and Corrigan
wound up sitting in a tavern facing on Main Way. Lenner ignored the
green drink before him and peered unhappily out the big window
toward his machine.
"Where is that friend of yours?" he asked, for the fifth time.
"He'll be here," Corrigan assured him. "Why hurry? Don't you like it
here?"
Lenner's mouth hardened. He looked around him, and shook his
head.
"No." He spoke almost apologetically, "I'm sorry ... well, look, old
fellow, no hard feelings, I hope. But this world of yours is primitive.
Degenerate, I'd say."
"Primitive?"
"No laws—not even morals! Those girls ... and of course, you don't
have any civilized advantages. Not even ground transportation. That
man you spoke of has to walk here. And that's something else I
don't understand. You say he's another time traveler...."
"Probability traveler, actually," Corrigan corrected.
"All right, probability. Why does he stay here? Why would a really
intelligent man give up civilization?"
"Well, you know how it is. He's gone native, you might say. Life
among the lotus eaters, and all that. Might happen to anybody, even
yourself."
Lenner shuddered.
"It's all right, though." Corrigan continued. "He'll be here any
minute, and I'm sure he'll be able to help. Knows all there is to know
about these machines. In fact, here he comes now."
Burwell entered, and Corrigan could hardly suppress a small chuckle.
Burwell had picked up Lenner's ideas about what a man of
intelligence and authority ought to look like, and had gone to some
trouble to look the part. He was wearing a uniform of some sort,
spectacles, and an expression of extreme wisdom.
"I'm sure I can repair what's wrong," Burwell told Lenner. "Let's go
and look at your machine."
Arriving, Burwell climbed over the mechanism with an air of bored
ability, occasionally thumping at something, adjusting something
else, or hitting a part with a tool until it rang. He muttered to himself
as he worked, allowing the sound of his musings to drift in Lenner's
direction.
"Umm ... badly twisted impeller ... the varish is more or less waffled
... let's see if ... ah, there we are."
He climbed down and solemnly shook hands with Lenner.
"Fine machine you've got there, my boy. It'll take you back to your
own place quite easily now. There wasn't a thing wrong except the
drift crotch. However, I wouldn't use it again if I were you. There's
no real control on these things. A man could end up anywhere. And
of course, you'd never find your way back here, without control."
"Well, thanks..." Lenner said doubtfully. He glanced around. "It's a
shame there's no way we could regularly communicate between our
worlds. There's a lot we could do for this one."
"I'm sure of that," Burwell said, hastily looking away. "But it isn't
worth the danger and difficulty of reaching us. For myself, it doesn't
matter any more." He assumed a nobly tragic expression. "But you
are young; you've got your life ahead of you; your State and your
society need you. I'm glad to help you on your way."
Lenner mounted the machine, and Burwell beamed a thought at
Corrigan.
"I've convinced him that the thing works, and that it would not be
easy to come back. Actually, that machine of his is a real work of art.
It doesn't do a damn thing. This boy comes from a place where they
have to have a mechanical crutch for everything. His gadgets are
pink pill stuff ... something to convince him he can do things he
could do anyway. All we have to do now is give him a small mental
shove to help him along, and he'll be home in no time. All right, now
—SHOVE!"
Corrigan and Burwell shoved. Lenner and his machine faded and
were gone, leaving only a flattened place on the grass.
"Brrr," Burwell said. "Am I glad that worked! If he'd stayed another
week or so we would have had our first lunatic of the century."
"Or worse," Corrigan said, stirring the grass with his toes. "Did you
get what he was thinking about when he talked about his world and
ours getting into touch, and civilizing us?"
"I got it, all right." Burwell said. "The fellow's mind was a swamp. A
real primitive. And just like any other primitive, all he needed was a
placebo from a witch doctor. Me, in my savage regalia. Just let me
get this thing with the glass in it off my nose, and these button
things opened up a bit, and we can get on with that chess game. I
hope the next traveler picks somewhere else to land, though—I've
never felt so silly in my life!"
*** END OF THE PROJECT GUTENBERG EBOOK PLACEBO ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
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!

ebooknice.com

You might also like