Kirstie Whitaker
June 15th 2017
Cape Town, SA
What? Python can lead to a more enriching learning and teaching experience in the classroom
How? Next slides
Whose calculator looks like this?
>>> (131 + 21.5 + 100.2 + 88.7 + 99.5 + 100.5 + 200.5)/4
185.475
Python 3 is my favorite calculator (not Python 2 because 1/2 = 0)
Beyond basic operations:
fabs()
, abs()
, sin()
, cos()
, gcd()
, log()
and more (See math)
Descriptive statistics (See statistics)
Develop your own functions: unit conversion, finding correlation, .., anything really
Use PYTHONSTARTUP to extend the battery of readily available mathematical functions
$ PYTHONSTARTUP=~/work/dmwp/pycon-us-2016/startup_math.py idle3 -s
>>> unit_conversion()
1. Kilometers to Miles
2. Miles to Kilometers
3. Kilograms to Pounds
4. Pounds to Kilograms
5. Celsius to Fahrenheit
6. Fahrenheit to Celsius
Which conversion would you like to do? 6
Enter temperature in fahrenheit: 98
Temperature in celsius: 36.66666666666667
>>>
>>>
>>> x = [1, 2, 3, 4]
>>> y = [2, 4, 6.1, 7.9]
>>> find_corr_x_y(x, y)
0.9995411791453812
SymPy - a pure Python symbolic math library
from sympy import awesomeness - don't try that :)
# Create graphs from algebraic expressions
from sympy import Symbol, plot
x = Symbol('x')
p = plot(2*x**2 + 2*x + 2)
# Solve equations
from sympy import solve, Symbol
x = Symbol('x')
solve(2*x + 1)
[-1/2]
# Limits
from sympy import Symbol, Limit, sin
x = Symbol('x')
Limit(sin(x)/x, x, 0).doit()
1
# Derivative
from sympy import Symbol, Derivative, sin, init_printing
x = Symbol('x')
init_printing()
Derivative(sin(x)**(2*x+1), x).doit()
# Indefinite integral
from sympy import Symbol, Integral, sqrt, sin, init_printing
x = Symbol('x')
init_printing()
Integral(sqrt(x)).doit()
# Definite integral
from sympy import Symbol, Integral, sqrt
x = Symbol('x')
Integral(sqrt(x), (x, 0, 2)).doit()
matplotlib
basemap
Interactive Jupyter Notebooks
Animation of a Projectile motion (Python Source)
from IPython.display import YouTubeVideo
YouTubeVideo("8uWRVh58KdQ")
Showing places on a digital map (Notebook)
Overview
All of what I have discussed so far
In addition: Descriptive statistics, Sets and Probability, Random numbers
Published by No Starch Press in August, 2015.
Upcoming/In-progress translations: Simplified Chinese, Japanese, French and Korean.
Saha does an excellent job providing a clear link between Python and upper-level math concepts, and demonstrates how Python can be transformed into a mathematical stage. This book deserves a spot on every geometry teacher’s bookshelf.
Outstanding guide to using Python to do maths. Working back through my undergrad maths using Python.
Saha does an excellent job providing a clear link between Python and upper-level math concepts, and demonstrates how Python can be transformed into a mathematical stage.
This book is highly recommended for the high school or college student and anyone who is looking for a more natural way of programming math and scientific functions
As a teacher I highly recommend this book as a way to work with someone in learning both math and programming
Statistics and Graphing data -> Data Science
Differential Calculus -> Machine learning
Use gradient descent to find a function's minimum value (Notebook)
Use gradient descent as the optimizer for single variable linear regression model (Notebook)
Use PYCONMATH code to get 30% off "Doing Math with Python" from No Starch Press
(Valid from May 26th - June 8th)
Book Signing - May 31st - 2.00 PM - No Starch Press booth
PyCon US Education Summit team for inviting me
Thanks to PyCon US for reduced registration rates
Massive thanks to my employer, Freelancer.com for sponsoring my travel and stay