Introduction to Computation and Programming Using Python, 3e
with Application to Computational Modeling and Understanding Data
by Guttag
ISBN: 9780262363440  Copyright 2021
Instructor Requests
Expand/Collapse All  

PREFACE (pg. xv)  
ACKNOWLEDGMENTS (pg. xix)  
1 GETTING STARTED (pg. 1)  
1.1 Terms Introduced in Chapter (pg. 9)  
2 INTRODUCTION TO PYTHON (pg. 11)  
Installing Python and Python IDEs (pg. 13)  
2.2 The Basic Elements of Python (pg. 15)  
2.2.1 Objects, Expressions, and Numerical Types (pg. 16)  
2.2.2 Variables and Assignment (pg. 19)  
2.3 Branching Programs (pg. 21)  
2.4 Strings and Input (pg. 27)  
2.4.1 Input (pg. 31)  
2.4.2 A Digression about Character Encoding (pg. 32)  
2.5 While Loops (pg. 33)  
2.6 For Loops and Range (pg. 37)  
2.7 Style Matters (pg. 41)  
2.8 Terms Introduced in Chapter (pg. 42)  
3 SOME SIMPLE NUMERICAL PROGRAMS (pg. 45)  
Exhaustive Enumeration (pg. 45)  
3.2 Approximate Solutions and Bisection Search (pg. 50)  
3.3 A Few Words about Using Floats (pg. 56)  
3.4 Newton–Raphson (pg. 60)  
3.5 Terms Introduced in Chapter (pg. 62)  
4 FUNCTIONS, SCOPING, AND ABSTRACTION (pg. 63)  
Functions and Scoping (pg. 66)  
4.1.1 Function Definitions (pg. 66)  
4.1.2 Keyword Arguments and Default Values (pg. 70)  
4.1.3 Variable Number of Arguments (pg. 72)  
4.1.4 Scoping (pg. 73)  
4.2 Specifications (pg. 78)  
4.3 Using Functions to Modularize Code (pg. 82)  
4.4 Functions as Objects (pg. 84)  
4.5 Methods, Oversimplified (pg. 86)  
4.6 Terms Introduced in Chapter (pg. 87)  
5 STRUCTURED TYPES AND MUTABILITY (pg. 89)  
Tuples (pg. 89)  
5.1.1 Multiple Assignment (pg. 91)  
5.2 Ranges and Iterables (pg. 92)  
5.3 Lists and Mutability (pg. 93)  
5.3.1 Cloning (pg. 100)  
5.3.2 List Comprehension (pg. 103)  
5.4 HigherOrder Operations on Lists (pg. 105)  
5.5 Strings, Tuples, Ranges, and Lists (pg. 107)  
5.6 Sets (pg. 110)  
5.7 Dictionaries (pg. 112)  
5.8 Dictionary Comprehension (pg. 118)  
5.9 Terms Introduced in Chapter (pg. 121)  
6 RECURSION AND GLOBAL VARIABLES (pg. 123)  
Fibonacci Numbers (pg. 125)  
6.2 Palindromes (pg. 128)  
6.3 Global Variables (pg. 132)  
6.4 Terms Introduced in Chapter (pg. 134)  
7 MODULES AND FILES (pg. 135)  
Modules (pg. 135)  
7.2 Using Predefined Packages (pg. 138)  
7.3 Files (pg. 142)  
7.4 Terms Introduced in Chapter (pg. 145)  
8 TESTING AND DEBUGGING (pg. 147)  
Testing (pg. 148)  
8.1.1 BlackBox Testing (pg. 149)  
8.1.2 GlassBox Testing (pg. 152)  
8.1.3 Conducting Tests (pg. 154)  
8.2 Debugging (pg. 156)  
8.2.1 Learning to Debug (pg. 159)  
8.2.2 Designing the Experiment (pg. 160)  
8.2.3 When the Going Gets Tough (pg. 164)  
8.2.4 When You Have Found “The” Bug (pg. 165)  
8.3 Terms Introduced in Chapter (pg. 166)  
9 EXCEPTIONS AND ASSERTIONS (pg. 167)  
Handling Exceptions (pg. 168)  
9.2 Exceptions as a Control Flow Mechanism (pg. 174)  
9.3 Assertions (pg. 176)  
9.4 Terms Introduced in Chapter (pg. 176)  
10 CLASSES AND OBJECTORIENTED PROGRAMMING (pg. 177)  
Abstract Data Types and Classes (pg. 178)  
10.1.1 Magic Methods and Hashable Types (pg. 184)  
10.1.2 Designing Programs Using Abstract Data Types (pg. 186)  
10.1.3 Using Classes to Keep Track of Students and Faculty (pg. 187)  
10.2 Inheritance (pg. 190)  
10.2.1 Multiple Levels of Inheritance (pg. 194)  
10.2.2 The Substitution Principle (pg. 196)  
10.3 Encapsulation and Information Hiding (pg. 197)  
10.3.1 Generators (pg. 203)  
10.4 An Extended Example (pg. 206)  
10.5 Terms Introduced in Chapter (pg. 212)  
11 A SIMPLISTIC INTRODUCTION TO ALGORITHMIC COMPLEXITY (pg. 213)  
Thinking about Computational Complexity (pg. 214)  
11.2 Asymptotic Notation (pg. 218)  
11.3 Some Important Complexity Classes (pg. 221)  
11.3.1 Constant Complexity (pg. 221)  
11.3.2 Logarithmic Complexity (pg. 221)  
11.3.3 Linear Complexity (pg. 223)  
11.3.4 LogLinear Complexity (pg. 224)  
11.3.5 Polynomial Complexity (pg. 224)  
11.3.6 Exponential Complexity (pg. 226)  
11.3.7 Comparisons of Complexity Classes (pg. 228)  
11.4 Terms Introduced in Chapter (pg. 231)  
12 SOME SIMPLE ALGORITHMS AND DATA STRUCTURES (pg. 233)  
Search Algorithms (pg. 234)  
12.1.1 Linear Search and Using Indirection to Access Elements (pg. 235)  
12.1.2 Binary Search and Exploiting Assumptions (pg. 237)  
12.2 Sorting Algorithms (pg. 241)  
12.2.1 Merge Sort (pg. 243)  
12.2.2 Sorting in Python (pg. 247)  
12.3 Hash Tables (pg. 250)  
12.4 Terms Introduced in Chapter (pg. 255)  
13 PLOTTING AND MORE ABOUT CLASSES (pg. 257)  
Plotting Using Matplotlib (pg. 257)  
13.2 Plotting Mortgages, an Extended Example (pg. 263)  
13.3 An Interactive Plot for an Infectious Disease (pg. 271)  
13.4 Terms Introduced in Chapter (pg. 279)  
14 KNAPSACK AND GRAPH OPTIMIZATION PROBLEMS (pg. 281)  
Knapsack Problems (pg. 282)  
14.1.1 Greedy Algorithms (pg. 283)  
14.1.2 An Optimal Solution to the 0/1 Knapsack Problem (pg. 287)  
14.2 Graph Optimization Problems (pg. 291)  
14.2.1 Some Classic GraphTheoretic Problems (pg. 297)  
14.2.2 Shortest Path: DepthFirst Search and BreadthFirst Search (pg. 297)  
14.3 Terms Introduced in Chapter (pg. 304)  
15 DYNAMIC PROGRAMMING (pg. 305)  
Fibonacci Sequences, Revisited (pg. 306)  
15.2 Dynamic Programming and the 0/1 Knapsack Problem (pg. 309)  
15.3 Dynamic Programming and DivideandConquer (pg. 319)  
15.4 Terms Introduced in Chapter (pg. 320)  
16 RANDOM WALKS AND MORE ABOUT DATA VISUALIZATION (pg. 321)  
Random Walks (pg. 322)  
16.2 The Drunkard’s Walk (pg. 323)  
16.3 Biased Random Walks (pg. 331)  
16.4 Treacherous Fields (pg. 338)  
16.5 Terms Introduced in Chapter (pg. 340)  
17 STOCHASTIC PROGRAMS, PROBABILITY, AND DISTRIBUTIONS (pg. 341)  
Stochastic Programs (pg. 342)  
17.2 Calculating Simple Probabilities (pg. 344)  
17.3 Inferential Statistics (pg. 346)  
17.4 Distributions (pg. 366)  
17.4.1 Probability Distributions (pg. 369)  
17.4.2 Normal Distributions (pg. 371)  
17.4.3 Continuous and Discrete Uniform Distributions (pg. 378)  
17.4.4 Binomial and Multinomial Distributions (pg. 379)  
17.4.5 Exponential and Geometric Distributions (pg. 381)  
17.4.6 Benford’s Distribution (pg. 385)  
17.5 Hashing and Collisions (pg. 386)  
17.6 How Often Does the Better Team Win? (pg. 389)  
17.7 Terms Introduced in Chapter (pg. 391)  
18 MONTE CARLO SIMULATION (pg. 393)  
Pascal’s Problem (pg. 394)  
18.2 Pass or Don’t Pass? (pg. 396)  
18.3 Using Table Lookup to Improve Performance (pg. 401)  
18.4 Finding ( (pg. 403)  
18.5 Some Closing Remarks about Simulation Models (pg. 409)  
18.6 Terms Introduced in Chapter (pg. 411)  
19 SAMPLING AND CONFIDENCE (pg. 413)  
Sampling the Boston Marathon (pg. 414)  
19.2 The Central Limit Theorem (pg. 422)  
19.3 Standard Error of the Mean (pg. 427)  
19.4 Terms Introduced in Chapter (pg. 430)  
20 UNDERSTANDING EXPERIMENTAL DATA (pg. 431)  
The Behavior of Springs (pg. 431)  
20.1.1 Using Linear Regression to Find a Fit (pg. 435)  
20.2 The Behavior of Projectiles (pg. 443)  
20.2.1 Coefficient of Determination (pg. 445)  
20.2.2 Using a Computational Model (pg. 447)  
20.3 Fitting Exponentially Distributed Data (pg. 449)  
20.4 When Theory Is Missing (pg. 454)  
20.5 Terms Introduced in Chapter (pg. 455)  
21 RANDOMIZED TRIALS AND HYPOTHESIS CHECKING (pg. 457)  
Checking Significance (pg. 458)  
21.2 Beware of Pvalues (pg. 466)  
21.3 Onetail and Onesample Tests (pg. 469)  
21.4 Significant or Not? (pg. 471)  
21.5 Which N? (pg. 474)  
21.6 Multiple Hypotheses (pg. 476)  
21.7 Conditional Probability and Bayesian Statistics (pg. 479)  
21.7.1 Conditional Probabilities (pg. 481)  
21.7.2 Bayes’ Theorem (pg. 483)  
21.8 Terms Introduced in Chapter (pg. 486)  
22 LIES, DAMNED LIES, AND STATISTICS (pg. 487)  
Garbage In Garbage Out (GIGO) (pg. 488)  
22.2 Tests Are Imperfect (pg. 489)  
22.3 Pictures Can Be Deceiving (pg. 490)  
Cum Hoc Ergo Propter Hoc (pg. 494)  
22.5 Statistical Measures Don’t Tell the Whole Story (pg. 497)  
22.6 Sampling Bias (pg. 499)  
22.7 Context Matters (pg. 500)  
22.8 Comparing Apples to Oranges (pg. 501)  
22.9 Picking Cherries (pg. 502)  
22.10 Beware of Extrapolation (pg. 502)  
22.11 The Texas Sharpshooter Fallacy (pg. 503)  
22.12 Percentages Can Confuse (pg. 507)  
22.13 The Regressive Fallacy (pg. 508)  
22.14 Statistically Significant Differences Can Be Insignificant (pg. 509)  
22.15 Just Beware (pg. 510)  
22.16 Terms Introduced in Chapter (pg. 510)  
23 EXPLORING DATA WITH PANDAS (pg. 511)  
DataFrames and CSV Files (pg. 511)  
23.2 Creating Series and DataFrames (pg. 514)  
23.3 Selecting Columns and Rows (pg. 518)  
23.3.1 Selection Using loc and iloc (pg. 520)  
23.3.2 Selection by Group (pg. 524)  
23.3.3 Selection by Content (pg. 525)  
23.4 Manipulating the Data in a DataFrame (pg. 527)  
23.5 An Extended Example (pg. 530)  
23.5.1 Temperature Data (pg. 530)  
23.5.2 Fossil Fuel Consumption (pg. 541)  
23.6 Terms Introduced in Chapter (pg. 544)  
24 A QUICK LOOK AT MACHINE LEARNING (pg. 545)  
Feature Vectors (pg. 549)  
24.2 Distance Metrics (pg. 552)  
24.3 Terms Introduced in Chapter (pg. 559)  
25 CLUSTERING (pg. 561)  
Class Cluster (pg. 563)  
25.2 Kmeans Clustering (pg. 566)  
25.3 A Contrived Example (pg. 569)  
25.4 A Less Contrived Example (pg. 576)  
25.5 Terms Introduced in Chapter (pg. 583)  
26 CLASSIFICATION METHODS (pg. 585)  
Evaluating Classifiers (pg. 586)  
26.2 Predicting the Gender of Runners (pg. 591)  
26.3 Knearest Neighbors (pg. 593)  
26.4 Regressionbased Classifiers (pg. 599)  
26.5 Surviving the Titanic (pg. 612)  
26.6 Wrapping Up (pg. 618)  
26.7 Terms Introduced in Chapter (pg. 618)  
PYTHON 3.8 QUICK REFERENCE (pg. 619) 
John V. Guttag
John V. Guttag is the Dugald C. Jackson Professor of Computer Science and Electrical Engineering at MIT.
eTextbook
Go paperless today! Available online anytime, nothing to download or install.
