In [3]:
%matplotlib inline
Software Engineer at Freelancer.com HQ in Sydney, Australia
Author of "Doing Math with Python" (No Starch Press, 2015)
Writes for Linux Voice, Linux Journal, and others.
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
Python 3, SymPy, matplotlib
*Individual logos are copyright of the respective projects. Source of the "giant shoulders" image.
fabs()
, abs()
, sin()
, cos()
, gcd()
, log()
and more (See math)
Descriptive statistics (See statistics)
>>> 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
>>>
In [5]:
# Create graphs from algebraic expressions
from sympy import Symbol, plot
x = Symbol('x')
p = plot(2*x**2 + 2*x + 2)
In [13]:
# Solve equations
from sympy import solve, Symbol
x = Symbol('x')
solve(2*x + 1)
Out[13]:
In [24]:
# Limits
from sympy import Symbol, Limit, sin
x = Symbol('x')
Limit(sin(x)/x, x, 0).doit()
Out[24]:
In [2]:
# Derivative
from sympy import Symbol, Derivative, sin, init_printing
x = Symbol('x')
init_printing()
Derivative(sin(x)**(2*x+1), x).doit()
Out[2]:
In [16]:
# Indefinite integral
from sympy import Symbol, Integral, sqrt, sin, init_printing
x = Symbol('x')
init_printing()
Integral(sqrt(x)).doit()
Out[16]:
In [19]:
# Definite integral
from sympy import Symbol, Integral, sqrt
x = Symbol('x')
Integral(sqrt(x), (x, 0, 2)).doit()
Out[19]:
Animation of a Projectile motion (Python Source)
In [3]:
from IPython.display import YouTubeVideo
YouTubeVideo("8uWRVh58KdQ")
Out[3]:
Showing places on a digital map (Notebook)