Evaluate integral from sympy as lambda function
Question: I'm using the sympy module of python. I do is this:

    
    
    x= Symbol('x')
    integrate(x**2+2,x)
    

The answer is:

    
    
    x**3/3 + 2*x
    

Now, the question is this: Is there a way to make this answer a lambda
function of x?


Answer: Yes, use `lambdify`:

    
    
    >>> f = lambdify(x, integrate(x**2+2,x))
    >>> f(2)
    6.666666666666666
    

If you want to use this with numpy, set `"numpy"` as the second argument of
lambdify

    
    
    >>> import numpy as np
    >>> f = lambdify(x, integrate(x**2+2,x), "numpy")
    >>> f(np.arange(10))
    array([   0.        ,    2.33333333,    6.66666667,   15.        ,
             29.33333333,   51.66666667,   84.        ,  128.33333333,
            186.66666667,  261.        ])
    

(you'll probably want to `import numpy as np` and `import sympy as sp` and not
import names directly if you do this, since functions from the two do not mix)

