Approximating Numerical 2nd Derivative with Python
<p>To preface this question, I understand that it could be done better. But this is a question in a class of mine and I must approach it this way. We cannot use any built in functions or packages.</p>

<p>I need to write a function to approximate the numerical value of the second derivative of a given function using finite difference. The function is below we are using. </p>

<p><a href="http://i.stack.imgur.com/4QSsT.jpg" rel="nofollow">2nd Derivative Formula</a> (I lost the login info to my old account so pardon my lack of points and not being able to include images).</p>

<p>My question is this: </p>

<p>I don't understand how to make the python function accept the input function it is to be deriving. If someone puts in the input <code>2nd_deriv(2x**2 + 4, 6)</code> I dont understand how to evaluate 2x^2 at 6. </p>

<p>If this is unclear, let me know and I can try again to describe. Python is new to me so I am just getting my feet wet. </p>

<p>Thanks</p>