Math Adventures with Python : An Illustrated Guide to Exploring Math with Code

個数:

Math Adventures with Python : An Illustrated Guide to Exploring Math with Code

  • 提携先の海外書籍取次会社に在庫がございます。通常9日~2週間で発送いたします。
    重要ご説明事項
    1. 納期遅延や、ご入手不能となる場合が若干ございます。
    2. 複数冊ご注文の場合、分割発送となる場合がございます。
    3. 美品のご指定は承りかねます。
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 276 p.
  • 言語 ENG,ENG
  • 商品コード 9781593278670
  • DDC分類 510.2855133

Table of Contents

About the Author                                   vi
About the Technical Reviewer vi
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 xxiv
PART I HITCHIN' UP YOUR PYTHON WAGON
1 Drawing Polygons With The Turtle Module 3 (16)
Python's turtle Module 4 (3)
Importing the turtle Module 4 (1)
Moving Your Turtle 5 (1)
Changing Directions 6 (1)
Repeating Code with Loops 7 (2)
Using the for Loop 7 (2)
Using a for Loop to Draw a Square 9 (1)
Creating Shortcuts with Functions 9 (2)
Using Variables to Draw Shapes 11 (2)
Using Variables in Functions 11 (1)
Variable Errors 12 (1)
Equilateral Triangles 13 (4)
Writing the triangle() Function 13 (1)
Making Variables Vary 14 (3)
Summary 17 (2)
2 Making Tedious Arithmetic Fun With Lists 19 (18)
And Loops
Basic Operators 20 (2)
Operating on Variables 20 (1)
Using Operators to Write the average)) 21 (1)
Function
Mind the Order of Operations! 21 (1)
Using Parentheses with Operators 22 (1)
Data Types in Python 22 (3)
Integers and Floats 22 (1)
Strings 23 (1)
Booleans 24 (1)
Checking Data Types 25 (1)
Using Lists to Store Values 25 (2)
Adding Items to a List 26 (1)
Operating on Lists 26 (1)
Removing Items from a List 27 (1)
Using Lists in Loops 27 (5)
Accessing Individual Items with List 28 (1)
Indices
Accessing Index and Value with 29 (1)
enumerated
Indices Start at Zero 29 (1)
Accessing a Range of List Items 30 (1)
Finding Out the Index of an Item 30 (1)
Strings Use Indices, Too 31 (1)
Summation 32 (2)
Creating the running_sum Variable 32 (1)
Writing the mySum() Function 33 (1)
Finding the Average of a List of Numbers 34 (1)
Summary 35 34 (3)
3 Guessing And Checking With Conditionals 37 (16)
Comparison Operators 38 (1)
Making Decisions with if and else 38 (1)
Statements
Using Conditionals to Find Factors 39 (4)
Writing the factors.py Program 40 (1)
The Wandering Turtle 41 (2)
Creating a Number-Guessing Game 43 (5)
Making a Random Number Generator 44 (1)
Taking User Input 44 (1)
Converting User Input to Integers 45 (1)
Using Conditionals to Check for a 45 (1)
Correct Guess
Using a Loop to Guess Again! 46 (1)
Tips for Guessing 47 (1)
Finding Square Roots 48 (2)
Applying the Number-Guessing Game Logic 48 (1)
Writing the squareRoot() Function 49 (1)
Summary 50 (3)
PART 2 RIDING INTO MATH TERRITORY
4 Transforming And Storing Numbers With 53 (24)
Algebra
Solving First-Degree Equations 54 (4)
Finding the Formula for First-Degree 55 (1)
Equations
Writing the equation() Function 56 (1)
Using print() Instead of return 57 (1)
Solving Higher-Degree Equations 58 (3)
Using quad() to Solve Quadratic 59 (1)
Equations
Using plug() to Solve a Cubic Equation 60 (1)
Solving Equations Graphically 61 (1)
Getting Started with Processing 61 (2)
Creating Your Own Graphing Tool 63 (6)
Graphing an Equation 69 (4)
Using Guess and Check to Find the Roots 73 (1)
Writing the guess() Function 73 (2)
Summary 75 75 (2)
5 Transforming Shapes With Geometry 77 (1)
Drawing a Circle 78 (1)
Specifying Location Using Coordinates 79 (1)
Transformation Functions 80 (6)
Translating Objects with translate() 80 (3)
Rotating Objects with rotate() 83 (1)
Drawing a Circle of Circles 84 (1)
Drawing a Circle of Squares 85 (1)
Animating Objects 86 (3)
Creating the t Variable 86 (1)
Rotating the Individual Squares 87 (1)
Saving Orientation with pushMatrix() 88 (1)
and popMatrix()
Rotating Around the Center 89 (1)
Creating an Interactive Rainbow Grid 89 (4)
Drawing a Grid of Objects 90 (1)
Adding the Rainbow Color to Objects 91 (2)
Drawing Complex Patterns Using Triangles 93 (9)
A 30-60-90 Triangle 94 (2)
Drawing an Equilateral Triangle 96 (2)
Drawing Multiple Rotating Triangles 98 (1)
Phase-Shifting the Rotation 99 (1)
Finalizing the Design 100 (2)
Summary 102 (1)
6 Creating Oscillations With Trigonometry 103 (24)
Using Trigonometry for Rotations and 105 (1)
Oscillations
Writing Functions to Draw Polygons 106 (4)
Drawing a Hexagon with Loops 107 (2)
Drawing an Equilateral Triangle 109 (1)
Making Sine Waves 110 (6)
Leaving a Trail 113 (1)
Using Python's Built-in enumerated 114 (2)
Function
Creating a Spirograph Program 116 (4)
Drawing the Smaller Circle 117 (1)
Rotating the Smaller Circle 117 (3)
Making Harmonographs 120 (6)
Writing the harmonograph Program 121 (2)
Filling the List Instantly 123 (1)
Two Pendulums Are Better Than One 124 (2)
Summary 126 (1)
7 Complex Numbers 127 (18)
The Complex Coordinate System 128 (1)
Adding Complex Numbers I 129 (1)
Multiplying a Complex Number by i 130 (1)
Multiplying Two Complex Numbers 131 (1)
Writing the magnitude() Function 132 (1)
Creating the Mandelbrot Set 132 (9)
Writing the mandelbrot() Function 1 35 (104)
Adding Color to the Mandelbrot Set 139 (2)
Creating the Julia Set 141 (2)
Writing the Julia() Function 141 (2)
Summary 143 (2)
8 Using Matrices For Computer Graphics And 145 (30)
Systems Of Equations
What Is a Matrix? 146 (1)
Adding Matrices 146 (1)
Multiplying Matrices 147 (4)
Order Matters in Matrix Multiplication 151 (1)
Drawing 2D Shapes 151 (3)
Transforming Matrices 154 (2)
Transposing Matrices 156 (4)
Rotating Matrices in Real Time 160 (1)
Creating 3D Shapes 161 (1)
Creating the Rotation Matrix 162 (4)
Solving Systems of Equations with Matrices 166 (6)
Gaussian Elimination 167 (1)
Writing the gauss() Function 168 (4)
Summary 172 (3)
PART 3 BLAZING YOUR OWN TRAIL
9 Building Objects With Classes 175 (26)
Bouncing Ball Program 177 (9)
Making the Ball Move 178 (1)
Making the Ball Bounce Off the Wall 179 (2)
Making Multiple Balls Without Classes 181 (1)
Creating Objects Using Classes 182 (4)
Grazing Sheep Program 186 (14)
Writing the Class for the Sheep 186 (1)
Programming Sheep to Move Around 187 (2)
Creating the energy Property 189 (1)
Creating Grass Using Classes 189 (3)
Making the Grass Brown when Eaten 192 (2)
Giving Each Sheep a Random Color 194 (2)
Programming Sheep to Reproduce 196 (1)
Letting the Grass Regrow 197 (1)
Providing an Evolutionary Advantage 198 (2)
Summary 200 (1)
10 Creating Fractals Using Recursion 201 (24)
The Length of a Coastline 202 (7)
What Is Recursion? 203 (1)
Writing the factorial() Function 203 (1)
Building a Fractal Tree 204 (5)
Koch Snowflake 209 (5)
Writing the segment() Function 210 (4)
Sierpinski Triangle 214 (2)
Square Fractal 216 (4)
Dragon Curve 220 (4)
Summary 224 (1)
11 Cellular Automata 225 (22)
Creating a Cellular Automaton 226 (8)
Writing a Cell Class 228 (2)
Resizing Each Cell 230 (1)
Making a CA Grow 231 (1)
Putting the Cells into a Matrix 232 (1)
Creating the Cell List 233 (1)
Python Lists Are Strange 234 (4)
List Index Notation 235 (3)
Letting Your CA Grow Automatically 238 (1)
Playing the Game of Life 238 (3)
The Elementary Cellular Automaton 241 (5)
Summary 246 (1)
12 Solving Problems Using Genetic Algorithms 247 (26)
Using a Genetic Algorithm to Guess Phrases 248 (6)
Writing the makeList() Function 248 (1)
Testing the makeList() Function 249 (1)
Writing the score() Function 250 (1)
Writing the mutate() Function 250 (1)
Generating a Random Number 251 (3)
Solving the Traveling Salesperson Problem 254 (17)
(TSP)
Using Genetic Algorithms 254 (6)
Writing the calcLength() Method 260 (1)
Testing the calcLength() Method 261 (1)
Random Routes 262 (3)
Applying the Phrase-Guessing Mutation 265 (1)
Idea
Mutating Two Numbers in a List 265 (4)
Crossing Over to Improve Routes 269 (2)
Summary 271 (2)
Index 273