Our first example is rather simple,
$$ f(x) =\exp{x^2}, $$with derivative
$$ f'(x) =2x\exp{x^2}. $$We can use SymPy to extract the pertinent lines of Python code through the following simple example
from __future__ import division
from sympy import *
x = symbols('x')
expr = exp(x*x)
simplify(expr)
derivative = diff(expr,x)
print(python(expr))
print(python(derivative))