Muutke küpsiste eelistusi

Math Adventures with Python: An Illustrated Guide to Exploring Math with Code [Pehme köide]

  • Formaat: Paperback / softback, 304 pages, kõrgus x laius: 236x178 mm, 304 Illustrations
  • Ilmumisaeg: 08-Jan-2019
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1593278675
  • ISBN-13: 9781593278670
Teised raamatud teemal:
  • Formaat: Paperback / softback, 304 pages, kõrgus x laius: 236x178 mm, 304 Illustrations
  • Ilmumisaeg: 08-Jan-2019
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1593278675
  • ISBN-13: 9781593278670
Teised raamatud teemal:
"Teaches math concepts through programming. Begins with a crash course in basic programming concepts and how to use Python's built-in Turtle module, and then explores topics like writing programs to solve equations and matrices, drawing polygons and fractals, and using the Processing graphics library to create interactive 2D and 3D models"--

Learn math by getting creative with code! Use the Python programming language to transform learning high school-level math topics like algebra, geometry, trigonometry, and calculus!

Math Adventures with Python will show you how to harness the power of programming to keep math relevant and fun. With the aid of the Python programming language, you'll learn how to visualize solutions to a range of math problems as you use code to explore key mathematical concepts like algebra, trigonometry, matrices, and cellular automata.

Once you've learned the programming basics like loops and variables, you'll write your own programs to solve equations quickly, make cool things like an interactive rainbow grid, and automate tedious tasks like factoring numbers and finding square roots. You'll learn how to write functions to draw and manipulate shapes, create oscillating sine waves, and solve equations graphically.

You'll also learn how to:
- Draw and transform 2D and 3D graphics with matrices
- Make colorful designs like the Mandelbrot and Julia sets with complex numbers
- Use recursion to create fractals like the Koch snowflake and the Sierpinski triangle
- Generate virtual sheep that graze on grass and multiply autonomously
- Crack secret codes using genetic algorithms

As you work through the book's numerous examples and increasingly challenging exercises, you'll code your own solutions, create beautiful visualizations, and see just how much more fun math can be!

Arvustused

"We have entered an era where learning Python is as essential as knowing the analytical skills of mathematics, and so from students to teachers, Math Adventures with Python is an indispensable book for all." Gabrielle Birkman, Mathematician and Writer

"Peter Farrell subverts the structure of a traditional math textbook and adopts an approach centered on student creation and discovery. Rather than treating mathematical facts as symbolic formalism to be mindlessly imitated by students, Math Adventures with Python seeks to teach mathematics through guided discovery. " Dr. Tien Chih, Professor of Mathematics, Montana State University-Billings

"If youre a mathy type and want to get into some computer programming, or if youre a computer person but want to learn what kinds of math you can do with code, Math Adventures with Python will help you achieve those goals." Jenny Bristol, GeekDad

Muu info

Learn math by getting creative with code. Use the Python programming language to transform learning high school-level math topics like algebra, geometry, trigonometry, and calculus.
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 And Loops
19(18)
Basic Operators
20(2)
Operating on Variables
20(1)
Using Operators to Write the average)) Function
21(1)
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 Indices
28(1)
Accessing Index and Value with enumerated
29(1)
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 Statements
38(1)
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 Correct Guess
45(1)
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 Algebra
53(24)
Solving First-Degree Equations
54(4)
Finding the Formula for First-Degree Equations
55(1)
Writing the equation() Function
56(1)
Using print() Instead of return
57(1)
Solving Higher-Degree Equations
58(3)
Using quad() to Solve Quadratic Equations
59(1)
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() and popMatrix()
88(1)
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 Oscillations
105(1)
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 Function
114(2)
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 Systems Of Equations
145(30)
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 (TSP)
254(17)
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 Idea
265(1)
Mutating Two Numbers in a List
265(4)
Crossing Over to Improve Routes
269(2)
Summary
271(2)
Index 273
Peter Farrell is a math and computer science teacher with a passion for customizing ("hacking") math education and learning with technology. He lives in the San Francisco Bay Area with his wife and children.