Outils pour utilisateurs

Outils du site


issue104:critique2

Ceci est une ancienne révision du document !


August 2015, 264 pp. ISBN: 978-1-59327-640-9

Are your students future scientists or mathematicians? Do they seem to enjoy exploring the world or playing with numbers? Or perhaps they just like creating things on the computer? Doing Math with Python is a possible choice for a student or a teacher to use to teach and enhance a student's skills. For some students, it could help them get a better understand of some of the mathematical topics discussed. For young, budding scientists, the book can help them learn how to collect and analyze data. The programmer will learn to break complicated problems into smaller ones in order to find a solution.

The book was written by Amit Saha, a software engineer. He also created and maintains Fedora Scientific, a Linux distribution for scientific and educational users.

The language of the book is simple and easy to follow. The book does assume you are familiar with the basics of Python. The author does a good job of teaching how to break complicated formulas down into pieces in order to avoid long complicated statements in Python. In many cases, I felt like I understood the formula better after this process. The division of large formulas into smaller expressions could help a struggling math or science student to succeed. The explanations of the mathematics and the programming are clear and easy to follow. This book is as much a math and science book as it is a programming book. Amit has brought the three topics together in a very natural and pleasing way. Using the computer makes it quicker and easier to change and play with the results. I must admit, I had a few eureka moments myself, and times when I had to force myself to move on because I was spending a lot of time playing with the numbers to get new results.

The book is divided into 7 chapters. The following is a short synopsis of each chapter.

Chapter 1, Working with Numbers, is an introduction to the book. You review the different types of numbers you can create in Python, including fractions and complex numbers. You also see how to use the basic mathematical operators (plus, minus, multiplication, division, modulo, and exponents) built into Python. You learn to assign a label to a number for use later in a program. He calls them labels rather than the traditional variable to avoid confusion when the term is used in the mathematical sense. You see how to create and work with fractions and complex numbers as well as do mathematical operations with these number types. Getting and verifying user's input is given a once-over and discussed often in the course of the book. Your first program is a program that calculates the factors of a supplied number. The first big step in the book is translating the root of a quadratic equation using the functions and operators built into Python.

Chapter 2, Visualizing Data Using Graphs, teaches you the basics of plotting a graph using the matplotlib module. You learn to feed data into the plot function, give the graph a title and labels, create a legend, and control the minimum and maximum values of the X and Y axes. After plotting several single-line charts, you plot a series of multiple-line plots, showing you how to use a graph to do a comparison of two sets of data. Finally, you use a formula to generate the data you plot on your graph. This is an important step in the evolution of your skills with the matplotlib module. In the challenges at the end of the chapter, you even learn how to create a bar chart using the matplotlib.

Chapter 3, Describing Data with Statistics, you dive into the exciting world of statistics. You create functions for calculating the basic equations of statistics, mean, median, mode, range, variance, and standard deviation. Although not directly discussed in the book, these functions would make a good library collected into one file. You work through the complicated formula for calculating a Correlation Coefficient between two sets of numbers. You then learn how to create a scatter plot in matplotlib. If you have never used a scatter plot before, you learn that even though the mean, standard deviation, and correlation of sets may look the same, scatter plots can give a view of the data that tells a whole new story. With a scatter plot, you can see the outliers that can skew your numbers. You then get a refresher on how to import data from a text file, and more importantly, how to import data from a comma-separated value (CSV) file. CSV files are a good way to get large amounts of data into your program.

Chapter 4, Algebra and Symbolic Math with SymPy, plunges you into the world of Algebra and symbolic math. SymPy is a module that allows you to use symbols in your formula and get results. After learning how to create a symbol object, you begin to work with Algebraic expressions, factoring expressions, creating series, simplifying expressions, and substituting values for symbols. Then you are off solving equations and plotting equations using SymPy. This naturally led to plotting multiple expressions on one chart.

Chapter 5, Playing with Sets and Probability, introduces you to creating sets in SymPy. SymPy sets behave just like mathematical sets and give you the ability to calculate subsets, supersets, and power sets. It also has the set operators for union, intersection, and Cartesian product. With these tools in hand, you find yourself applying sets to formulas and getting results. You are also introduced to working with probability using sets. This uses the union and intersection of sets to create an event set for calculating the probability of the resulting set. The work with probability includes both uniform and nonuniform probabilities.

Chapter 6, Drawing Geometric Shapes and Fractals, will be your favorite chapter if you enjoy geometry. You discover how to draw circles, animate them on a graph, and even create an animated trajectory chart. Next, you learn about fractals and how they are made. You start with a simple zigzag with four formulas with equal probability, then move on to a Bransley Fern that uses the skills of nonuniform probability introduced in the previous chapter. Overall a good time of learning and creating interesting charts.

Chapter 7, Solving Calculus Problems, brings everything together to discuss the most advanced math in the book. Amit begins by defining what a function is. After a quick overview of common mathematical functions, you dive into finding the limit of functions. This includes some new methods in SymPy. You use Python to calculate compound interest and rate of change. Then you plunge into derivatives, including partial derivatives and high-order derivatives. You find and plot the global maximum using gradient ascent. Next, you learn how to use SymPy to find the integrals of functions. Finally, you learn about the probability density functions.

Whether your student is a budding mathematician, scientist, programmer, or maybe even struggling with one of the subjects, ‘Doing Math with Python’ is a great book for exploring the topics of computer programming, mathematics, or science. Each topic builds on the previous to build a solid knowledge of each topic. After ‘Teach Your Kids to Code’ by Bryson Payne (see review in FCM#98), Doing Math with Python would make a good follow-up book for a secondary school level code club. If you teach mathematics or science, you might want to consider it as a supplemental text, or the topics could be expanded to create a class on its own.

issue104/critique2.1451325210.txt.gz · Dernière modification : 2015/12/28 18:53 de auntiee