Doing Math with Python: Use Programming to Explore Algebra, by Amit Saha

By Amit Saha

Doing Math with Python indicates you ways to exploit Python to delve into excessive school—level math subject matters like facts, geometry, chance, and calculus. You'll commence with easy tasks, like a factoring application and a quadratic-equation solver, after which create extra advanced initiatives as soon as you've gotten the grasp of things.

Along the way in which, you'll observe new how one can discover math and achieve invaluable programming abilities that you'll use all through your research of math and laptop technology. learn the way to:

Describe your facts with statistics, and visualize it with line graphs, bar charts, and scatter plots
discover set idea and likelihood with courses for coin flips, dicing, and different video games of chance
clear up algebra difficulties utilizing Python's symbolic math functions
Draw geometric shapes and discover fractals just like the Barnsley fern, the Sierpinski triangle, and the Mandelbrot set
Write courses to discover derivatives and combine functions

Creative coding demanding situations and utilized examples assist you see how one can placed your new math and coding talents into perform. You'll write an inequality solver, plot gravity's influence on how some distance a bullet will go back and forth, shuffle a deck of playing cards, estimate the world of a circle by way of throwing 100,000 "darts" at a board, discover the connection among the Fibonacci series and the golden ratio, and more.

Whether you're drawn to math yet haven't begun to dip into programming or you're a instructor seeking to carry programming into the study room, you'll locate that Python makes programming effortless and useful. enable Python deal with the grunt paintings if you specialize in the mathematics.

Show description

Read or Download Doing Math with Python: Use Programming to Explore Algebra, Statistics, Calculus, and More! PDF

Similar python books

Getting Started with Beautiful Soup

The best way to extract details from web content utilizing attractive Soup and the Python urllib2 module. This functional, hands-on advisor covers every thing you must comprehend to get a head commence in web site scraping.

Programming Python (4th Edition)

If you've mastered Python's basics, you're able to commence utilizing it to get genuine paintings performed. Programming Python will express you ways, with in-depth tutorials at the language's basic software domain names: method management, GUIs, and the net. You'll additionally discover how Python is utilized in databases, networking, front-end scripting layers, textual content processing, and extra.

Learning BeagleBone Python Programming

BeagleBone is a barebone desktop that may be configured and customised for various purposes and is sort of part the cost of a regular laptop. This e-book will disguise the fundamentals of ways BeagleBone Black's interface subsystems paintings, and will be managed utilizing renowned Python libraries for BeagleBone Black.

Python Essentials - A Rapid Guide to the Fundamental Features of Python

Key FeaturesLearn tips on how to write potent Python codeGet up-to-speed with an important info constructions in Python, utilizing sequences, units, and mappingsExplore Python's amazing diversity of gains and notice why it is the most well known programming languages within the worldBook DescriptionPython necessities presents an essential travel of the main severe positive aspects of Python.

Additional info for Doing Math with Python: Use Programming to Explore Algebra, Statistics, Calculus, and More!

Sample text

Creating a tuple is similar to creating a list, but instead of square brackets, you use parentheses: >>> simpletuple = (1, 2, 3) You can refer to an individual number in simpletuple using the corresponding index in brackets, just as with lists: >>> simpletuple[0] 1 30 Chapter 2 >>> simpletuple[1] 2 >>> simpletuple[2] 3 You can also use negative indices with both lists and tuples. For example, simplelist[-1] and simpletuple[-1] would refer to the last element of the list or the tuple, simplelist[-2] and simpletuple[-2] would refer to the second-to- last element, and so on.

Y 3 A (x, y) 2 Origin 1 −3 −2 −1 −1 1 2 3 x −2 −3 Figure 2-2: The Cartesian coordinate plane As with the number line, we can have infinitely many points on the plane. We describe a point with a pair of numbers instead of one number. For example, we describe the point A in the figure with two numbers, x and y, usually written as (x, y) and referred to as the coordinates of the point. 28 Chapter 2 As shown in Figure 2-2, x is the distance of the point from the origin along the x-axis, and y is the distance along the y-axis.

Format(a+b)) u v if __name__ == '__main__': a = Fraction(input('Enter first fraction: ')) b = Fraction(input('Enter second fraction: ')) op = input('Operation to perform - Add, Subtract, Divide, Multiply: ') if op == 'Add': add(a,b) You’ve already seen most of the elements in this program. At u and v, we ask the user to input the two fractions. Then, we ask the user which operation is to be performed on the two fractions. If the user enters 'Add' as input, we call the function add(), which we’ve defined to find the sum of the two fractions passed as arguments.

Download PDF sample

Rated 4.36 of 5 – based on 35 votes