## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## Book Description

Doing Math with Python teaches you how to use Python as a tool to delve into math concepts.

1. Cover Page
2. Title Page
4. Dedication
5. Brief Contents
6. Contents in Detail
7. Acknowledgments
8. Introduction
9. Chapter 1: Working with Numbers
1. Basic Mathematical Operations
2. Labels: Attaching Names to Numbers
3. Different Kinds of Numbers
4. Getting User Input
5. Writing Programs That Do the Math for You
6. What You Learned
7. Programming Challenges
10. Chapter 2: Visualizing Data with Graphs
1. Understanding the Cartesian Coordinate Plane
2. Working with Lists and Tuples
3. Creating Graphs with Matplotlib
1. Marking Points on Your Graph
2. Graphing the Average Annual Temperature in New York City
3. Comparing the Monthly Temperature Trends of New York City
4. Customizing Graphs
5. Saving the Plots
4. Plotting with Formulas
1. Newton’s Law of Universal Gravitation
2. Projectile Motion
5. What You Learned
6. Programming Challenges
11. Chapter 3: Describing Data with Statistics
1. Finding the Mean
2. Finding the Median
3. Finding the Mode and Creating a Frequency Table
4. Measuring the Dispersion
5. Calculating the Correlation Between Two Data Sets
6. Scatter Plots
8. What You Learned
9. Programming Challenges
12. Chapter 4: Algebra and Symbolic Math with SymPy
1. Defining Symbols and Symbolic Operations
2. Working with Expressions
1. Factorizing and Expanding Expressions
2. Pretty Printing
3. Substituting in Values
4. Converting Strings to Mathematical Expressions
3. Solving Equations
4. Plotting Using SymPy
5. What You Learned
6. Programming Challenges
1. #1: Factor Finder
2. #2: Graphical Equation Solver
3. #3: Summing a Series
4. #4: Solving Single-Variable Inequalities
13. Chapter 5: Playing with Sets and Probability
1. What’s a Set?
1. Set Construction
2. Subsets, Supersets, and Power Sets
3. Set Operations
2. Probability
1. Probability of Event A or Event B
2. Probability of Event A and Event B
3. Generating Random Numbers
4. Nonuniform Random Numbers
3. What You Learned
4. Programming Challenges
14. Chapter 6: Drawing Geometric Shapes and Fractals
1. Drawing Geometric Shapes with Matplotlib’s Patches
2. Drawing Fractals
3. What You Learned
4. Programming Challenges
1. #1: Packing Circles into a Square
2. #2: Drawing the Sierpiński Triangle
3. #3: Exploring Hénon’s Function
4. #4: Drawing the Mandelbrot Set
15. Chapter 7: Solving Calculus Problems
1. What Is a Function?
2. Assumptions in SymPy
3. Finding the Limit of Functions
4. Finding the Derivative of Functions
5. Higher-Order Derivatives and Finding the Maxima and Minima
6. Finding the Global Maximum Using Gradient Ascent
7. Finding the Integrals of Functions
8. Probability Density Functions
9. What You Learned
10. Programming Challenges
16. Afterword
1. Things to Explore Next
2. Getting Help
3. Conclusion
17. Appendix A: Software Installation
1. Microsoft Windows
2. Linux
3. Mac OS X
18. Appendix B: Overview of Python Topics
1. if __name__ == '__main__'
2. List Comprehensions
3. Dictionary Data Structure
4. Multiple Return Values
5. Exception Handling