Math Adventures with Python
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.
- 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!
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.
Part 1: Hitchin’ Up Your Python Wagon
Chapter 1: Drawing Polygons with Turtles
Chapter 2: Making Tedious Arithmetic Fun with Lists and Loops
Chapter 3: Guessing and Checking with Conditionals
Part 2: Riding into Math Territory
Chapter 4: Transforming and Storing Numbers with Algebra
Chapter 5: Transforming Shapes with Geometry
Chapter 6: Creating Oscillations with Trigonometry
Chapter 7: Complex Numbers
Chapter 8: Using Matrices for Computer Graphics and Systems of Equations
Part 3: Blazing Your Own Trail
Chapter 9: Building Objects with Classes
Chapter 10: Creating Fractals Using Recursion
Chapter 11: Cellular Automata
Chapter 12: Solving Problems Using Genetic Algorithms
Featured in interviews on Opensource.com, Mouse Vs. Python, and ElectronicsWeekly.com.
«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 you’re a mathy type and want to get into some computer programming, or if you’re 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
Math Adventures with Python
Read it now on the O’Reilly learning platform with a 10-day free trial.
O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.
Book description
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.
•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!
Table of contents
- Cover Page
- Title Page
- Copyright Page
- Dedication
- ABOUT THE AUTHOR
- ABOUT THE TECHNICAL REVIEWER
- BRIEF CONTENTS
- CONTENTS IN DETAIL
- ACKNOWLEDGMENTS
- INTRODUCTION
- The Problem with School Math
- About This Book
- Who Should Use This Book
- What’s in This Book?
- Downloading and Installing Python
- Starting IDLE
- Installing Processing
- Python’s turtle Module
- Repeating Code with Loops
- Creating Shortcuts with Functions
- Using Variables to Draw Shapes
- Equilateral Triangles
- Summary
- Basic Operators
- Data Types in Python
- Using Lists to Store Values
- Using Lists in Loops
- Summation
- Finding the Average of a List of Numbers
- Summary
- Comparison Operators
- Making Decisions with if and else Statements
- Using Conditionals to Find Factors
- Creating a Number-Guessing Game
- Finding Square Roots
- Summary
- Solving First-Degree Equations
- Solving Higher-Degree Equations
- Solving Equations Graphically
- Summary
- Drawing a Circle
- Specifying Location Using Coordinates
- Transformation Functions
- Animating Objects
- Creating an Interactive Rainbow Grid
- Drawing Complex Patterns Using Triangles
- Summary
- Using Trigonometry for Rotations and Oscillations
- Writing Functions to Draw Polygons
- Making Sine Waves
- Creating a Spirograph Program
- Making Harmonographs
- Summary
- The Complex Coordinate System
- Adding Complex Numbers
- Multiplying a Complex Number by i
- Multiplying Two Complex Numbers
- Writing the magnitude() Function
- Creating the Mandelbrot Set
- Creating the Julia Set
- Summary
- What Is a Matrix?
- Adding Matrices
- Multiplying Matrices
- Order Matters in Matrix Multiplication
- Drawing 2D Shapes
- Transforming Matrices
- Transposing Matrices
- Rotating Matrices in Real Time
- Creating 3D Shapes
- Creating the Rotation Matrix
- Solving Systems of Equations with Matrices
- Summary
- Bouncing Ball Program
- Grazing Sheep Program
- Summary
- The Length of a Coastline
- Koch Snowflake
- Sierpinski Triangle
- Square Fractal
- Dragon Curve
- Summary
- Creating a Cellular Automaton
- Python Lists Are Strange
- Playing the Game of Life
- The Elementary Cellular Automaton
- Summary
- Using a Genetic Algorithm to Guess Phrases
- Solving the Traveling Salesperson Problem (TSP)
- Summary
Product information
- Title: Math Adventures with Python
- Author(s): Peter Farrell
- Release date: January 2019
- Publisher(s): No Starch Press
- ISBN: 9781593278670
You might also like
Check it out now on O’Reilly
Dive in for free with a 10-day trial of the O’Reilly learning platform—then explore all the other resources our members count on to build skills and solve problems every day.
Math Adventures with Python
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!
Similar Books
Applying Math with Python, 2nd Edition
The updated edition of Applying Math with Python will help you solve complex problems in a wide variety of mathematical fields in simple and efficient ways. Old recipes have been revised for new libraries and several recipes have been added to demonstrate new tools such as JAX.You’ll start by refreshing your knowledge of several core.
Price: $39.99 | Publisher: Packt Publishing | Release: 2022
Programming Computer Vision with Python
If you want a basic understanding of computer vision’s underlying theory and algorithms, this hands-on introduction is the ideal place to start. You’ll learn techniques for object recognition, 3D reconstruction, stereo imaging, augmented reality, and other computer vision applications as you follow clear examples written in Pyth.
Price: $22.50 | Free ebook | Publisher: O’Reilly Media | Release: 2012
The book is based on «First semester in Numerical Analysis with Julia». The contents of the original book are retained, while all the algorithms are implemented in Python (Version 3.8.0). Python is an open source (under OSI), interpreted, general-purpose programming language that has a large number of users around the world. Pyt.
Free ebook | Publisher: Self-publishing | Release: 2020
Begin to Code with Python
Start writing software that solves real problems, even if you have absolutely no programming experience! This friendly, easy, full-color book puts you in total control of your own learning, empowering you to build unique and useful programs. Microsoft has completely reinvented the beginning programmer’s tutorial, reflecting deep rese.
Price: $18.71 | Publisher: Microsoft Press | Release: 2017
OpenCV Computer Vision with Python
Computer Vision can reach consumers in various contexts via webcams, camera phones and gaming sensors like Kinect. OpenCV’s Python bindings can help developers meet these consumer demands for applications that capture images, change their appearance and extract information from them, in a high-level language and in a standardized dat.
Price: $13.61 | Publisher: Packt Publishing | Release: 2013
Hands-On Bitcoin Programming with Python
by Harish Kumar Garg
Bitcoin is a cryptocurrency that’s changing the face of online payments. Hands-On Bitcoin Programming with Python teaches you to build software applications for mining and creating Bitcoins using Python.This book starts with the basics of both Bitcoin and blockchain and gives you an overview of these inherent concepts by showing you .
Price: $24.99 | Publisher: Packt Publishing | Release: 2018
Learn Web Development with Python
by Fabrizio Romano, Gaston C. Hillar, Arun Ravindran
If you want to develop complete Python web apps with Django, this Learning Path is for you. It will walk you through Python programming techniques and guide you in implementing them when creating 4 professional Django projects, teaching you how to solve common problems and develop RESTful web services with Django and Python. You will lear.
Price: $49.99 | Publisher: Packt Publishing | Release: 2018
by Tirthajyoti Sarkar
This book focuses on the Python-based tools and techniques to help you become highly productive at all aspects of typical data science stacks such as statistical analysis, visualization, model selection, and feature engineering.You’ll review the inefficiencies and bottlenecks lurking in the daily business process and solve them with .
Price: $49.99 | Publisher: Apress | Release: 2022