This is one of the 100 recipes of the IPython Cookbook, the definitive guide to high-performance scientific computing and data science in Python.

15.3. Analyzing real-valued functions

In [ ]:
from sympy import *
init_printing()
In [ ]:
var('x z')

We define a new function depending on x.

In [ ]:
f = 1/(1+x**2)

Let's evaluate this function in 1.

In [ ]:
f.subs(x, 1)

We can compute the derivative of this function...

In [ ]:
diff(f, x)

limits...

In [ ]:
limit(f, x, oo)

Taylor series...

In [ ]:
series(f, x0=0, n=9)

Definite integrals...

In [ ]:
integrate(f, (x, -oo, oo))

indefinite integrals...

In [ ]:
integrate(f, x)

and even Fourier transforms!

In [ ]:
fourier_transform(f, x, z)

You'll find all the explanations, figures, references, and much more in the book (to be released later this summer).

IPython Cookbook, by Cyrille Rossant, Packt Publishing, 2014 (500 pages).